ClubReady Api

<back to all web services

AddPaymentAccount

The following routes are available for this service:
POST/sales/member/{MemberId}/payment/profileAdd Payment Profile for a Member
import 'package:servicestack/servicestack.dart';

class ApiDtoBase implements IConvertible
{
    String? ApiKey;
    int? StoreId;
    int? ChainId;

    ApiDtoBase({this.ApiKey,this.StoreId,this.ChainId});
    ApiDtoBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ApiKey = json['ApiKey'];
        StoreId = json['StoreId'];
        ChainId = json['ChainId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ApiKey': ApiKey,
        'StoreId': StoreId,
        'ChainId': ChainId
    };

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

// @DataContract
enum AcctType
{
    Uninitialized,
    Visa,
    MC,
    Disc,
    Amex,
    Diners,
    JCB,
    enRoute,
    PayPal,
    BillMe,
    PC,
    PS,
    BC,
    BS,
    Becs,
    Bacs,
    Maestro,
    Solo,
    VisaElectron,
    CIBC,
    RoyalBankCa,
    TDCaTrust,
    Scotia,
    BMO,
    HSBCCa,
    UnionPay,
    InterPayment,
    Laser,
    UnknownCredit,
    TransArmor,
    Factor4,
    XPass,
    ConnectedAccount,
    UnknownBank,
    Error,
}

class AddPaymentProfileRequest extends ApiDtoBase implements IConvertible
{
    int? UserId;
    String? AcctToken;
    String? Last4;
    int? ExpMonth;
    int? ExpYear;
    AcctType? AcctType;
    int? BnkRoute;
    String? FirstName;
    String? MiddleName;
    String? LastName;
    String? Address1;
    String? Address2;
    String? City;
    String? State;
    String? PostalCode;
    String? CountryCode;
    String? Urbanization;
    bool? DoNotUpdatePaymentTypePreference;
    bool? IsTemp;

    AddPaymentProfileRequest({this.UserId,this.AcctToken,this.Last4,this.ExpMonth,this.ExpYear,this.AcctType,this.BnkRoute,this.FirstName,this.MiddleName,this.LastName,this.Address1,this.Address2,this.City,this.State,this.PostalCode,this.CountryCode,this.Urbanization,this.DoNotUpdatePaymentTypePreference,this.IsTemp});
    AddPaymentProfileRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        UserId = json['UserId'];
        AcctToken = json['AcctToken'];
        Last4 = json['Last4'];
        ExpMonth = json['ExpMonth'];
        ExpYear = json['ExpYear'];
        AcctType = JsonConverters.fromJson(json['AcctType'],'AcctType',context!);
        BnkRoute = json['BnkRoute'];
        FirstName = json['FirstName'];
        MiddleName = json['MiddleName'];
        LastName = json['LastName'];
        Address1 = json['Address1'];
        Address2 = json['Address2'];
        City = json['City'];
        State = json['State'];
        PostalCode = json['PostalCode'];
        CountryCode = json['CountryCode'];
        Urbanization = json['Urbanization'];
        DoNotUpdatePaymentTypePreference = json['DoNotUpdatePaymentTypePreference'];
        IsTemp = json['IsTemp'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'UserId': UserId,
        'AcctToken': AcctToken,
        'Last4': Last4,
        'ExpMonth': ExpMonth,
        'ExpYear': ExpYear,
        'AcctType': JsonConverters.toJson(AcctType,'AcctType',context!),
        'BnkRoute': BnkRoute,
        'FirstName': FirstName,
        'MiddleName': MiddleName,
        'LastName': LastName,
        'Address1': Address1,
        'Address2': Address2,
        'City': City,
        'State': State,
        'PostalCode': PostalCode,
        'CountryCode': CountryCode,
        'Urbanization': Urbanization,
        'DoNotUpdatePaymentTypePreference': DoNotUpdatePaymentTypePreference,
        'IsTemp': IsTemp
    });

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

enum RestrictedResourceType
{
    Store,
    Chain,
    User,
    Undefined,
}

// @ApiResponse(Description="", ResponseType=typeof(AddPaymentProfileResponse), StatusCode=200)
class AddPaymentAccount extends AddPaymentProfileRequest implements IRestrictedApiRequest, IConvertible
{
    /**
    * Api Authentication Key
    */
    // @ApiMember(Description="Api Authentication Key", IsRequired=true, ParameterType="query")
    String? ApiKey;

    /**
    * Id of the store for the user
    */
    // @ApiMember(Description="Id of the store for the user", IsRequired=true, ParameterType="query")
    int? StoreId;

    /**
    * Member Id of the user to update their Payment Profile
    */
    // @ApiMember(Description="Member Id of the user to update their Payment Profile", IsRequired=true, ParameterType="path")
    int? MemberId;

    /**
    * The AcctToken provided by creating a Payment Profile with the Vault Api
    */
    // @ApiMember(Description="The AcctToken provided by creating a Payment Profile with the Vault Api", IsRequired=true)
    String? AcctToken;

    /**
    * Last 4 digits of the Payment Profile
    */
    // @ApiMember(Description="Last 4 digits of the Payment Profile")
    String? Last4;

    /**
    * 2 digit expiration month  **Required for Credit Card**
    */
    // @ApiMember(Description="2 digit expiration month  \n**Required for Credit Card**")
    int? ExpMonth;

    /**
    * 2 digit expiration year  **Required for Credit Card**
    */
    // @ApiMember(Description="2 digit expiration year  \n**Required for Credit Card**")
    int? ExpYear;

    /**
    * The Account Type of the Payment Profile  **Required when adding Gift Card**<details><summary>Common Values</summary><table>    <thead>        <tr><th>Text</th><th>Numerical</th><th>Account Type</th></tr>    </thead>    <tbody>        <tr><td>VISA</td><td>1</td><td>Visa</td></tr>        <tr><td>MC</td><td>2</td><td>MasterCard</td></tr>        <tr><td>Disc</td><td>3</td><td>Discover</td></tr>        <tr><td>Amex</td><td>4</td><td>American Express</td></tr>        <tr><td>PC</td><td>11</td><td>Personal Checking</td></tr>        <tr><td>PS</td><td>12</td><td>Personal Savings</td></tr>        <tr><td>BC</td><td>13</td><td>Business Checking</td></tr>        <tr><td>Factor4</td><td>42</td><td>Factor4 Gift Card</td></tr>    </tbody></table><p>You may use the Text or the Numerical value.</p></details>
    */
    // @ApiMember(Description="\r\nThe Account Type of the Payment Profile  \r\n**Required when adding Gift Card**\r\n\r\n<details>\r\n<summary>Common Values</summary>\r\n<table>\r\n    <thead>\r\n        <tr><th>Text</th><th>Numerical</th><th>Account Type</th></tr>\r\n    </thead>\r\n    <tbody>\r\n        <tr><td>VISA</td><td>1</td><td>Visa</td></tr>\r\n        <tr><td>MC</td><td>2</td><td>MasterCard</td></tr>\r\n        <tr><td>Disc</td><td>3</td><td>Discover</td></tr>\r\n        <tr><td>Amex</td><td>4</td><td>American Express</td></tr>\r\n        <tr><td>PC</td><td>11</td><td>Personal Checking</td></tr>\r\n        <tr><td>PS</td><td>12</td><td>Personal Savings</td></tr>\r\n        <tr><td>BC</td><td>13</td><td>Business Checking</td></tr>\r\n        <tr><td>Factor4</td><td>42</td><td>Factor4 Gift Card</td></tr>\r\n    </tbody>\r\n</table>\r\n<p>You may use the Text or the Numerical value.</p>\r\n</details>")
    AcctType? AcctType;

    /**
    * Bank Routing Number  **Required for Bank Accounts**
    */
    // @ApiMember(Description="Bank Routing Number  \n**Required for Bank Accounts**")
    int? BnkRoute;

    /**
    * Set to `true` to not set the user's Payment Type Preference when adding an on-file profile
    */
    // @ApiMember(Description="Set to `true` to not set the user's Payment Type Preference when adding an on-file profile")
    bool? DoNotUpdatePaymentTypePreference;

    /**
    * Whether the Payment Profile is Temporary (One time transactions and Gift Cards are IsTemp = `true`)
    */
    // @ApiMember(Description="Whether the Payment Profile is Temporary (One time transactions and Gift Cards are IsTemp = `true`)")
    bool? IsTemp;

    int? RestrictedId;
    RestrictedResourceType? RestrictedResourceType;

    AddPaymentAccount({this.ApiKey,this.StoreId,this.MemberId,this.AcctToken,this.Last4,this.ExpMonth,this.ExpYear,this.AcctType,this.BnkRoute,this.DoNotUpdatePaymentTypePreference,this.IsTemp,this.RestrictedId,this.RestrictedResourceType});
    AddPaymentAccount.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        ApiKey = json['ApiKey'];
        StoreId = json['StoreId'];
        MemberId = json['MemberId'];
        AcctToken = json['AcctToken'];
        Last4 = json['Last4'];
        ExpMonth = json['ExpMonth'];
        ExpYear = json['ExpYear'];
        AcctType = JsonConverters.fromJson(json['AcctType'],'AcctType',context!);
        BnkRoute = json['BnkRoute'];
        DoNotUpdatePaymentTypePreference = json['DoNotUpdatePaymentTypePreference'];
        IsTemp = json['IsTemp'];
        RestrictedId = json['RestrictedId'];
        RestrictedResourceType = JsonConverters.fromJson(json['RestrictedResourceType'],'RestrictedResourceType',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'ApiKey': ApiKey,
        'StoreId': StoreId,
        'MemberId': MemberId,
        'AcctToken': AcctToken,
        'Last4': Last4,
        'ExpMonth': ExpMonth,
        'ExpYear': ExpYear,
        'AcctType': JsonConverters.toJson(AcctType,'AcctType',context!),
        'BnkRoute': BnkRoute,
        'DoNotUpdatePaymentTypePreference': DoNotUpdatePaymentTypePreference,
        'IsTemp': IsTemp,
        'RestrictedId': RestrictedId,
        'RestrictedResourceType': JsonConverters.toJson(RestrictedResourceType,'RestrictedResourceType',context!)
    });

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

class AddPaymentProfileResponse implements IConvertible
{
    String? Success;
    String? Message;

    AddPaymentProfileResponse({this.Success,this.Message});
    AddPaymentProfileResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'Success': Success,
        'Message': Message
    };

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

TypeContext _ctx = TypeContext(library: 'clubready.com', types: <String, TypeInfo> {
    'ApiDtoBase': TypeInfo(TypeOf.Class, create:() => ApiDtoBase()),
    'AcctType': TypeInfo(TypeOf.Enum, enumValues:AcctType.values),
    'AddPaymentProfileRequest': TypeInfo(TypeOf.Class, create:() => AddPaymentProfileRequest()),
    'RestrictedResourceType': TypeInfo(TypeOf.Enum, enumValues:RestrictedResourceType.values),
    'AddPaymentAccount': TypeInfo(TypeOf.Class, create:() => AddPaymentAccount()),
    'AddPaymentProfileResponse': TypeInfo(TypeOf.Class, create:() => AddPaymentProfileResponse()),
});

Dart AddPaymentAccount DTOs

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

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /sales/member/{MemberId}/payment/profile HTTP/1.1 
Host: clubready.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ApiKey: String,
	StoreId: 0,
	MemberId: 0,
	AcctToken: String,
	AuthToken: String,
	Last4: String,
	ExpMonth: 0,
	ExpYear: 0,
	AcctType: Uninitialized,
	CardType: 0,
	BnkRoute: 0,
	DoNotUpdatePaymentTypePreference: False,
	IsTemp: False,
	RestrictedId: 0,
	RestrictedResourceType: Chain,
	UserId: 0,
	FirstName: String,
	MiddleName: String,
	LastName: String,
	Address1: String,
	Address2: String,
	City: String,
	State: String,
	PostalCode: String,
	CountryCode: String,
	Urbanization: String,
	ChainId: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Success: String,
	Message: String
}