TicketUserServices

<back to all web services

GiftCardPurchaseRequest

Requires Authentication
Requires any of the roles:Admin, TeamAdmin, MobileAppRequired permission:Tickets.Add
The following routes are available for this service:
POST/GiftCard/Purchase
import 'package:servicestack/servicestack.dart';

class GiftCardIssueResult implements IConvertible
{
    bool? success;
    int? giftCardId;
    String? code;
    String? codeLast4;
    String? status;
    DateTime? expiresAt;
    String? paymentId;
    int? statusCode;
    String? message;

    GiftCardIssueResult({this.success,this.giftCardId,this.code,this.codeLast4,this.status,this.expiresAt,this.paymentId,this.statusCode,this.message});
    GiftCardIssueResult.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        success = json['success'];
        giftCardId = json['giftCardId'];
        code = json['code'];
        codeLast4 = json['codeLast4'];
        status = json['status'];
        expiresAt = JsonConverters.fromJson(json['expiresAt'],'DateTime',context!);
        paymentId = json['paymentId'];
        statusCode = json['statusCode'];
        message = json['message'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'success': success,
        'giftCardId': giftCardId,
        'code': code,
        'codeLast4': codeLast4,
        'status': status,
        'expiresAt': JsonConverters.toJson(expiresAt,'DateTime',context!),
        'paymentId': paymentId,
        'statusCode': statusCode,
        'message': message
    };

    getTypeName() => "GiftCardIssueResult";
    TypeContext? context = _ctx;
}

class PaymentMethodCreditCardInfo implements IConvertible
{
    String? paymentType;
    String? token;
    String? pan;
    String? expYear;
    String? expMonth;
    String? cvc;

    PaymentMethodCreditCardInfo({this.paymentType,this.token,this.pan,this.expYear,this.expMonth,this.cvc});
    PaymentMethodCreditCardInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        paymentType = json['paymentType'];
        token = json['token'];
        pan = json['pan'];
        expYear = json['expYear'];
        expMonth = json['expMonth'];
        cvc = json['cvc'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'paymentType': paymentType,
        'token': token,
        'pan': pan,
        'expYear': expYear,
        'expMonth': expMonth,
        'cvc': cvc
    };

    getTypeName() => "PaymentMethodCreditCardInfo";
    TypeContext? context = _ctx;
}

class PaymentRequestCreditCard implements IConvertible
{
    PaymentMethodCreditCardInfo? paymentMethod;
    double? amount;
    String? currency;
    String? orderId;
    DateTime? transActionDate;
    bool? saveCardToToken;

    PaymentRequestCreditCard({this.paymentMethod,this.amount,this.currency,this.orderId,this.transActionDate,this.saveCardToToken});
    PaymentRequestCreditCard.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        paymentMethod = JsonConverters.fromJson(json['paymentMethod'],'PaymentMethodCreditCardInfo',context!);
        amount = JsonConverters.toDouble(json['amount']);
        currency = json['currency'];
        orderId = json['orderId'];
        transActionDate = JsonConverters.fromJson(json['transActionDate'],'DateTime',context!);
        saveCardToToken = json['saveCardToToken'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'paymentMethod': JsonConverters.toJson(paymentMethod,'PaymentMethodCreditCardInfo',context!),
        'amount': amount,
        'currency': currency,
        'orderId': orderId,
        'transActionDate': JsonConverters.toJson(transActionDate,'DateTime',context!),
        'saveCardToToken': saveCardToToken
    };

    getTypeName() => "PaymentRequestCreditCard";
    TypeContext? context = _ctx;
}

class Borgun3DFinalPaymentMethodInfo implements IConvertible
{
    String? paymentType;
    String? token;
    String? virtualNumber;
    String? expYear;
    String? expMonth;
    String? panLastFour;

    Borgun3DFinalPaymentMethodInfo({this.paymentType,this.token,this.virtualNumber,this.expYear,this.expMonth,this.panLastFour});
    Borgun3DFinalPaymentMethodInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        paymentType = json['paymentType'];
        token = json['token'];
        virtualNumber = json['virtualNumber'];
        expYear = json['expYear'];
        expMonth = json['expMonth'];
        panLastFour = json['panLastFour'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'paymentType': paymentType,
        'token': token,
        'virtualNumber': virtualNumber,
        'expYear': expYear,
        'expMonth': expMonth,
        'panLastFour': panLastFour
    };

    getTypeName() => "Borgun3DFinalPaymentMethodInfo";
    TypeContext? context = _ctx;
}

class Borgun3DFinal3DSecureInfo implements IConvertible
{
    String? dataType;
    String? mpiToken;

    Borgun3DFinal3DSecureInfo({this.dataType,this.mpiToken});
    Borgun3DFinal3DSecureInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        dataType = json['dataType'];
        mpiToken = json['mpiToken'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'dataType': dataType,
        'mpiToken': mpiToken
    };

    getTypeName() => "Borgun3DFinal3DSecureInfo";
    TypeContext? context = _ctx;
}

class Borgun3DFinalRequest implements IConvertible
{
    String? transactionType;
    int? amount;
    String? currency;
    DateTime? transactionDate;
    String? orderId;
    Borgun3DFinalPaymentMethodInfo? paymentMethod;
    Borgun3DFinal3DSecureInfo? threeDSecure;

    Borgun3DFinalRequest({this.transactionType,this.amount,this.currency,this.transactionDate,this.orderId,this.paymentMethod,this.threeDSecure});
    Borgun3DFinalRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        transactionType = json['transactionType'];
        amount = json['amount'];
        currency = json['currency'];
        transactionDate = JsonConverters.fromJson(json['transactionDate'],'DateTime',context!);
        orderId = json['orderId'];
        paymentMethod = JsonConverters.fromJson(json['paymentMethod'],'Borgun3DFinalPaymentMethodInfo',context!);
        threeDSecure = JsonConverters.fromJson(json['threeDSecure'],'Borgun3DFinal3DSecureInfo',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'transactionType': transactionType,
        'amount': amount,
        'currency': currency,
        'transactionDate': JsonConverters.toJson(transactionDate,'DateTime',context!),
        'orderId': orderId,
        'paymentMethod': JsonConverters.toJson(paymentMethod,'Borgun3DFinalPaymentMethodInfo',context!),
        'threeDSecure': JsonConverters.toJson(threeDSecure,'Borgun3DFinal3DSecureInfo',context!)
    };

    getTypeName() => "Borgun3DFinalRequest";
    TypeContext? context = _ctx;
}

class BorgunApplePayThreeDSecureInfo implements IConvertible
{
    String? dataType;
    String? securityLevelInd;
    String? cavv;
    String? ucaf;

    BorgunApplePayThreeDSecureInfo({this.dataType,this.securityLevelInd,this.cavv,this.ucaf});
    BorgunApplePayThreeDSecureInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        dataType = json['dataType'];
        securityLevelInd = json['securityLevelInd'];
        cavv = json['cavv'];
        ucaf = json['ucaf'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'dataType': dataType,
        'securityLevelInd': securityLevelInd,
        'cavv': cavv,
        'ucaf': ucaf
    };

    getTypeName() => "BorgunApplePayThreeDSecureInfo";
    TypeContext? context = _ctx;
}

class BorgunApplePayFinalInfo implements IConvertible
{
    String? orderId;
    BorgunApplePayThreeDSecureInfo? threeDSecure;

    BorgunApplePayFinalInfo({this.orderId,this.threeDSecure});
    BorgunApplePayFinalInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        orderId = json['orderId'];
        threeDSecure = JsonConverters.fromJson(json['threeDSecure'],'BorgunApplePayThreeDSecureInfo',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'orderId': orderId,
        'threeDSecure': JsonConverters.toJson(threeDSecure,'BorgunApplePayThreeDSecureInfo',context!)
    };

    getTypeName() => "BorgunApplePayFinalInfo";
    TypeContext? context = _ctx;
}

class GiftCardPurchaseRequest implements IConvertible
{
    int? giftCardTypeId;
    int? amountMinor;
    String? purchasePaymentReference;
    int? purchaseOwnerId;
    String? buyerName;
    String? buyerPhone;
    String? buyerEmail;
    String? recipientName;
    String? idempotencyKey;
    String? paymentMethodId;
    String? paymentId;
    PaymentRequestCreditCard? cardInfo;
    Borgun3DFinalRequest? borgun3DFinalInfo;
    BorgunApplePayFinalInfo? applePayInfo;

    GiftCardPurchaseRequest({this.giftCardTypeId,this.amountMinor,this.purchasePaymentReference,this.purchaseOwnerId,this.buyerName,this.buyerPhone,this.buyerEmail,this.recipientName,this.idempotencyKey,this.paymentMethodId,this.paymentId,this.cardInfo,this.borgun3DFinalInfo,this.applePayInfo});
    GiftCardPurchaseRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        giftCardTypeId = json['giftCardTypeId'];
        amountMinor = json['amountMinor'];
        purchasePaymentReference = json['purchasePaymentReference'];
        purchaseOwnerId = json['purchaseOwnerId'];
        buyerName = json['buyerName'];
        buyerPhone = json['buyerPhone'];
        buyerEmail = json['buyerEmail'];
        recipientName = json['recipientName'];
        idempotencyKey = json['idempotencyKey'];
        paymentMethodId = json['paymentMethodId'];
        paymentId = json['paymentId'];
        cardInfo = JsonConverters.fromJson(json['cardInfo'],'PaymentRequestCreditCard',context!);
        borgun3DFinalInfo = JsonConverters.fromJson(json['borgun3DFinalInfo'],'Borgun3DFinalRequest',context!);
        applePayInfo = JsonConverters.fromJson(json['applePayInfo'],'BorgunApplePayFinalInfo',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'giftCardTypeId': giftCardTypeId,
        'amountMinor': amountMinor,
        'purchasePaymentReference': purchasePaymentReference,
        'purchaseOwnerId': purchaseOwnerId,
        'buyerName': buyerName,
        'buyerPhone': buyerPhone,
        'buyerEmail': buyerEmail,
        'recipientName': recipientName,
        'idempotencyKey': idempotencyKey,
        'paymentMethodId': paymentMethodId,
        'paymentId': paymentId,
        'cardInfo': JsonConverters.toJson(cardInfo,'PaymentRequestCreditCard',context!),
        'borgun3DFinalInfo': JsonConverters.toJson(borgun3DFinalInfo,'Borgun3DFinalRequest',context!),
        'applePayInfo': JsonConverters.toJson(applePayInfo,'BorgunApplePayFinalInfo',context!)
    };

    getTypeName() => "GiftCardPurchaseRequest";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'stubbur_app.azurewebsites.net', types: <String, TypeInfo> {
    'GiftCardIssueResult': TypeInfo(TypeOf.Class, create:() => GiftCardIssueResult()),
    'PaymentMethodCreditCardInfo': TypeInfo(TypeOf.Class, create:() => PaymentMethodCreditCardInfo()),
    'PaymentRequestCreditCard': TypeInfo(TypeOf.Class, create:() => PaymentRequestCreditCard()),
    'Borgun3DFinalPaymentMethodInfo': TypeInfo(TypeOf.Class, create:() => Borgun3DFinalPaymentMethodInfo()),
    'Borgun3DFinal3DSecureInfo': TypeInfo(TypeOf.Class, create:() => Borgun3DFinal3DSecureInfo()),
    'Borgun3DFinalRequest': TypeInfo(TypeOf.Class, create:() => Borgun3DFinalRequest()),
    'BorgunApplePayThreeDSecureInfo': TypeInfo(TypeOf.Class, create:() => BorgunApplePayThreeDSecureInfo()),
    'BorgunApplePayFinalInfo': TypeInfo(TypeOf.Class, create:() => BorgunApplePayFinalInfo()),
    'GiftCardPurchaseRequest': TypeInfo(TypeOf.Class, create:() => GiftCardPurchaseRequest()),
});

Dart GiftCardPurchaseRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

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: application/xml
Content-Type: application/xml
Content-Length: length

<GiftCardPurchaseRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TicketUserServices.ServiceModel">
  <AmountMinor>0</AmountMinor>
  <ApplePayInfo xmlns:d2p1="http://schemas.datacontract.org/2004/07/BorgunRPGData">
    <d2p1:OrderId>String</d2p1:OrderId>
    <d2p1:ThreeDSecure>
      <d2p1:CAVV>String</d2p1:CAVV>
      <d2p1:DataType>String</d2p1:DataType>
      <d2p1:SecurityLevelInd>String</d2p1:SecurityLevelInd>
      <d2p1:UCAF>String</d2p1:UCAF>
    </d2p1:ThreeDSecure>
  </ApplePayInfo>
  <Borgun3DFinalInfo xmlns:d2p1="http://schemas.datacontract.org/2004/07/BorgunRPGData">
    <d2p1:Amount>0</d2p1:Amount>
    <d2p1:Currency>String</d2p1:Currency>
    <d2p1:OrderId>String</d2p1:OrderId>
    <d2p1:PaymentMethod>
      <d2p1:ExpMonth>String</d2p1:ExpMonth>
      <d2p1:ExpYear>String</d2p1:ExpYear>
      <d2p1:PanLastFour>String</d2p1:PanLastFour>
      <d2p1:PaymentType>String</d2p1:PaymentType>
      <d2p1:Token>String</d2p1:Token>
      <d2p1:VirtualNumber>String</d2p1:VirtualNumber>
    </d2p1:PaymentMethod>
    <d2p1:ThreeDSecure>
      <d2p1:DataType>String</d2p1:DataType>
      <d2p1:MpiToken>String</d2p1:MpiToken>
    </d2p1:ThreeDSecure>
    <d2p1:TransactionDate>0001-01-01T00:00:00</d2p1:TransactionDate>
    <d2p1:TransactionType>String</d2p1:TransactionType>
  </Borgun3DFinalInfo>
  <BuyerEmail>String</BuyerEmail>
  <BuyerName>String</BuyerName>
  <BuyerPhone>String</BuyerPhone>
  <CardInfo>
    <Amount>0</Amount>
    <Currency>String</Currency>
    <OrderId>String</OrderId>
    <PaymentMethod>
      <CVC>String</CVC>
      <ExpMonth>String</ExpMonth>
      <ExpYear>String</ExpYear>
      <PAN>String</PAN>
      <PaymentType>String</PaymentType>
      <Token>String</Token>
    </PaymentMethod>
    <SaveCardToToken>false</SaveCardToToken>
    <TransActionDate>0001-01-01T00:00:00</TransActionDate>
  </CardInfo>
  <GiftCardTypeId>0</GiftCardTypeId>
  <IdempotencyKey>String</IdempotencyKey>
  <PaymentId>String</PaymentId>
  <PaymentMethodId>String</PaymentMethodId>
  <PurchaseOwnerId>0</PurchaseOwnerId>
  <PurchasePaymentReference>String</PurchasePaymentReference>
  <RecipientName>String</RecipientName>
</GiftCardPurchaseRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<GiftCardIssueResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TicketUserServices.ServiceModel">
  <Code>String</Code>
  <CodeLast4>String</CodeLast4>
  <ExpiresAt>0001-01-01T00:00:00</ExpiresAt>
  <GiftCardId>0</GiftCardId>
  <Message>String</Message>
  <PaymentId>String</PaymentId>
  <Status>String</Status>
  <StatusCode>0</StatusCode>
  <Success>false</Success>
</GiftCardIssueResult>