| Requires any of the roles: | Admin, TeamAdmin | Requires the permission: | ReadData |
| POST | /OrderOwnerCards/upgrade | Charge the delta, issue the target card (PricePaid = delta), revoke the source card, re-link future tickets — one transaction, idempotent |
|---|
import Foundation
import ServiceStack
public class OwnerCardsUpgradeRequest : Codable
{
public var buyerPhone:String?
public var sourceOwnerCardId:Int?
public var targetOwnerCardTypeId:Int?
public var idempotencyKey:String?
public var paymentMethodId:String?
public var borgun3DFinalInfo:Borgun3DFinalRequest?
public var tenders:[OrderTender] = []
public var holderName:String?
public var holderEmail:String?
public var deviceId:String?
public var returnCards:Bool?
required public init(){}
}
public class Borgun3DFinalRequest : Codable
{
public var transactionType:String?
public var amount:Int?
public var currency:String?
public var transactionDate:Date?
public var orderId:String?
public var paymentMethod:Borgun3DFinalPaymentMethodInfo?
public var threeDSecure:Borgun3DFinal3DSecureInfo?
required public init(){}
}
public class Borgun3DFinalPaymentMethodInfo : Codable
{
public var paymentType:String?
public var token:String?
public var virtualNumber:String?
public var expYear:String?
public var expMonth:String?
public var panLastFour:String?
required public init(){}
}
public class Borgun3DFinal3DSecureInfo : Codable
{
public var dataType:String?
public var mpiToken:String?
required public init(){}
}
public class OrderTender : Codable
{
public var kind:String?
public var code:String?
public var amountMinor:Int?
public var idempotencyKey:String?
public var holdId:Int?
public var appliedMinor:Int?
required public init(){}
}
public class OwnerCardsUpgradeResult : OwnerCardsOrderResult
{
public var sourceOwnerCardId:Int?
public var sourceOwnerCardTypeId:Int?
public var sourceTypeName:String?
public var newOwnerCardId:Int?
public var targetOwnerCardTypeId:Int?
public var targetTypeName:String?
public var relinkedTickets:Int?
public var paymentReference:String?
public var refundPending:Bool?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case sourceOwnerCardId
case sourceOwnerCardTypeId
case sourceTypeName
case newOwnerCardId
case targetOwnerCardTypeId
case targetTypeName
case relinkedTickets
case paymentReference
case refundPending
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
sourceOwnerCardId = try container.decodeIfPresent(Int.self, forKey: .sourceOwnerCardId)
sourceOwnerCardTypeId = try container.decodeIfPresent(Int.self, forKey: .sourceOwnerCardTypeId)
sourceTypeName = try container.decodeIfPresent(String.self, forKey: .sourceTypeName)
newOwnerCardId = try container.decodeIfPresent(Int.self, forKey: .newOwnerCardId)
targetOwnerCardTypeId = try container.decodeIfPresent(Int.self, forKey: .targetOwnerCardTypeId)
targetTypeName = try container.decodeIfPresent(String.self, forKey: .targetTypeName)
relinkedTickets = try container.decodeIfPresent(Int.self, forKey: .relinkedTickets)
paymentReference = try container.decodeIfPresent(String.self, forKey: .paymentReference)
refundPending = try container.decodeIfPresent(Bool.self, forKey: .refundPending)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if sourceOwnerCardId != nil { try container.encode(sourceOwnerCardId, forKey: .sourceOwnerCardId) }
if sourceOwnerCardTypeId != nil { try container.encode(sourceOwnerCardTypeId, forKey: .sourceOwnerCardTypeId) }
if sourceTypeName != nil { try container.encode(sourceTypeName, forKey: .sourceTypeName) }
if newOwnerCardId != nil { try container.encode(newOwnerCardId, forKey: .newOwnerCardId) }
if targetOwnerCardTypeId != nil { try container.encode(targetOwnerCardTypeId, forKey: .targetOwnerCardTypeId) }
if targetTypeName != nil { try container.encode(targetTypeName, forKey: .targetTypeName) }
if relinkedTickets != nil { try container.encode(relinkedTickets, forKey: .relinkedTickets) }
if paymentReference != nil { try container.encode(paymentReference, forKey: .paymentReference) }
if refundPending != nil { try container.encode(refundPending, forKey: .refundPending) }
}
}
public class OwnerCardsOrderResult : GeneralOrderResponse
{
public var cards:[OwnerCards] = []
public var orderReference:String?
public var isSubscription:Bool?
public var monthlyPrice:Double?
public var transactionFee:Double?
public var months:Int?
public var paymentTokenId:String?
public var subscriptionTokenMissing:Bool?
public var priceTotal:Int?
public var discountAmount:Int?
public var giftCardAmount:Int?
public var donationAmount:Int?
public var chargedAmount:Int?
public var reason:String?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case cards
case orderReference
case isSubscription
case monthlyPrice
case transactionFee
case months
case paymentTokenId
case subscriptionTokenMissing
case priceTotal
case discountAmount
case giftCardAmount
case donationAmount
case chargedAmount
case reason
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
cards = try container.decodeIfPresent([OwnerCards].self, forKey: .cards) ?? []
orderReference = try container.decodeIfPresent(String.self, forKey: .orderReference)
isSubscription = try container.decodeIfPresent(Bool.self, forKey: .isSubscription)
monthlyPrice = try container.decodeIfPresent(Double.self, forKey: .monthlyPrice)
transactionFee = try container.decodeIfPresent(Double.self, forKey: .transactionFee)
months = try container.decodeIfPresent(Int.self, forKey: .months)
paymentTokenId = try container.decodeIfPresent(String.self, forKey: .paymentTokenId)
subscriptionTokenMissing = try container.decodeIfPresent(Bool.self, forKey: .subscriptionTokenMissing)
priceTotal = try container.decodeIfPresent(Int.self, forKey: .priceTotal)
discountAmount = try container.decodeIfPresent(Int.self, forKey: .discountAmount)
giftCardAmount = try container.decodeIfPresent(Int.self, forKey: .giftCardAmount)
donationAmount = try container.decodeIfPresent(Int.self, forKey: .donationAmount)
chargedAmount = try container.decodeIfPresent(Int.self, forKey: .chargedAmount)
reason = try container.decodeIfPresent(String.self, forKey: .reason)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if cards.count > 0 { try container.encode(cards, forKey: .cards) }
if orderReference != nil { try container.encode(orderReference, forKey: .orderReference) }
if isSubscription != nil { try container.encode(isSubscription, forKey: .isSubscription) }
if monthlyPrice != nil { try container.encode(monthlyPrice, forKey: .monthlyPrice) }
if transactionFee != nil { try container.encode(transactionFee, forKey: .transactionFee) }
if months != nil { try container.encode(months, forKey: .months) }
if paymentTokenId != nil { try container.encode(paymentTokenId, forKey: .paymentTokenId) }
if subscriptionTokenMissing != nil { try container.encode(subscriptionTokenMissing, forKey: .subscriptionTokenMissing) }
if priceTotal != nil { try container.encode(priceTotal, forKey: .priceTotal) }
if discountAmount != nil { try container.encode(discountAmount, forKey: .discountAmount) }
if giftCardAmount != nil { try container.encode(giftCardAmount, forKey: .giftCardAmount) }
if donationAmount != nil { try container.encode(donationAmount, forKey: .donationAmount) }
if chargedAmount != nil { try container.encode(chargedAmount, forKey: .chargedAmount) }
if reason != nil { try container.encode(reason, forKey: .reason) }
}
}
public class GeneralOrderResponse : Codable
{
public var statusCode:Int?
public var message:String?
public var success:Bool?
public var paymentIsPending:Bool?
public var orderTokenId:String?
required public init(){}
}
public class OwnerCards : Codable
{
public var id:Int?
public var ownerId:Int?
public var ownerCardTypeId:Int?
public var phoneVerificationId:Int?
public var initialMaxTickets:Int?
public var currentAvailableTickets:Int?
public var timeStampCreatedUTC:Date?
public var timeStampLastChangedUTC:Date?
public var timeStampBoughtUTC:Date?
public var timeStampOrderedUTC:Date?
public var cardValidFromUTC:Date?
public var cardValidToUTC:Date?
public var hasStoreCredit:Bool?
public var cardPrice:Double?
public var pricePaid:Double?
public var initialStoreCredit:Double?
public var currentStoreCredit:Double?
public var phoneFullVerificationNumber:String?
public var holderId:String?
public var holderName:String?
public var holderEmail:String?
public var cardPriceCurrency:String?
public var pricePaidCurrency:String?
public var deviceId:String?
public var paymentMethodId:String?
public var paymentReference:String?
public var phoneVerificationNumber:String?
public var paymentPhoneNumber:String?
public var paymentId:String?
public var paymentStatus:String?
public var paymentTokenId:String?
public var maxTicketsPerEvent:Int?
public var multiplePaymentsId:String?
public var imageUrl:String?
public var backgroundImageUrl:String?
public var orderReference:String?
public var upgradedFromOwnerCardId:Int?
required public init(){}
}
Swift OwnerCardsUpgradeRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /OrderOwnerCards/upgrade HTTP/1.1
Host: stubbur-app.azurewebsites.net
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"buyerPhone":"String","sourceOwnerCardId":0,"targetOwnerCardTypeId":0,"idempotencyKey":"String","paymentMethodId":"String","borgun3DFinalInfo":{"transactionType":"String","amount":0,"currency":"String","transactionDate":"0001-01-01T00:00:00.0000000","orderId":"String","paymentMethod":{"paymentType":"String","token":"String","virtualNumber":"String","expYear":"String","expMonth":"String","panLastFour":"String"},"threeDSecure":{"dataType":"String","mpiToken":"String"}},"tenders":[{"kind":"String","code":"String","amountMinor":0,"idempotencyKey":"String","holdId":0,"appliedMinor":0}],"holderName":"String","holderEmail":"String","deviceId":"String","returnCards":false}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"sourceOwnerCardId":0,"sourceOwnerCardTypeId":0,"sourceTypeName":"String","newOwnerCardId":0,"targetOwnerCardTypeId":0,"targetTypeName":"String","relinkedTickets":0,"paymentReference":"String","refundPending":false,"cards":[{"id":0,"ownerId":0,"ownerCardTypeId":0,"phoneVerificationId":0,"initialMaxTickets":0,"currentAvailableTickets":0,"timeStampCreatedUTC":"0001-01-01T00:00:00.0000000","timeStampLastChangedUTC":"0001-01-01T00:00:00.0000000","timeStampBoughtUTC":"0001-01-01T00:00:00.0000000","timeStampOrderedUTC":"0001-01-01T00:00:00.0000000","cardValidFromUTC":"0001-01-01T00:00:00.0000000","cardValidToUTC":"0001-01-01T00:00:00.0000000","hasStoreCredit":false,"cardPrice":0,"pricePaid":0,"initialStoreCredit":0,"currentStoreCredit":0,"phoneFullVerificationNumber":"String","holderId":"String","holderName":"String","holderEmail":"String","cardPriceCurrency":"String","pricePaidCurrency":"String","deviceId":"String","paymentMethodId":"String","paymentReference":"String","phoneVerificationNumber":"String","paymentPhoneNumber":"String","paymentId":"String","paymentStatus":"String","paymentTokenId":"String","maxTicketsPerEvent":0,"multiplePaymentsId":"String","imageUrl":"String","backgroundImageUrl":"String","orderReference":"String","upgradedFromOwnerCardId":0}],"orderReference":"String","isSubscription":false,"monthlyPrice":0,"transactionFee":0,"months":0,"paymentTokenId":"String","subscriptionTokenMissing":false,"priceTotal":0,"discountAmount":0,"giftCardAmount":0,"donationAmount":0,"chargedAmount":0,"reason":"String","statusCode":0,"message":"String","success":false,"paymentIsPending":false,"orderTokenId":"String"}