| Requires any of the roles: | Admin, TeamAdmin, MobileApp | Required permission: | Tickets.Add |
| POST | /GiftCard/Purchase |
|---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GiftCardIssueResult:
success: Optional[bool] = None
gift_card_id: Optional[int] = None
code: Optional[str] = None
code_last4: Optional[str] = None
status: Optional[str] = None
expires_at: Optional[datetime.datetime] = None
payment_id: Optional[str] = None
status_code: Optional[int] = None
message: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PaymentMethodCreditCardInfo:
payment_type: Optional[str] = None
token: Optional[str] = None
pan: Optional[str] = None
exp_year: Optional[str] = None
exp_month: Optional[str] = None
cvc: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PaymentRequestCreditCard:
payment_method: Optional[PaymentMethodCreditCardInfo] = None
amount: Optional[Decimal] = None
currency: Optional[str] = None
order_id: Optional[str] = None
trans_action_date: Optional[datetime.datetime] = None
save_card_to_token: Optional[bool] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Borgun3DFinalPaymentMethodInfo:
payment_type: Optional[str] = None
token: Optional[str] = None
virtual_number: Optional[str] = None
exp_year: Optional[str] = None
exp_month: Optional[str] = None
pan_last_four: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Borgun3DFinal3DSecureInfo:
data_type: Optional[str] = None
mpi_token: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Borgun3DFinalRequest:
transaction_type: Optional[str] = None
amount: Optional[int] = None
currency: Optional[str] = None
transaction_date: Optional[datetime.datetime] = None
order_id: Optional[str] = None
payment_method: Optional[Borgun3DFinalPaymentMethodInfo] = None
three_d_secure: Optional[Borgun3DFinal3DSecureInfo] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BorgunApplePayThreeDSecureInfo:
data_type: Optional[str] = None
security_level_ind: Optional[str] = None
cavv: Optional[str] = None
ucaf: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BorgunApplePayFinalInfo:
order_id: Optional[str] = None
three_d_secure: Optional[BorgunApplePayThreeDSecureInfo] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GiftCardPurchaseRequest:
gift_card_type_id: Optional[int] = None
amount_minor: Optional[int] = None
purchase_payment_reference: Optional[str] = None
purchase_owner_id: Optional[int] = None
buyer_name: Optional[str] = None
buyer_phone: Optional[str] = None
buyer_email: Optional[str] = None
recipient_name: Optional[str] = None
idempotency_key: Optional[str] = None
payment_method_id: Optional[str] = None
payment_id: Optional[str] = None
card_info: Optional[PaymentRequestCreditCard] = None
borgun3_d_final_info: Optional[Borgun3DFinalRequest] = None
apple_pay_info: Optional[BorgunApplePayFinalInfo] = None
Python GiftCardPurchaseRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /GiftCard/Purchase HTTP/1.1
Host: stubbur-app.azurewebsites.net
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
giftCardTypeId: 0,
amountMinor: 0,
purchasePaymentReference: String,
purchaseOwnerId: 0,
buyerName: String,
buyerPhone: String,
buyerEmail: String,
recipientName: String,
idempotencyKey: String,
paymentMethodId: String,
paymentId: String,
cardInfo:
{
paymentMethod:
{
paymentType: String,
token: String,
pan: String,
expYear: String,
expMonth: String,
cvc: String
},
amount: 0,
currency: String,
orderId: String,
transActionDate: 0001-01-01,
saveCardToToken: False
},
borgun3DFinalInfo:
{
transactionType: String,
amount: 0,
currency: String,
transactionDate: 0001-01-01,
orderId: String,
paymentMethod:
{
paymentType: String,
token: String,
virtualNumber: String,
expYear: String,
expMonth: String,
panLastFour: String
},
threeDSecure:
{
dataType: String,
mpiToken: String
}
},
applePayInfo:
{
orderId: String,
threeDSecure:
{
dataType: String,
securityLevelInd: String,
cavv: String,
ucaf: String
}
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
success: False,
giftCardId: 0,
code: String,
codeLast4: String,
status: String,
expiresAt: 0001-01-01,
paymentId: String,
statusCode: 0,
message: String
}