ClubReady Api

<back to all web services

WalletTokenCreateEndpoint

The following routes are available for this service:
GET/sales/wallet/wallettokencreateCreates a Wallet Token for a user
import Foundation
import ServiceStack

public class WalletTokenCreateEndpoint : WalletTokenCreateRequestDto, IRestrictedApiRequest
{
    /**
    * Api Key - grants access to resources
    */
    // @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")
    public var apiKey:String

    /**
    * ID # of the owner to create the URL for
    */
    // @ApiMember(DataType="integer", Description="ID # of the owner to create the URL for", IsRequired=true, Name="OwnerId", ParameterType="query")
    public var ownerId:Int

    /**
    * Type of owner to create the URL for
    */
    // @ApiMember(Description="Type of owner to create the URL for", IsRequired=true, Name="OwnerType", ParameterType="query")
    public var ownerType:OwnerType

    /**
    * Person creating the profile.  Can be same as OwnerId.
    */
    // @ApiMember(Description="Person creating the profile.  Can be same as OwnerId.", IsRequired=true, Name="CreatorId", ParameterType="query")
    public var creatorId:Int

    /**
    * Page to display when calling the Payment Profile iFrame
    */
    // @ApiMember(Description="Page to display when calling the Payment Profile iFrame", IsRequired=true, Name="Page", ParameterType="query")
    public var page:WalletPage

    /**
    * CSS Theme
    */
    // @ApiMember(Description="CSS Theme", ParameterType="query")
    public var theme:String

    public var restrictedId:Int?
    public var restrictedResourceType:RestrictedResourceType
    /**
    * Allows for a payment profile to be deleted
    */
    // @ApiMember(Description="Allows for a payment profile to be deleted", Name="AllowDeleteProfile", ParameterType="query")
    public var allowDeleteProfile:Bool?

    /**
    * Allows for a payment profile to be disabled
    */
    // @ApiMember(Description="Allows for a payment profile to be disabled", Name="AllowDisableProfile", ParameterType="query")
    public var allowDisableProfile:Bool?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case apiKey
        case ownerId
        case ownerType
        case creatorId
        case page
        case theme
        case restrictedId
        case restrictedResourceType
        case allowDeleteProfile
        case allowDisableProfile
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey)
        ownerId = try container.decodeIfPresent(Int.self, forKey: .ownerId)
        ownerType = try container.decodeIfPresent(OwnerType.self, forKey: .ownerType)
        creatorId = try container.decodeIfPresent(Int.self, forKey: .creatorId)
        page = try container.decodeIfPresent(WalletPage.self, forKey: .page)
        theme = try container.decodeIfPresent(String.self, forKey: .theme)
        restrictedId = try container.decodeIfPresent(Int.self, forKey: .restrictedId)
        restrictedResourceType = try container.decodeIfPresent(RestrictedResourceType.self, forKey: .restrictedResourceType)
        allowDeleteProfile = try container.decodeIfPresent(Bool.self, forKey: .allowDeleteProfile)
        allowDisableProfile = try container.decodeIfPresent(Bool.self, forKey: .allowDisableProfile)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if apiKey != nil { try container.encode(apiKey, forKey: .apiKey) }
        if ownerId != nil { try container.encode(ownerId, forKey: .ownerId) }
        if ownerType != nil { try container.encode(ownerType, forKey: .ownerType) }
        if creatorId != nil { try container.encode(creatorId, forKey: .creatorId) }
        if page != nil { try container.encode(page, forKey: .page) }
        if theme != nil { try container.encode(theme, forKey: .theme) }
        if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) }
        if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) }
        if allowDeleteProfile != nil { try container.encode(allowDeleteProfile, forKey: .allowDeleteProfile) }
        if allowDisableProfile != nil { try container.encode(allowDisableProfile, forKey: .allowDisableProfile) }
    }
}

public class WalletTokenCreateRequestDto : ApiDtoBase
{
    public var ownerId:Int
    public var ownerType:OwnerType
    public var creatorId:Int
    public var page:WalletPage
    public var theme:String
    public var allowDeleteProfile:Bool?
    public var allowDisableProfile:Bool?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case ownerId
        case ownerType
        case creatorId
        case page
        case theme
        case allowDeleteProfile
        case allowDisableProfile
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        ownerId = try container.decodeIfPresent(Int.self, forKey: .ownerId)
        ownerType = try container.decodeIfPresent(OwnerType.self, forKey: .ownerType)
        creatorId = try container.decodeIfPresent(Int.self, forKey: .creatorId)
        page = try container.decodeIfPresent(WalletPage.self, forKey: .page)
        theme = try container.decodeIfPresent(String.self, forKey: .theme)
        allowDeleteProfile = try container.decodeIfPresent(Bool.self, forKey: .allowDeleteProfile)
        allowDisableProfile = try container.decodeIfPresent(Bool.self, forKey: .allowDisableProfile)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if ownerId != nil { try container.encode(ownerId, forKey: .ownerId) }
        if ownerType != nil { try container.encode(ownerType, forKey: .ownerType) }
        if creatorId != nil { try container.encode(creatorId, forKey: .creatorId) }
        if page != nil { try container.encode(page, forKey: .page) }
        if theme != nil { try container.encode(theme, forKey: .theme) }
        if allowDeleteProfile != nil { try container.encode(allowDeleteProfile, forKey: .allowDeleteProfile) }
        if allowDisableProfile != nil { try container.encode(allowDisableProfile, forKey: .allowDisableProfile) }
    }
}

public class ApiDtoBase : Codable
{
    public var apiKey:String
    public var storeId:Int?
    public var chainId:Int?

    required public init(){}
}

// @DataContract
public enum OwnerType : Int, Codable
{
    case Unknown = 0
    case User = 1
    case ConvUser = 2
    case TempCart = 3
    case TempAgmt = 4
    case Store = 5
    case Chain = 6
    case Division = 7
    case District = 8
    case AdminType = 9
    case TempStUser = 10
    case VaultApi = 11
    case Company = 12
    case BackOfficeStore = 13
    case OrgUser = 14
    case CartItem = 15
    case Testing = 99
    case System = 100
    case Error = -1
}

public enum WalletPage : String, Codable
{
    case Uninitialized
    case Manage
    case Add
    case AddCard
    case AddBank
    case AddMini
    case AddCardMini
    case AddBankMini
}

public enum RestrictedResourceType : String, Codable
{
    case Store
    case Chain
    case User
    case Undefined
}

public class WalletTokenCreateResponse : WalletTokenCreateResponseDto
{
    public var success:Bool
    public var message:String
    public var walletToken:String
    public var walletOrigin:String
    public var walletUrl:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case success
        case message
        case walletToken
        case walletOrigin
        case walletUrl
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        success = try container.decodeIfPresent(Bool.self, forKey: .success)
        message = try container.decodeIfPresent(String.self, forKey: .message)
        walletToken = try container.decodeIfPresent(String.self, forKey: .walletToken)
        walletOrigin = try container.decodeIfPresent(String.self, forKey: .walletOrigin)
        walletUrl = try container.decodeIfPresent(String.self, forKey: .walletUrl)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if success != nil { try container.encode(success, forKey: .success) }
        if message != nil { try container.encode(message, forKey: .message) }
        if walletToken != nil { try container.encode(walletToken, forKey: .walletToken) }
        if walletOrigin != nil { try container.encode(walletOrigin, forKey: .walletOrigin) }
        if walletUrl != nil { try container.encode(walletUrl, forKey: .walletUrl) }
    }
}

public class WalletTokenCreateResponseDto : ApiResponseBase
{
    public var walletToken:String
    public var walletOrigin:String
    public var walletUrl:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case walletToken
        case walletOrigin
        case walletUrl
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        walletToken = try container.decodeIfPresent(String.self, forKey: .walletToken)
        walletOrigin = try container.decodeIfPresent(String.self, forKey: .walletOrigin)
        walletUrl = try container.decodeIfPresent(String.self, forKey: .walletUrl)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if walletToken != nil { try container.encode(walletToken, forKey: .walletToken) }
        if walletOrigin != nil { try container.encode(walletOrigin, forKey: .walletOrigin) }
        if walletUrl != nil { try container.encode(walletUrl, forKey: .walletUrl) }
    }
}

public class ApiResponseBase : Codable
{
    public var success:Bool
    public var message:String

    required public init(){}
}


Swift WalletTokenCreateEndpoint 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.

GET /sales/wallet/wallettokencreate HTTP/1.1 
Host: clubready.com 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Success":false,"Message":"String","WalletToken":"String","WalletOrigin":"String","WalletUrl":"String"}