GET | /sales/wallet/wallettokencreate | Creates a Wallet Token for a user |
---|
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 ApiDtoBase:
api_key: Optional[str] = None
store_id: Optional[int] = None
chain_id: Optional[int] = None
class OwnerType(IntEnum):
UNKNOWN = 0
USER = 1
CONV_USER = 2
TEMP_CART = 3
TEMP_AGMT = 4
STORE = 5
CHAIN = 6
DIVISION = 7
DISTRICT = 8
ADMIN_TYPE = 9
TEMP_ST_USER = 10
VAULT_API = 11
COMPANY = 12
BACK_OFFICE_STORE = 13
ORG_USER = 14
CART_ITEM = 15
TESTING = 99
SYSTEM = 100
ERROR = -1
class WalletPage(str, Enum):
UNINITIALIZED = 'Uninitialized'
MANAGE = 'Manage'
ADD = 'Add'
ADD_CARD = 'AddCard'
ADD_BANK = 'AddBank'
ADD_MINI = 'AddMini'
ADD_CARD_MINI = 'AddCardMini'
ADD_BANK_MINI = 'AddBankMini'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class WalletTokenCreateRequestDto(ApiDtoBase):
owner_id: int = 0
owner_type: Optional[OwnerType] = None
creator_id: int = 0
page: Optional[WalletPage] = None
theme: Optional[str] = None
allow_delete_profile: Optional[bool] = None
allow_disable_profile: Optional[bool] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ApiResponseBase:
success: bool = False
message: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class WalletTokenCreateResponseDto(ApiResponseBase):
wallet_token: Optional[str] = None
wallet_origin: Optional[str] = None
wallet_url: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class WalletTokenCreateResponse(WalletTokenCreateResponseDto):
success: bool = False
message: Optional[str] = None
wallet_token: Optional[str] = None
wallet_origin: Optional[str] = None
wallet_url: Optional[str] = None
class RestrictedResourceType(str, Enum):
STORE = 'Store'
CHAIN = 'Chain'
USER = 'User'
UNDEFINED = 'Undefined'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class WalletTokenCreateEndpoint(WalletTokenCreateRequestDto, IRestrictedApiRequest):
# @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")
api_key: Optional[str] = None
"""
Api Key - grants access to resources
"""
# @ApiMember(DataType="integer", Description="ID # of the owner to create the URL for", IsRequired=true, Name="OwnerId", ParameterType="query")
owner_id: int = 0
"""
ID # of the owner to create the URL for
"""
# @ApiMember(Description="Type of owner to create the URL for", IsRequired=true, Name="OwnerType", ParameterType="query")
owner_type: Optional[OwnerType] = None
"""
Type of owner to create the URL for
"""
# @ApiMember(Description="Person creating the profile. Can be same as OwnerId.", IsRequired=true, Name="CreatorId", ParameterType="query")
creator_id: int = 0
"""
Person creating the profile. Can be same as OwnerId.
"""
# @ApiMember(Description="Page to display when calling the Payment Profile iFrame", IsRequired=true, Name="Page", ParameterType="query")
page: Optional[WalletPage] = None
"""
Page to display when calling the Payment Profile iFrame
"""
# @ApiMember(Description="CSS Theme", ParameterType="query")
theme: Optional[str] = None
"""
CSS Theme
"""
restricted_id: Optional[int] = None
restricted_resource_type: Optional[RestrictedResourceType] = None
# @ApiMember(Description="Allows for a payment profile to be deleted", Name="AllowDeleteProfile", ParameterType="query")
allow_delete_profile: Optional[bool] = None
"""
Allows for a payment profile to be deleted
"""
# @ApiMember(Description="Allows for a payment profile to be disabled", Name="AllowDisableProfile", ParameterType="query")
allow_disable_profile: Optional[bool] = None
"""
Allows for a payment profile to be disabled
"""
Python WalletTokenCreateEndpoint DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
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/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <WalletTokenCreateResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Sales.Wallet"> <Message xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Message> <Success xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</Success> <WalletOrigin xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Sales.Wallet">String</WalletOrigin> <WalletToken xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Sales.Wallet">String</WalletToken> <WalletUrl xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Sales.Wallet">String</WalletUrl> </WalletTokenCreateResponse>