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 .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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/json
Content-Type: application/json
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-01T00:00:00.0000000","saveCardToToken":false},"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"}},"applePayInfo":{"orderId":"String","threeDSecure":{"dataType":"String","securityLevelInd":"String","cavv":"String","ucaf":"String"}}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"success":false,"giftCardId":0,"code":"String","codeLast4":"String","status":"String","expiresAt":"0001-01-01T00:00:00.0000000","paymentId":"String","statusCode":0,"message":"String"}