diff --git a/com/alipay/ams/api/model/__init__.py b/com/alipay/ams/api/model/__init__.py index e69de29..b9db195 100644 --- a/com/alipay/ams/api/model/__init__.py +++ b/com/alipay/ams/api/model/__init__.py @@ -0,0 +1,5 @@ +# we can not import model classes here because that would create a circular +# reference which would not work in python2 +# do not import all models into this module because that uses a lot of memory and stack frames +# if you need the ability to import all models from one package, import them with +# from openapi_client.models import ModelA, ModelB diff --git a/com/alipay/ams/api/model/account_balance.py b/com/alipay/ams/api/model/account_balance.py index 24fe4e0..0b8c064 100644 --- a/com/alipay/ams/api/model/account_balance.py +++ b/com/alipay/ams/api/model/account_balance.py @@ -1,41 +1,95 @@ import json - +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.amount import Amount from com.alipay.ams.api.model.amount import Amount + + class AccountBalance: def __init__(self): - self.__account_balance = None - self.__currency = None - self.__available_balance = None #type: Amount - self.__frozen_balance = None #type: Amount - self.__total_balance = None #type: Amount + + self.__account_no = None # type: str + self.__currency = None # type: str + self.__available_balance = None # type: Amount + self.__frozen_balance = None # type: Amount + self.__total_balance = None # type: Amount + @property - def account_balance(self): - return self.__account_balance + def account_no(self): + """ + The balance account number. More information: Maximum length: 32 characters + """ + return self.__account_no + + @account_no.setter + def account_no(self, value): + self.__account_no = value @property def currency(self): + """ + The currency associated with the balance account. The value of this parameter is a 3-letter currency code that follows the ISO 4217 standard. More information: Maximum length: 3 characters + """ return self.__currency + @currency.setter + def currency(self, value): + self.__currency = value @property def available_balance(self): + """Gets the available_balance of this AccountBalance. + + """ return self.__available_balance + @available_balance.setter + def available_balance(self, value): + self.__available_balance = value @property def frozen_balance(self): + """Gets the frozen_balance of this AccountBalance. + + """ return self.__frozen_balance + @frozen_balance.setter + def frozen_balance(self, value): + self.__frozen_balance = value @property def total_balance(self): + """Gets the total_balance of this AccountBalance. + + """ return self.__total_balance + @total_balance.setter + def total_balance(self, value): + self.__total_balance = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "account_no") and self.account_no is not None: + params['accountNo'] = self.account_no + if hasattr(self, "currency") and self.currency is not None: + params['currency'] = self.currency + if hasattr(self, "available_balance") and self.available_balance is not None: + params['availableBalance'] = self.available_balance + if hasattr(self, "frozen_balance") and self.frozen_balance is not None: + params['frozenBalance'] = self.frozen_balance + if hasattr(self, "total_balance") and self.total_balance is not None: + params['totalBalance'] = self.total_balance + return params + + def parse_rsp_body(self, response_body): - if type(response_body) == str: + if isinstance(response_body, str): response_body = json.loads(response_body) - - if 'accountBalance' in response_body: - self.__account_balance = response_body['accountBalance'] + if 'accountNo' in response_body: + self.__account_no = response_body['accountNo'] if 'currency' in response_body: self.__currency = response_body['currency'] if 'availableBalance' in response_body: diff --git a/com/alipay/ams/api/model/account_holder_type.py b/com/alipay/ams/api/model/account_holder_type.py index a3f0fe8..65776ed 100644 --- a/com/alipay/ams/api/model/account_holder_type.py +++ b/com/alipay/ams/api/model/account_holder_type.py @@ -1,10 +1,21 @@ from enum import Enum, unique - - @unique class AccountHolderType(Enum): + """AccountHolderType枚举类""" + INDIVIDUAL = "INDIVIDUAL" ENTERPRISE = "ENTERPRISE" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if AccountHolderType.INDIVIDUAL.value == value: + return AccountHolderType.INDIVIDUAL + if AccountHolderType.ENTERPRISE.value == value: + return AccountHolderType.ENTERPRISE + return None diff --git a/com/alipay/ams/api/model/account_type.py b/com/alipay/ams/api/model/account_type.py index a0efd83..04969ad 100644 --- a/com/alipay/ams/api/model/account_type.py +++ b/com/alipay/ams/api/model/account_type.py @@ -1,11 +1,21 @@ - from enum import Enum, unique - - @unique class AccountType(Enum): + """AccountType枚举类""" + CHECKING = "CHECKING" FIXED_DEPOSIT = "FIXED_DEPOSIT" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if AccountType.CHECKING.value == value: + return AccountType.CHECKING + if AccountType.FIXED_DEPOSIT.value == value: + return AccountType.FIXED_DEPOSIT + return None diff --git a/com/alipay/ams/api/model/acquirer_info.py b/com/alipay/ams/api/model/acquirer_info.py index 577cc79..55dbfae 100644 --- a/com/alipay/ams/api/model/acquirer_info.py +++ b/com/alipay/ams/api/model/acquirer_info.py @@ -1,86 +1,112 @@ import json -class AcquirerInfo: + +class AcquirerInfo: def __init__(self): - self.__acquirer_name = None - self.__reference_request_id = None - self.__acquirer_transaction_id = None - self.__acquirer_merchant_id = None - self.__acquirer_result_code = None - self.__acquirer_result_message = None + + self.__acquirer_name = None # type: str + self.__reference_request_id = None # type: str + self.__acquirer_transaction_id = None # type: str + self.__acquirer_merchant_id = None # type: str + self.__acquirer_result_code = None # type: str + self.__acquirer_result_message = None # type: str + @property def acquirer_name(self): + """ + The name of the acquirer. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + """ return self.__acquirer_name @acquirer_name.setter - def acquirer_name(self, acquirer_name): - self.__acquirer_name = acquirer_name - + def acquirer_name(self, value): + self.__acquirer_name = value @property def reference_request_id(self): + """ + The unique ID that is assigned by APO to identify a payment request sent to the acquirer. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + """ return self.__reference_request_id @reference_request_id.setter - def reference_request_id(self, reference_request_id): - self.__reference_request_id = reference_request_id - + def reference_request_id(self, value): + self.__reference_request_id = value @property def acquirer_transaction_id(self): + """ + The unique ID that is assigned by the acquirer to identify a transaction. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + """ return self.__acquirer_transaction_id @acquirer_transaction_id.setter - def acquirer_transaction_id(self, acquirer_transaction_id): - self.__acquirer_transaction_id = acquirer_transaction_id - + def acquirer_transaction_id(self, value): + self.__acquirer_transaction_id = value @property def acquirer_merchant_id(self): + """ + The unique ID that is assigned by the acquirer to identify a merchant. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + """ return self.__acquirer_merchant_id @acquirer_merchant_id.setter - def acquirer_merchant_id(self, acquirer_merchant_id): - self.__acquirer_merchant_id = acquirer_merchant_id - + def acquirer_merchant_id(self, value): + self.__acquirer_merchant_id = value @property def acquirer_result_code(self): + """ + The acquirer's result code that indicates the transaction process result. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + """ return self.__acquirer_result_code @acquirer_result_code.setter - def acquirer_result_code(self, acquirer_result_code): - self.__acquirer_result_code = acquirer_result_code - + def acquirer_result_code(self, value): + self.__acquirer_result_code = value @property def acquirer_result_message(self): + """ + The result message that describes acquirerResultCode in detail. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + """ return self.__acquirer_result_message @acquirer_result_message.setter - def acquirer_result_message(self, acquirer_result_message): - self.__acquirer_result_message = acquirer_result_message - - def parse_rsp_body(self, result_body): - if type(result_body) == str: - payment_result_info_body = json.loads(result_body) - - if 'acquirerName' in result_body: - self.__acquirer_name = result_body['acquirerName'] - - if 'referenceRequestId' in result_body: - self.__reference_request_id = result_body['referenceRequestId'] - - if 'acquirerTransactionId' in result_body: - self.__acquirer_transaction_id = result_body['acquirerTransactionId'] - - if 'acquirerMerchantId' in result_body: - self.__acquirer_merchant_id = result_body['acquirerMerchantId'] - - if 'acquirerResultCode' in result_body: - self.__acquirer_result_code = result_body['acquirerResultCode'] - - if 'acquirerResultMessage' in result_body: - self.__acquirer_result_message = result_body['acquirerResultMessage'] - - - - + def acquirer_result_message(self, value): + self.__acquirer_result_message = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "acquirer_name") and self.acquirer_name is not None: + params['acquirerName'] = self.acquirer_name + if hasattr(self, "reference_request_id") and self.reference_request_id is not None: + params['referenceRequestId'] = self.reference_request_id + if hasattr(self, "acquirer_transaction_id") and self.acquirer_transaction_id is not None: + params['acquirerTransactionId'] = self.acquirer_transaction_id + if hasattr(self, "acquirer_merchant_id") and self.acquirer_merchant_id is not None: + params['acquirerMerchantId'] = self.acquirer_merchant_id + if hasattr(self, "acquirer_result_code") and self.acquirer_result_code is not None: + params['acquirerResultCode'] = self.acquirer_result_code + if hasattr(self, "acquirer_result_message") and self.acquirer_result_message is not None: + params['acquirerResultMessage'] = self.acquirer_result_message + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'acquirerName' in response_body: + self.__acquirer_name = response_body['acquirerName'] + if 'referenceRequestId' in response_body: + self.__reference_request_id = response_body['referenceRequestId'] + if 'acquirerTransactionId' in response_body: + self.__acquirer_transaction_id = response_body['acquirerTransactionId'] + if 'acquirerMerchantId' in response_body: + self.__acquirer_merchant_id = response_body['acquirerMerchantId'] + if 'acquirerResultCode' in response_body: + self.__acquirer_result_code = response_body['acquirerResultCode'] + if 'acquirerResultMessage' in response_body: + self.__acquirer_result_message = response_body['acquirerResultMessage'] diff --git a/com/alipay/ams/api/model/address.py b/com/alipay/ams/api/model/address.py index e12de7e..f488e32 100644 --- a/com/alipay/ams/api/model/address.py +++ b/com/alipay/ams/api/model/address.py @@ -1,121 +1,127 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -class Address(object): + + +class Address: def __init__(self): - self.__region = None - self.__state = None - self.__city = None - self.__address1 = None - self.__address2 = None - self.__zip_code = None - self.__label = None + + self.__region = None # type: str + self.__state = None # type: str + self.__city = None # type: str + self.__address1 = None # type: str + self.__address2 = None # type: str + self.__zip_code = None # type: str + self.__label = None # type: str + @property def region(self): + """Gets the region of this Address. + + """ return self.__region @region.setter def region(self, value): self.__region = value - @property def state(self): + """Gets the state of this Address. + + """ return self.__state @state.setter def state(self, value): self.__state = value - @property def city(self): + """Gets the city of this Address. + + """ return self.__city @city.setter def city(self, value): self.__city = value - @property def address1(self): + """Gets the address1 of this Address. + + """ return self.__address1 @address1.setter def address1(self, value): self.__address1 = value - @property def address2(self): + """Gets the address2 of this Address. + + """ return self.__address2 @address2.setter def address2(self, value): self.__address2 = value - @property def zip_code(self): + """Gets the zip_code of this Address. + + """ return self.__zip_code @zip_code.setter def zip_code(self, value): self.__zip_code = value - @property def label(self): + """Gets the label of this Address. + + """ return self.__label @label.setter def label(self, value): self.__label = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "region") and self.region: + if hasattr(self, "region") and self.region is not None: params['region'] = self.region - - if hasattr(self, "state") and self.state: + if hasattr(self, "state") and self.state is not None: params['state'] = self.state - - if hasattr(self, "city") and self.city: + if hasattr(self, "city") and self.city is not None: params['city'] = self.city - - if hasattr(self, "address1 ") and self.address1: + if hasattr(self, "address1") and self.address1 is not None: params['address1'] = self.address1 - - if hasattr(self, "address2") and self.address2: + if hasattr(self, "address2") and self.address2 is not None: params['address2'] = self.address2 - - if hasattr(self, "zip_code") and self.zip_code: + if hasattr(self, "zip_code") and self.zip_code is not None: params['zipCode'] = self.zip_code - - if hasattr(self, "label") and self.label: + if hasattr(self, "label") and self.label is not None: params['label'] = self.label - return params - def parse_rsp_body(self, address_body): - if type(address_body) == str: - address_body = json.loads(address_body) - - if 'region' in address_body: - self.__region = address_body['region'] - - if 'state' in address_body: - self.__state = address_body['state'] - - if 'city' in address_body: - self.__city = address_body['city'] - - if 'address1' in address_body: - self.__address1 = address_body['address1'] - - if 'address2' in address_body: - self.__address2 = address_body['address2'] - - if 'zipCode' in address_body: - self.__zip_code = address_body['zipCode'] - if 'label' in address_body: - self.__label = address_body['label'] + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'region' in response_body: + self.__region = response_body['region'] + if 'state' in response_body: + self.__state = response_body['state'] + if 'city' in response_body: + self.__city = response_body['city'] + if 'address1' in response_body: + self.__address1 = response_body['address1'] + if 'address2' in response_body: + self.__address2 = response_body['address2'] + if 'zipCode' in response_body: + self.__zip_code = response_body['zipCode'] + if 'label' in response_body: + self.__label = response_body['label'] diff --git a/com/alipay/ams/api/model/agreement_info.py b/com/alipay/ams/api/model/agreement_info.py index e482065..c0acead 100644 --- a/com/alipay/ams/api/model/agreement_info.py +++ b/com/alipay/ams/api/model/agreement_info.py @@ -1,35 +1,82 @@ import json -class AgreementInfo(object): + + +class AgreementInfo: def __init__(self): - self.__auth_state = None - self.__user_login_id = None + + self.__auth_state = None # type: str + self.__user_login_id = None # type: str + self.__user_login_type = None # type: str + self.__display_user_login_id = None # type: str + @property def auth_state(self): + """ + The unique ID generated by the merchant to initiate an Easy Pay authorization + """ return self.__auth_state @auth_state.setter def auth_state(self, value): self.__auth_state = value - @property def user_login_id(self): + """ + The login ID that the user used to register in the wallet + """ return self.__user_login_id @user_login_id.setter def user_login_id(self, value): self.__user_login_id = value + @property + def user_login_type(self): + """ + The login Type + """ + return self.__user_login_type + + @user_login_type.setter + def user_login_type(self, value): + self.__user_login_type = value + @property + def display_user_login_id(self): + """ + The login ID that use to display + """ + return self.__display_user_login_id + + @display_user_login_id.setter + def display_user_login_id(self, value): + self.__display_user_login_id = value + - def to_ams_json(self): - json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) - return json_str + def to_ams_dict(self): params = dict() - if self.__auth_state is not None: - params['authState'] = self.__auth_state - if self.__user_login_id is not None: - params['userLoginId'] = self.__user_login_id + if hasattr(self, "auth_state") and self.auth_state is not None: + params['authState'] = self.auth_state + if hasattr(self, "user_login_id") and self.user_login_id is not None: + params['userLoginId'] = self.user_login_id + if hasattr(self, "user_login_type") and self.user_login_type is not None: + params['userLoginType'] = self.user_login_type + if hasattr(self, "display_user_login_id") and self.display_user_login_id is not None: + params['displayUserLoginId'] = self.display_user_login_id return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'authState' in response_body: + self.__auth_state = response_body['authState'] + if 'userLoginId' in response_body: + self.__user_login_id = response_body['userLoginId'] + if 'userLoginType' in response_body: + self.__user_login_type = response_body['userLoginType'] + if 'displayUserLoginId' in response_body: + self.__display_user_login_id = response_body['displayUserLoginId'] diff --git a/com/alipay/ams/api/model/amount.py b/com/alipay/ams/api/model/amount.py index 1f94223..da42dc0 100644 --- a/com/alipay/ams/api/model/amount.py +++ b/com/alipay/ams/api/model/amount.py @@ -1,39 +1,52 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -class Amount(object): + + +class Amount: def __init__(self, currency=None, value=None): - self.__currency = currency - self.__value = value + + self.__currency = currency # type: str + self.__value = value # type: str + @property def currency(self): + """Gets the currency of this Amount. + + """ return self.__currency + @currency.setter + def currency(self, value): + self.__currency = value @property def value(self): + """Gets the value of this Amount. + + """ return self.__value + @value.setter + def value(self, value): + self.__value = value + + + + def to_ams_dict(self): params = dict() - if hasattr(self, "currency") and self.currency: + if hasattr(self, "currency") and self.currency is not None: params['currency'] = self.currency - - if hasattr(self, "value") and self.value: + if hasattr(self, "value") and self.value is not None: params['value'] = self.value - return params - def parse_rsp_body(self, amount_body): - if type(amount_body) == str: - amount_body = json.loads(amount_body) - - if 'currency' in amount_body: - self.__currency = amount_body['currency'] - - if 'value' in amount_body: - self.__value = amount_body['value'] + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'currency' in response_body: + self.__currency = response_body['currency'] + if 'value' in response_body: + self.__value = response_body['value'] diff --git a/com/alipay/ams/api/model/amount_limit.py b/com/alipay/ams/api/model/amount_limit.py index f5570f2..e42cfc6 100644 --- a/com/alipay/ams/api/model/amount_limit.py +++ b/com/alipay/ams/api/model/amount_limit.py @@ -1,44 +1,67 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -from com.alipay.ams.api.model.amount import Amount -class AmountLimit(object): + +class AmountLimit: def __init__(self): - self.__max_amount = None - self.__min_amount = None - self.__remain_amount = None + + self.__max_amount = None # type: str + self.__min_amount = None # type: str + self.__remain_amount = None # type: str + @property def max_amount(self): + """Gets the max_amount of this AmountLimit. + + """ return self.__max_amount + @max_amount.setter + def max_amount(self, value): + self.__max_amount = value @property def min_amount(self): + """Gets the min_amount of this AmountLimit. + + """ return self.__min_amount + @min_amount.setter + def min_amount(self, value): + self.__min_amount = value @property def remain_amount(self): + """Gets the remain_amount of this AmountLimit. + + """ return self.__remain_amount - def parse_rsp_body(self, amount_limit_body): - if type(amount_limit_body) == str: - amount_limit_body = json.loads(amount_limit_body) + @remain_amount.setter + def remain_amount(self, value): + self.__remain_amount = value + + + - if 'maxAmount' in amount_limit_body: - max_amount = Amount() - max_amount.parse_rsp_body(amount_limit_body['maxAmount']) - self.__max_amount = max_amount + def to_ams_dict(self): + params = dict() + if hasattr(self, "max_amount") and self.max_amount is not None: + params['maxAmount'] = self.max_amount + if hasattr(self, "min_amount") and self.min_amount is not None: + params['minAmount'] = self.min_amount + if hasattr(self, "remain_amount") and self.remain_amount is not None: + params['remainAmount'] = self.remain_amount + return params - if 'minAmount' in amount_limit_body: - min_amount = Amount() - min_amount.parse_rsp_body(amount_limit_body['minAmount']) - self.__min_amount = min_amount - if 'remainAmount' in amount_limit_body: - remain_amount = Amount() - remain_amount.parse_rsp_body(amount_limit_body['remainAmount']) - self.__remain_amount = remain_amount + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'maxAmount' in response_body: + self.__max_amount = response_body['maxAmount'] + if 'minAmount' in response_body: + self.__min_amount = response_body['minAmount'] + if 'remainAmount' in response_body: + self.__remain_amount = response_body['remainAmount'] diff --git a/com/alipay/ams/api/model/association_type.py b/com/alipay/ams/api/model/association_type.py index 0c6d958..14c617f 100644 --- a/com/alipay/ams/api/model/association_type.py +++ b/com/alipay/ams/api/model/association_type.py @@ -1,9 +1,8 @@ - from enum import Enum, unique - - @unique class AssociationType(Enum): + """AssociationType枚举类""" + LEGAL_REPRESENTATIVE = "LEGAL_REPRESENTATIVE" UBO = "UBO" CONTACT = "CONTACT" @@ -11,5 +10,24 @@ class AssociationType(Enum): AUTHORIZER = "AUTHORIZER" BOARD_MEMBER = "BOARD_MEMBER" - def to_ams_dict(self): - return self.name \ No newline at end of file + def to_ams_dict(self) -> str: + return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if AssociationType.LEGAL_REPRESENTATIVE.value == value: + return AssociationType.LEGAL_REPRESENTATIVE + if AssociationType.UBO.value == value: + return AssociationType.UBO + if AssociationType.CONTACT.value == value: + return AssociationType.CONTACT + if AssociationType.DIRECTOR.value == value: + return AssociationType.DIRECTOR + if AssociationType.AUTHORIZER.value == value: + return AssociationType.AUTHORIZER + if AssociationType.BOARD_MEMBER.value == value: + return AssociationType.BOARD_MEMBER + return None diff --git a/com/alipay/ams/api/model/attachment.py b/com/alipay/ams/api/model/attachment.py index c0d0243..c2f4e08 100644 --- a/com/alipay/ams/api/model/attachment.py +++ b/com/alipay/ams/api/model/attachment.py @@ -1,54 +1,82 @@ -class Attachment(object): +import json + + + + +class Attachment: def __init__(self): - self.__attachment_type = None - self.__file = None - self.__attachment_name = None - self.__file_key = None + + self.__attachment_type = None # type: str + self.__file = None # type: str + self.__attachment_name = None # type: str + self.__file_key = None # type: str + @property def attachment_type(self): + """ + The type of attachment. Valid values are: SIGNATURE_AUTHORIZATION_LETTER: indicates a document that allows someone to sign on behalf of an individual or a company. ARTICLES_OF_ASSOCIATION: indicates the regulations and rules of a company. LOGO: indicates the merchant's logo. Specify attachmentType as LOGO when the value of paymentMethodType is TRUEMONEY. More information: Maximum length: 64 characters + """ return self.__attachment_type @attachment_type.setter def attachment_type(self, value): self.__attachment_type = value - @property def file(self): + """Gets the file of this Attachment. + + """ return self.__file @file.setter def file(self, value): self.__file = value - @property def attachment_name(self): + """ + The name of the attachment file, including the file extension, such as XXX.jpg or XXX.png. More information: Maximum length: 256 characters + """ return self.__attachment_name @attachment_name.setter def attachment_name(self, value): self.__attachment_name = value - @property def file_key(self): + """ + The unique key value of the attachment file. Maximum file size: 32MB. The value of this parameter is obtained from the attachmentKey parameter in the submitAttachment API. Prior attachment submission using the submitAttachment API is required. More information: Maximum length: 256 characters + """ return self.__file_key @file_key.setter def file_key(self, value): self.__file_key = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "attachment_type") and self.attachment_type: + if hasattr(self, "attachment_type") and self.attachment_type is not None: params['attachmentType'] = self.attachment_type - - if hasattr(self, "file") and self.file: + if hasattr(self, "file") and self.file is not None: params['file'] = self.file - - if hasattr(self, "attachment_name") and self.attachment_name: + if hasattr(self, "attachment_name") and self.attachment_name is not None: params['attachmentName'] = self.attachment_name - - if hasattr(self, "file_key") and self.file_key: + if hasattr(self, "file_key") and self.file_key is not None: params['fileKey'] = self.file_key - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'attachmentType' in response_body: + self.__attachment_type = response_body['attachmentType'] + if 'file' in response_body: + self.__file = response_body['file'] + if 'attachmentName' in response_body: + self.__attachment_name = response_body['attachmentName'] + if 'fileKey' in response_body: + self.__file_key = response_body['fileKey'] diff --git a/com/alipay/ams/api/model/attachment_type.py b/com/alipay/ams/api/model/attachment_type.py index 489d9e3..f7b7964 100644 --- a/com/alipay/ams/api/model/attachment_type.py +++ b/com/alipay/ams/api/model/attachment_type.py @@ -1,10 +1,8 @@ - - from enum import Enum, unique - - @unique class AttachmentType(Enum): + """AttachmentType枚举类""" + SIGNATURE_AUTHORIZATION_LETTER = "SIGNATURE_AUTHORIZATION_LETTER" ARTICLES_OF_ASSOCIATION = "ARTICLES_OF_ASSOCIATION" LOGO = "LOGO" @@ -22,5 +20,44 @@ class AttachmentType(Enum): CPF = "CPF" CNPJ = "CNPJ" - def to_ams_dict(self): - return self.name \ No newline at end of file + def to_ams_dict(self) -> str: + return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if AttachmentType.SIGNATURE_AUTHORIZATION_LETTER.value == value: + return AttachmentType.SIGNATURE_AUTHORIZATION_LETTER + if AttachmentType.ARTICLES_OF_ASSOCIATION.value == value: + return AttachmentType.ARTICLES_OF_ASSOCIATION + if AttachmentType.LOGO.value == value: + return AttachmentType.LOGO + if AttachmentType.AUTHORIZER_SIGNATURE_CONFIRMATION_LETTER.value == value: + return AttachmentType.AUTHORIZER_SIGNATURE_CONFIRMATION_LETTER + if AttachmentType.ASSOCIATION_ARTICLE.value == value: + return AttachmentType.ASSOCIATION_ARTICLE + if AttachmentType.FINANCIAL_REPORT.value == value: + return AttachmentType.FINANCIAL_REPORT + if AttachmentType.OWNERSHIP_STRUCTURE_PIC.value == value: + return AttachmentType.OWNERSHIP_STRUCTURE_PIC + if AttachmentType.ADDRESS_PROOF.value == value: + return AttachmentType.ADDRESS_PROOF + if AttachmentType.UBO_PROVE.value == value: + return AttachmentType.UBO_PROVE + if AttachmentType.ENTERPRISE_REGISTRATION.value == value: + return AttachmentType.ENTERPRISE_REGISTRATION + if AttachmentType.LICENSE_INFO.value == value: + return AttachmentType.LICENSE_INFO + if AttachmentType.ID_CARD.value == value: + return AttachmentType.ID_CARD + if AttachmentType.PASSPORT.value == value: + return AttachmentType.PASSPORT + if AttachmentType.DRIVING_LICENSE.value == value: + return AttachmentType.DRIVING_LICENSE + if AttachmentType.CPF.value == value: + return AttachmentType.CPF + if AttachmentType.CNPJ.value == value: + return AttachmentType.CNPJ + return None diff --git a/com/alipay/ams/api/model/auth_code_form.py b/com/alipay/ams/api/model/auth_code_form.py index cdad0c1..d381df8 100644 --- a/com/alipay/ams/api/model/auth_code_form.py +++ b/com/alipay/ams/api/model/auth_code_form.py @@ -1,20 +1,42 @@ +import json from com.alipay.ams.api.model.code_detail import CodeDetail -class AuthCodeForm(object): + + +class AuthCodeForm: def __init__(self): - self.codeDetails = None # type: list[CodeDetail] + + self.__code_details = None # type: [CodeDetail] + @property def code_details(self): - return self.codeDetails + """ + A list of QR code information. + """ + return self.__code_details @code_details.setter def code_details(self, value): - self.codeDetails = value + self.__code_details = value + + + def to_ams_dict(self): params = dict() - if self.codeDetails is not None: - params['codeDetails'] = [item.to_ams_dict() for item in self.codeDetails] + if hasattr(self, "code_details") and self.code_details is not None: + params['codeDetails'] = self.code_details return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'codeDetails' in response_body: + self.__code_details = [] + for item in response_body['codeDetails']: + obj = CodeDetail() + obj.parse_rsp_body(item) + self.__code_details.append(obj) diff --git a/com/alipay/ams/api/model/auth_meta_data.py b/com/alipay/ams/api/model/auth_meta_data.py index 66eb962..d7343bd 100644 --- a/com/alipay/ams/api/model/auth_meta_data.py +++ b/com/alipay/ams/api/model/auth_meta_data.py @@ -1,32 +1,52 @@ +import json + + + class AuthMetaData: def __init__(self): - self.__account_holder_name = None - self.__account_holder_certNo = None - + + self.__account_holder_name = None # type: str + self.__account_holder_cert_no = None # type: str + @property def account_holder_name(self): + """Gets the account_holder_name of this AuthMetaData. + + """ return self.__account_holder_name @account_holder_name.setter def account_holder_name(self, value): self.__account_holder_name = value - @property - def account_holder_certNo(self): - return self.__account_holder_certNo + def account_holder_cert_no(self): + """Gets the account_holder_cert_no of this AuthMetaData. + + """ + return self.__account_holder_cert_no + + @account_holder_cert_no.setter + def account_holder_cert_no(self, value): + self.__account_holder_cert_no = value - @account_holder_certNo.setter - def account_holder_certNo(self, value): - self.__account_holder_certNo = value + def to_ams_dict(self): params = dict() - if hasattr(self, "account_holder_name") and self.account_holder_name: + if hasattr(self, "account_holder_name") and self.account_holder_name is not None: params['accountHolderName'] = self.account_holder_name - if hasattr(self, "account_holder_certNo") and self.account_holder_certNo: - params['accountHolderCertNo'] = self.account_holder_certNo - - return params \ No newline at end of file + if hasattr(self, "account_holder_cert_no") and self.account_holder_cert_no is not None: + params['accountHolderCertNo'] = self.account_holder_cert_no + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'accountHolderName' in response_body: + self.__account_holder_name = response_body['accountHolderName'] + if 'accountHolderCertNo' in response_body: + self.__account_holder_cert_no = response_body['accountHolderCertNo'] diff --git a/com/alipay/ams/api/model/available_payment_method.py b/com/alipay/ams/api/model/available_payment_method.py index 5a1cd0f..0118af4 100644 --- a/com/alipay/ams/api/model/available_payment_method.py +++ b/com/alipay/ams/api/model/available_payment_method.py @@ -1,42 +1,42 @@ +import json from com.alipay.ams.api.model.payment_method_type_item import PaymentMethodTypeItem -class AvailablePaymentMethod: - def __init__(self): - self.__payment_method_type_list = None #type: list[PaymentMethodTypeItem] - self.__payment_method_meta_data = None #type: map[string,object] +class AvailablePaymentMethod: + def __init__(self): + + self.__payment_method_type_list = None # type: [PaymentMethodTypeItem] + @property def payment_method_type_list(self): + """Gets the payment_method_type_list of this AvailablePaymentMethod. + + """ return self.__payment_method_type_list - @payment_method_type_list.setter - def payment_method_type_list(self, payment_method_type_list): - if not isinstance(payment_method_type_list, list): - raise TypeError("payment_method_type_list should be list[PaymentMethodTypeItem]") + def payment_method_type_list(self, value): + self.__payment_method_type_list = value - for item in payment_method_type_list: - if not isinstance(item, PaymentMethodTypeItem): - raise TypeError("item should be type of PaymentMethodTypeItem") - - self.__payment_method_type_list = payment_method_type_list - - - @property - def payment_method_meta_data(self): - return self.__payment_method_meta_data - @payment_method_meta_data.setter - def payment_method_meta_data(self, payment_method_meta_data): - self.__payment_method_meta_data = payment_method_meta_data + def to_ams_dict(self): params = dict() - if self.__payment_method_type_list is not None: - params['paymentMethodTypeList'] = [item.to_ams_dict() for item in self.__payment_method_type_list] - if self.__payment_method_meta_data is not None: - params['paymentMethodMetaData'] = self.__payment_method_meta_data - return params \ No newline at end of file + if hasattr(self, "payment_method_type_list") and self.payment_method_type_list is not None: + params['paymentMethodTypeList'] = self.payment_method_type_list + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'paymentMethodTypeList' in response_body: + self.__payment_method_type_list = [] + for item in response_body['paymentMethodTypeList']: + obj = PaymentMethodTypeItem() + obj.parse_rsp_body(item) + self.__payment_method_type_list.append(obj) diff --git a/com/alipay/ams/api/model/browser_info.py b/com/alipay/ams/api/model/browser_info.py index ea3559a..d4b7ab2 100644 --- a/com/alipay/ams/api/model/browser_info.py +++ b/com/alipay/ams/api/model/browser_info.py @@ -1,65 +1,97 @@ -class BrowserInfo(object): +import json + + + + +class BrowserInfo: def __init__(self): - self.__accept_header = None - self.__java_enabled = None - self.__java_script_enabled = None - self.__language = None - self.__user_agent = None + + self.__accept_header = None # type: str + self.__java_enabled = None # type: bool + self.__java_script_enabled = None # type: bool + self.__language = None # type: str + self.__user_agent = None # type: str + @property def accept_header(self): + """ + The accept header of the user's browser + """ return self.__accept_header @accept_header.setter def accept_header(self, value): self.__accept_header = value - @property def java_enabled(self): + """ + Indicates whether the user's browser is able to run Java + """ return self.__java_enabled @java_enabled.setter def java_enabled(self, value): self.__java_enabled = value - @property def java_script_enabled(self): + """ + Indicates whether the user's browser is able to run Java + """ return self.__java_script_enabled @java_script_enabled.setter def java_script_enabled(self, value): self.__java_script_enabled = value - @property def language(self): + """ + The language of the user's browser + """ return self.__language @language.setter def language(self, value): self.__language = value - @property def user_agent(self): + """ + The user agent of the user's browser + """ return self.__user_agent @user_agent.setter def user_agent(self, value): self.__user_agent = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "accept_header") and self.accept_header: + if hasattr(self, "accept_header") and self.accept_header is not None: params['acceptHeader'] = self.accept_header - - if hasattr(self, "java_enabled") and self.java_enabled: + if hasattr(self, "java_enabled") and self.java_enabled is not None: params['javaEnabled'] = self.java_enabled - - if hasattr(self, "java_script_enabled") and self.java_script_enabled: + if hasattr(self, "java_script_enabled") and self.java_script_enabled is not None: params['javaScriptEnabled'] = self.java_script_enabled - - if hasattr(self, "language") and self.language: + if hasattr(self, "language") and self.language is not None: params['language'] = self.language - - if hasattr(self, "user_agent") and self.user_agent: + if hasattr(self, "user_agent") and self.user_agent is not None: params['userAgent'] = self.user_agent return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'acceptHeader' in response_body: + self.__accept_header = response_body['acceptHeader'] + if 'javaEnabled' in response_body: + self.__java_enabled = response_body['javaEnabled'] + if 'javaScriptEnabled' in response_body: + self.__java_script_enabled = response_body['javaScriptEnabled'] + if 'language' in response_body: + self.__language = response_body['language'] + if 'userAgent' in response_body: + self.__user_agent = response_body['userAgent'] diff --git a/com/alipay/ams/api/model/business_info.py b/com/alipay/ams/api/model/business_info.py index d537bda..769c854 100644 --- a/com/alipay/ams/api/model/business_info.py +++ b/com/alipay/ams/api/model/business_info.py @@ -1,89 +1,132 @@ +import json from com.alipay.ams.api.model.web_site import WebSite + + class BusinessInfo: def __init__(self): - self.__mcc = None - self.__websites = None #type: list[WebSite] - self.__englishName = None - self.__doingBusinessAs = None - self.__mainSalesCountry = None - self.__appName = None - self.__serviceDescription = None + + self.__mcc = None # type: str + self.__websites = None # type: [WebSite] + self.__english_name = None # type: str + self.__doing_business_as = None # type: str + self.__main_sales_country = None # type: str + self.__app_name = None # type: str + self.__service_description = None # type: str + @property def mcc(self): + """ + mcc String The merchant category code (MCC). See MCC list to check valid values. More information: Maximum length: 32 characters + """ return self.__mcc @mcc.setter def mcc(self, value): self.__mcc = value - @property def websites(self): + """ + The list of merchant websites. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR. More information: Maximum size: 10 elements + """ return self.__websites @websites.setter def websites(self, value): self.__websites = value - @property - def englishName(self): - return self.__englishName - - @englishName.setter - def englishName(self, value): - self.__englishName = value - + def english_name(self): + """ + The English name of the company. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is JP. More information: Maximum length: 256 characters + """ + return self.__english_name + + @english_name.setter + def english_name(self, value): + self.__english_name = value @property - def doingBusinessAs(self): - return self.__doingBusinessAs - - @doingBusinessAs.setter - def doingBusinessAs(self, value): - self.__doingBusinessAs = value - + def doing_business_as(self): + """ + The customer-facing business name. Consider user interface limitations when choosing this name. More information: Maximum length: 256 characters + """ + return self.__doing_business_as + + @doing_business_as.setter + def doing_business_as(self, value): + self.__doing_business_as = value @property - def mainSalesCountry(self): - return self.__mainSalesCountry - - @mainSalesCountry.setter - def mainSalesCountry(self, value): - self.__mainSalesCountry = value - + def main_sales_country(self): + """ + The country where your primary sales activities take place. The value of this parameter is a 2-letter country or region code based on the ISO 3166 Country Codes standard. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is US. More information: Maximum length: 2 characters + """ + return self.__main_sales_country + + @main_sales_country.setter + def main_sales_country(self, value): + self.__main_sales_country = value @property - def appName(self): - return self.__appName + def app_name(self): + """ + The App name. Specify this parameter when the value of paymentMethodType is TRUEMONEY. More information: Maximum length: 256 characters + """ + return self.__app_name + + @app_name.setter + def app_name(self, value): + self.__app_name = value + @property + def service_description(self): + """ + A clear and detailed description of the product or service. Specify this parameter when the value of paymentMethodType is TRUEMONEY. More information: Maximum length: 256 characters + """ + return self.__service_description - @appName.setter - def appName(self, value): - self.__appName = value + @service_description.setter + def service_description(self, value): + self.__service_description = value - @property - def serviceDescription(self): - return self.__serviceDescription - @serviceDescription.setter - def serviceDescription(self, value): - self.__serviceDescription = value + def to_ams_dict(self): params = dict() - if hasattr(self, 'mcc') and self.mcc: + if hasattr(self, "mcc") and self.mcc is not None: params['mcc'] = self.mcc - if hasattr(self, 'websites') and self.websites: - params['websites'] = [] - for i in self.websites: - params['websites'].append(i.to_ams_dict()) - if hasattr(self, 'englishName') and self.englishName: - params['englishName'] = self.englishName - if hasattr(self, 'doingBusinessAs') and self.doingBusinessAs: - params['doingBusinessAs'] = self.doingBusinessAs - if hasattr(self, 'mainSalesCountry') and self.mainSalesCountry: - params['mainSalesCountry'] = self.mainSalesCountry - if hasattr(self, 'appName') and self.appName: - params['appName'] = self.appName - if hasattr(self, 'serviceDescription') and self.serviceDescription: - params['serviceDescription'] = self.serviceDescription + if hasattr(self, "websites") and self.websites is not None: + params['websites'] = self.websites + if hasattr(self, "english_name") and self.english_name is not None: + params['englishName'] = self.english_name + if hasattr(self, "doing_business_as") and self.doing_business_as is not None: + params['doingBusinessAs'] = self.doing_business_as + if hasattr(self, "main_sales_country") and self.main_sales_country is not None: + params['mainSalesCountry'] = self.main_sales_country + if hasattr(self, "app_name") and self.app_name is not None: + params['appName'] = self.app_name + if hasattr(self, "service_description") and self.service_description is not None: + params['serviceDescription'] = self.service_description return params + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'mcc' in response_body: + self.__mcc = response_body['mcc'] + if 'websites' in response_body: + self.__websites = [] + for item in response_body['websites']: + obj = WebSite() + obj.parse_rsp_body(item) + self.__websites.append(obj) + if 'englishName' in response_body: + self.__english_name = response_body['englishName'] + if 'doingBusinessAs' in response_body: + self.__doing_business_as = response_body['doingBusinessAs'] + if 'mainSalesCountry' in response_body: + self.__main_sales_country = response_body['mainSalesCountry'] + if 'appName' in response_body: + self.__app_name = response_body['appName'] + if 'serviceDescription' in response_body: + self.__service_description = response_body['serviceDescription'] diff --git a/com/alipay/ams/api/model/buyer.py b/com/alipay/ams/api/model/buyer.py index 1476d18..168b271 100644 --- a/com/alipay/ams/api/model/buyer.py +++ b/com/alipay/ams/api/model/buyer.py @@ -1,59 +1,129 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json +from com.alipay.ams.api.model.user_name import UserName -class Buyer(object): + +class Buyer: def __init__(self): - self.__reference_buyer_id = None - self.__buyer_name = None - self.__buyer_phone_no = None - self.__buyer_email = None + + self.__reference_buyer_id = None # type: str + self.__buyer_name = None # type: UserName + self.__buyer_phone_no = None # type: str + self.__buyer_email = None # type: str + self.__buyer_registration_time = None # type: str + self.__is_account_verified = None # type: bool + self.__successful_order_count = None # type: int + @property def reference_buyer_id(self): + """ + The unique ID to identify the buyer. Specify this parameter: When you require risk control. When the value of paymentMethodType is CARD. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 64 characters + """ return self.__reference_buyer_id @reference_buyer_id.setter def reference_buyer_id(self, value): self.__reference_buyer_id = value - @property def buyer_name(self): + """Gets the buyer_name of this Buyer. + + """ return self.__buyer_name @buyer_name.setter def buyer_name(self, value): self.__buyer_name = value - @property def buyer_phone_no(self): + """ + The mobile phone number of the buyer. Specify this parameter when one of the following conditions is met: You require risk control. The value of paymentMethodType is CARD. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 24 characters + """ return self.__buyer_phone_no @buyer_phone_no.setter def buyer_phone_no(self, value): self.__buyer_phone_no = value - @property def buyer_email(self): + """ + The email of the buyer. Specify this parameter: When you require risk control. When the value of paymentMethodType is CARD. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 64 characters + """ return self.__buyer_email @buyer_email.setter def buyer_email(self, value): self.__buyer_email = value + @property + def buyer_registration_time(self): + """ + The time when the buyer registered your account. Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 64 characters The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ + return self.__buyer_registration_time + + @buyer_registration_time.setter + def buyer_registration_time(self, value): + self.__buyer_registration_time = value + @property + def is_account_verified(self): + """Gets the is_account_verified of this Buyer. + + """ + return self.__is_account_verified + + @is_account_verified.setter + def is_account_verified(self, value): + self.__is_account_verified = value + @property + def successful_order_count(self): + """Gets the successful_order_count of this Buyer. + + """ + return self.__successful_order_count + + @successful_order_count.setter + def successful_order_count(self, value): + self.__successful_order_count = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "reference_buyer_id") and self.reference_buyer_id: + if hasattr(self, "reference_buyer_id") and self.reference_buyer_id is not None: params['referenceBuyerId'] = self.reference_buyer_id - - if hasattr(self, "buyer_name") and self.buyer_name: + if hasattr(self, "buyer_name") and self.buyer_name is not None: params['buyerName'] = self.buyer_name - - if hasattr(self, "buyer_phone_no") and self.buyer_phone_no: + if hasattr(self, "buyer_phone_no") and self.buyer_phone_no is not None: params['buyerPhoneNo'] = self.buyer_phone_no - - if hasattr(self, "buyer_email") and self.buyer_email: + if hasattr(self, "buyer_email") and self.buyer_email is not None: params['buyerEmail'] = self.buyer_email - + if hasattr(self, "buyer_registration_time") and self.buyer_registration_time is not None: + params['buyerRegistrationTime'] = self.buyer_registration_time + if hasattr(self, "is_account_verified") and self.is_account_verified is not None: + params['isAccountVerified'] = self.is_account_verified + if hasattr(self, "successful_order_count") and self.successful_order_count is not None: + params['successfulOrderCount'] = self.successful_order_count return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'referenceBuyerId' in response_body: + self.__reference_buyer_id = response_body['referenceBuyerId'] + if 'buyerName' in response_body: + self.__buyer_name = UserName() + self.__buyer_name.parse_rsp_body(response_body['buyerName']) + if 'buyerPhoneNo' in response_body: + self.__buyer_phone_no = response_body['buyerPhoneNo'] + if 'buyerEmail' in response_body: + self.__buyer_email = response_body['buyerEmail'] + if 'buyerRegistrationTime' in response_body: + self.__buyer_registration_time = response_body['buyerRegistrationTime'] + if 'isAccountVerified' in response_body: + self.__is_account_verified = response_body['isAccountVerified'] + if 'successfulOrderCount' in response_body: + self.__successful_order_count = response_body['successfulOrderCount'] diff --git a/com/alipay/ams/api/model/card_brand.py b/com/alipay/ams/api/model/card_brand.py index 766d839..5a99f98 100644 --- a/com/alipay/ams/api/model/card_brand.py +++ b/com/alipay/ams/api/model/card_brand.py @@ -1,10 +1,8 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class CardBrand(Enum): + """CardBrand枚举类""" + VISA = "VISA" MASTERCARD = "MASTERCARD" MAESTRO = "MAESTRO" @@ -18,7 +16,7 @@ class CardBrand(Enum): HIPERCARD = "HIPERCARD" TROY = "TROY" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name @staticmethod @@ -28,27 +26,26 @@ def value_of(value): if CardBrand.VISA.value == value: return CardBrand.VISA - elif CardBrand.MASTERCARD.value == value: + if CardBrand.MASTERCARD.value == value: return CardBrand.MASTERCARD - elif CardBrand.MAESTRO.value == value: + if CardBrand.MAESTRO.value == value: return CardBrand.MAESTRO - elif CardBrand.AMEX.value == value: + if CardBrand.AMEX.value == value: return CardBrand.AMEX - elif CardBrand.JCB.value == value: + if CardBrand.JCB.value == value: return CardBrand.JCB - elif CardBrand.DINERS.value == value: + if CardBrand.DINERS.value == value: return CardBrand.DINERS - elif CardBrand.DISCOVER.value == value: + if CardBrand.DISCOVER.value == value: return CardBrand.DISCOVER - elif CardBrand.CUP.value == value: + if CardBrand.CUP.value == value: return CardBrand.CUP - elif CardBrand.MIR.value == value: + if CardBrand.MIR.value == value: return CardBrand.MIR - elif CardBrand.ELO.value == value: + if CardBrand.ELO.value == value: return CardBrand.ELO - elif CardBrand.HIPERCARD.value == value: + if CardBrand.HIPERCARD.value == value: return CardBrand.HIPERCARD - elif CardBrand.TROY.value == value: + if CardBrand.TROY.value == value: return CardBrand.TROY - else: - return None + return None diff --git a/com/alipay/ams/api/model/card_info.py b/com/alipay/ams/api/model/card_info.py new file mode 100644 index 0000000..b24bd94 --- /dev/null +++ b/com/alipay/ams/api/model/card_info.py @@ -0,0 +1,129 @@ +import json +from com.alipay.ams.api.model.three_ds_result import ThreeDSResult + + + + +class CardInfo: + def __init__(self): + + self.__card_no = None # type: str + self.__card_brand = None # type: str + self.__card_token = None # type: str + self.__issuing_country = None # type: str + self.__funding = None # type: str + self.__payment_method_region = None # type: str + self.__three_ds_result = None # type: ThreeDSResult + + + @property + def card_no(self): + """ + The masked card number, which just shows part of the card number and can be used to display to the user + """ + return self.__card_no + + @card_no.setter + def card_no(self, value): + self.__card_no = value + @property + def card_brand(self): + """ + The card brand + """ + return self.__card_brand + + @card_brand.setter + def card_brand(self, value): + self.__card_brand = value + @property + def card_token(self): + """ + The token of the card + """ + return self.__card_token + + @card_token.setter + def card_token(self, value): + self.__card_token = value + @property + def issuing_country(self): + """ + The issuing country of the card + """ + return self.__issuing_country + + @issuing_country.setter + def issuing_country(self, value): + self.__issuing_country = value + @property + def funding(self): + """ + The funding type of the card + """ + return self.__funding + + @funding.setter + def funding(self, value): + self.__funding = value + @property + def payment_method_region(self): + """ + The region code that represents the country or region of the payment method + """ + return self.__payment_method_region + + @payment_method_region.setter + def payment_method_region(self, value): + self.__payment_method_region = value + @property + def three_ds_result(self): + """Gets the three_ds_result of this CardInfo. + + """ + return self.__three_ds_result + + @three_ds_result.setter + def three_ds_result(self, value): + self.__three_ds_result = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "card_no") and self.card_no is not None: + params['cardNo'] = self.card_no + if hasattr(self, "card_brand") and self.card_brand is not None: + params['cardBrand'] = self.card_brand + if hasattr(self, "card_token") and self.card_token is not None: + params['cardToken'] = self.card_token + if hasattr(self, "issuing_country") and self.issuing_country is not None: + params['issuingCountry'] = self.issuing_country + if hasattr(self, "funding") and self.funding is not None: + params['funding'] = self.funding + if hasattr(self, "payment_method_region") and self.payment_method_region is not None: + params['paymentMethodRegion'] = self.payment_method_region + if hasattr(self, "three_ds_result") and self.three_ds_result is not None: + params['threeDSResult'] = self.three_ds_result + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'cardNo' in response_body: + self.__card_no = response_body['cardNo'] + if 'cardBrand' in response_body: + self.__card_brand = response_body['cardBrand'] + if 'cardToken' in response_body: + self.__card_token = response_body['cardToken'] + if 'issuingCountry' in response_body: + self.__issuing_country = response_body['issuingCountry'] + if 'funding' in response_body: + self.__funding = response_body['funding'] + if 'paymentMethodRegion' in response_body: + self.__payment_method_region = response_body['paymentMethodRegion'] + if 'threeDSResult' in response_body: + self.__three_ds_result = ThreeDSResult() + self.__three_ds_result.parse_rsp_body(response_body['threeDSResult']) diff --git a/com/alipay/ams/api/model/card_payment_method_detail.py b/com/alipay/ams/api/model/card_payment_method_detail.py index 8259ca9..a05fcc6 100644 --- a/com/alipay/ams/api/model/card_payment_method_detail.py +++ b/com/alipay/ams/api/model/card_payment_method_detail.py @@ -1,457 +1,574 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - -from com.alipay.ams.api.model.address import Address from com.alipay.ams.api.model.card_brand import CardBrand +from com.alipay.ams.api.model.card_brand import CardBrand +from com.alipay.ams.api.model.user_name import UserName +from com.alipay.ams.api.model.address import Address from com.alipay.ams.api.model.user_name import UserName +from com.alipay.ams.api.model.mpi_data import MpiData + -class CardPaymentMethodDetail(object): +class CardPaymentMethodDetail: def __init__(self): - self.__card_token = None - self.__card_no = None - self.__brand = None # type: CardBrand - self.__selected_card_brand = None # type: CardBrand - self.__card_issuer = None - self.__country_issue = None + + self.__card_token = None # type: str + self.__card_no = None # type: str + self.__brand = None # type: CardBrand + self.__selected_card_brand = None # type: CardBrand + self.__card_issuer = None # type: str + self.__country_issue = None # type: str self.__inst_user_name = None # type: UserName - self.__expiry_year = None - self.__expiry_month = None + self.__expiry_year = None # type: str + self.__expiry_month = None # type: str self.__billing_address = None # type: Address - self.__mask = None - self.__last4 = None - self.__payment_method_detail_metadata = None - - self.__masked_card_no = None - self.__fingerprint = None - self.__authentication_flow = None - self.__funding = None - self.__avs_result_raw = None - self.__bin = None - self.__issuer_name = None - self.__issuing_country = None - self.__last_four = None - self.__cardholder_name = None - self.__cvv = None - self.__date_of_birth = None - self.__businessNo = None - self.__card_password_digest = None - self.__cpf = None - self.__payer_email = None - self.__network_transaction_id = None - self.__is_3DS_authentication = None + self.__mask = None # type: str + self.__last4 = None # type: str + self.__payment_method_detail_metadata = None # type: str + self.__masked_card_no = None # type: str + self.__fingerprint = None # type: str + self.__authentication_flow = None # type: str + self.__funding = None # type: str + self.__avs_result_raw = None # type: str + self.__cvv_result_raw = None # type: str + self.__bin = None # type: str + self.__issuer_name = None # type: str + self.__issuing_country = None # type: str + self.__last_four = None # type: str + self.__cardholder_name = None # type: UserName + self.__cvv = None # type: str + self.__date_of_birth = None # type: str + self.__business_no = None # type: str + self.__card_password_digest = None # type: str + self.__cpf = None # type: str + self.__payer_email = None # type: str + self.__network_transaction_id = None # type: str + self.__is3_ds_authentication = None # type: bool + self.__request3_ds = None # type: str + self.__sca_exemption_indicator = None # type: str + self.__enable_authentication_upgrade = None # type: str + self.__mpi_data = None # type: MpiData + @property def card_token(self): + """ + The token of the card. The value of this parameter is used by paymentMethodId in the pay (Checkout Payment) API when initiating payments. More information: Maximum length: 2048 characters + """ return self.__card_token + @card_token.setter def card_token(self, value): self.__card_token = value - @property def card_no(self): + """Gets the card_no of this CardPaymentMethodDetail. + + """ return self.__card_no + @card_no.setter def card_no(self, value): self.__card_no = value - @property def brand(self): + """Gets the brand of this CardPaymentMethodDetail. + + """ return self.__brand + @brand.setter def brand(self, value): self.__brand = value - @property def selected_card_brand(self): + """Gets the selected_card_brand of this CardPaymentMethodDetail. + + """ return self.__selected_card_brand @selected_card_brand.setter def selected_card_brand(self, value): self.__selected_card_brand = value - @property def card_issuer(self): + """Gets the card_issuer of this CardPaymentMethodDetail. + + """ return self.__card_issuer @card_issuer.setter def card_issuer(self, value): self.__card_issuer = value - @property def country_issue(self): + """Gets the country_issue of this CardPaymentMethodDetail. + + """ return self.__country_issue + @country_issue.setter def country_issue(self, value): self.__country_issue = value - @property def inst_user_name(self): + """Gets the inst_user_name of this CardPaymentMethodDetail. + + """ return self.__inst_user_name @inst_user_name.setter def inst_user_name(self, value): self.__inst_user_name = value - @property def expiry_year(self): + """Gets the expiry_year of this CardPaymentMethodDetail. + + """ return self.__expiry_year @expiry_year.setter def expiry_year(self, value): self.__expiry_year = value - @property def expiry_month(self): + """Gets the expiry_month of this CardPaymentMethodDetail. + + """ return self.__expiry_month @expiry_month.setter def expiry_month(self, value): self.__expiry_month = value - @property def billing_address(self): + """Gets the billing_address of this CardPaymentMethodDetail. + + """ return self.__billing_address @billing_address.setter def billing_address(self, value): self.__billing_address = value - @property def mask(self): + """Gets the mask of this CardPaymentMethodDetail. + + """ return self.__mask @mask.setter def mask(self, value): self.__mask = value - @property def last4(self): + """Gets the last4 of this CardPaymentMethodDetail. + + """ return self.__last4 @last4.setter def last4(self, value): self.__last4 = value - @property def payment_method_detail_metadata(self): + """Gets the payment_method_detail_metadata of this CardPaymentMethodDetail. + + """ return self.__payment_method_detail_metadata @payment_method_detail_metadata.setter def payment_method_detail_metadata(self, value): self.__payment_method_detail_metadata = value - @property def masked_card_no(self): + """ + The masked card number, showing only a few digits and hiding the rest. More information: Maximum length: 64 characters + """ return self.__masked_card_no @masked_card_no.setter def masked_card_no(self, value): self.__masked_card_no = value - @property def fingerprint(self): + """Gets the fingerprint of this CardPaymentMethodDetail. + + """ return self.__fingerprint @fingerprint.setter def fingerprint(self, value): self.__fingerprint = value - @property def authentication_flow(self): + """Gets the authentication_flow of this CardPaymentMethodDetail. + + """ return self.__authentication_flow @authentication_flow.setter def authentication_flow(self, value): self.__authentication_flow = value - @property def funding(self): + """Gets the funding of this CardPaymentMethodDetail. + + """ return self.__funding @funding.setter def funding(self, value): self.__funding = value - @property def avs_result_raw(self): + """Gets the avs_result_raw of this CardPaymentMethodDetail. + + """ return self.__avs_result_raw @avs_result_raw.setter def avs_result_raw(self, value): self.__avs_result_raw = value - + @property + def cvv_result_raw(self): + """Gets the cvv_result_raw of this CardPaymentMethodDetail. + + """ + return self.__cvv_result_raw + + @cvv_result_raw.setter + def cvv_result_raw(self, value): + self.__cvv_result_raw = value @property def bin(self): + """Gets the bin of this CardPaymentMethodDetail. + + """ return self.__bin @bin.setter def bin(self, value): self.__bin = value - @property def issuer_name(self): + """Gets the issuer_name of this CardPaymentMethodDetail. + + """ return self.__issuer_name @issuer_name.setter def issuer_name(self, value): self.__issuer_name = value - @property def issuing_country(self): + """Gets the issuing_country of this CardPaymentMethodDetail. + + """ return self.__issuing_country @issuing_country.setter def issuing_country(self, value): self.__issuing_country = value - @property def last_four(self): + """Gets the last_four of this CardPaymentMethodDetail. + + """ return self.__last_four @last_four.setter def last_four(self, value): self.__last_four = value - @property def cardholder_name(self): + """Gets the cardholder_name of this CardPaymentMethodDetail. + + """ return self.__cardholder_name @cardholder_name.setter def cardholder_name(self, value): self.__cardholder_name = value - @property def cvv(self): + """Gets the cvv of this CardPaymentMethodDetail. + + """ return self.__cvv @cvv.setter def cvv(self, value): self.__cvv = value - @property def date_of_birth(self): + """Gets the date_of_birth of this CardPaymentMethodDetail. + + """ return self.__date_of_birth @date_of_birth.setter def date_of_birth(self, value): self.__date_of_birth = value - @property - def businessNo(self): - return self.__businessNo - - @businessNo.setter - def businessNo(self, value): - self.__businessNo = value - + def business_no(self): + """Gets the business_no of this CardPaymentMethodDetail. + + """ + return self.__business_no + + @business_no.setter + def business_no(self, value): + self.__business_no = value @property def card_password_digest(self): + """Gets the card_password_digest of this CardPaymentMethodDetail. + + """ return self.__card_password_digest @card_password_digest.setter def card_password_digest(self, value): self.__card_password_digest = value - @property def cpf(self): + """Gets the cpf of this CardPaymentMethodDetail. + + """ return self.__cpf @cpf.setter def cpf(self, value): self.__cpf = value - @property def payer_email(self): + """Gets the payer_email of this CardPaymentMethodDetail. + + """ return self.__payer_email @payer_email.setter def payer_email(self, value): self.__payer_email = value - @property def network_transaction_id(self): + """ + The unique ID assigned by the card scheme to identify a transaction. More information: Maximum length: 256 characters + """ return self.__network_transaction_id @network_transaction_id.setter def network_transaction_id(self, value): self.__network_transaction_id = value - @property - def is_3DS_authentication(self): - return self.__is_3DS_authentication - - @is_3DS_authentication.setter - def is_3DS_authentication(self, value): - self.__is_3DS_authentication = value - - - def parse_rsp_body(self, card_payment_method_detail_body): - if type(card_payment_method_detail_body) == str: - card_payment_method_detail_body = json.loads(card_payment_method_detail_body) - - if 'cardToken' in card_payment_method_detail_body: - self.__card_token = card_payment_method_detail_body['cardToken'] - - if 'cardNo' in card_payment_method_detail_body: - self.__card_no = card_payment_method_detail_body['cardNo'] - - if 'brand' in card_payment_method_detail_body: - card_no = CardBrand.value_of(card_payment_method_detail_body['brand']) - self.__card_no = card_no - - if 'selectedCardBrand' in card_payment_method_detail_body: - card_no = CardBrand.value_of(card_payment_method_detail_body['selectedCardBrand']) - self.__selected_card_brand = card_no - - if 'cardIssuer' in card_payment_method_detail_body: - self.__card_issuer = card_payment_method_detail_body['cardIssuer'] - - if 'countryIssue' in card_payment_method_detail_body: - self.__country_issue = card_payment_method_detail_body['countryIssue'] - - if 'instUserName' in card_payment_method_detail_body: - inst_user_name = UserName() - inst_user_name.parse_rsp_body(card_payment_method_detail_body['instUserName']) - self.__inst_user_name = inst_user_name - - if 'expiryYear' in card_payment_method_detail_body: - self.__expiry_year = card_payment_method_detail_body['expiryYear'] - - if 'expiryMonth' in card_payment_method_detail_body: - self.__expiry_month = card_payment_method_detail_body['expiryMonth'] - - if 'billingAddress' in card_payment_method_detail_body: - billing_address = Address() - billing_address.parse_rsp_body(card_payment_method_detail_body['billingAddress']) - self.__billing_address = billing_address - - if 'mask' in card_payment_method_detail_body: - self.__mask = card_payment_method_detail_body['mask'] - - if 'last4' in card_payment_method_detail_body: - self.__last4 = card_payment_method_detail_body['last4'] - - if 'paymentMethodDetailMetadata' in card_payment_method_detail_body: - self.__payment_method_detail_metadata = card_payment_method_detail_body['paymentMethodDetailMetadata'] - - if 'maskedCardNo' in card_payment_method_detail_body: - self.__masked_card_no = card_payment_method_detail_body['maskedCardNo'] - - if 'fingerprint' in card_payment_method_detail_body: - self.__fingerprint = card_payment_method_detail_body['fingerprint'] - - if 'authenticationFlow' in card_payment_method_detail_body: - self.__authentication_flow = card_payment_method_detail_body['authenticationFlow'] - - if 'funding' in card_payment_method_detail_body: - self.__funding = card_payment_method_detail_body['funding'] - - if 'avsResultRaw' in card_payment_method_detail_body: - self.__avs_result_raw = card_payment_method_detail_body['avsResultRaw'] - - if 'bin' in card_payment_method_detail_body: - self.__bin = card_payment_method_detail_body['bin'] - - if 'issuerName' in card_payment_method_detail_body: - self.__issuer_name = card_payment_method_detail_body['issuerName'] - - if 'issuingCountry' in card_payment_method_detail_body: - self.__issuing_country = card_payment_method_detail_body['issuingCountry'] - - if 'lastFour' in card_payment_method_detail_body: - self.__last_four = card_payment_method_detail_body['lastFour'] - - if 'cardholderName' in card_payment_method_detail_body: - self.__cardholder_name = card_payment_method_detail_body['cardholderName'] - - if 'cvv' in card_payment_method_detail_body: - self.__cvv = card_payment_method_detail_body['cvv'] - - if 'dateOfBirth' in card_payment_method_detail_body: - self.__date_of_birth = card_payment_method_detail_body['dateOfBirth'] - - if 'businessNo' in card_payment_method_detail_body: - self.__businessNo = card_payment_method_detail_body['businessNo'] + def is3_ds_authentication(self): + """Gets the is3_ds_authentication of this CardPaymentMethodDetail. + + """ + return self.__is3_ds_authentication + + @is3_ds_authentication.setter + def is3_ds_authentication(self, value): + self.__is3_ds_authentication = value + @property + def request3_ds(self): + """Gets the request3_ds of this CardPaymentMethodDetail. + + """ + return self.__request3_ds + + @request3_ds.setter + def request3_ds(self, value): + self.__request3_ds = value + @property + def sca_exemption_indicator(self): + """Gets the sca_exemption_indicator of this CardPaymentMethodDetail. + + """ + return self.__sca_exemption_indicator + + @sca_exemption_indicator.setter + def sca_exemption_indicator(self, value): + self.__sca_exemption_indicator = value + @property + def enable_authentication_upgrade(self): + """Gets the enable_authentication_upgrade of this CardPaymentMethodDetail. + + """ + return self.__enable_authentication_upgrade + + @enable_authentication_upgrade.setter + def enable_authentication_upgrade(self, value): + self.__enable_authentication_upgrade = value + @property + def mpi_data(self): + """Gets the mpi_data of this CardPaymentMethodDetail. + + """ + return self.__mpi_data - if 'cardPasswordDigest' in card_payment_method_detail_body: - self.__card_password_digest = card_payment_method_detail_body['cardPasswordDigest'] + @mpi_data.setter + def mpi_data(self, value): + self.__mpi_data = value - if 'cpf' in card_payment_method_detail_body: - self.__cpf = card_payment_method_detail_body['cpf'] - if 'payerEmail' in card_payment_method_detail_body: - self.__payer_email = card_payment_method_detail_body['payerEmail'] - if 'networkTransactionId' in card_payment_method_detail_body: - self.__network_transaction_id = card_payment_method_detail_body['networkTransactionId'] - if 'is3DSAuthentication' in card_payment_method_detail_body: - self.__is_3DS_authentication = card_payment_method_detail_body['is3DSAuthentication'] + def to_ams_dict(self): params = dict() - if self.card_token: + if hasattr(self, "card_token") and self.card_token is not None: params['cardToken'] = self.card_token - if self.card_no: + if hasattr(self, "card_no") and self.card_no is not None: params['cardNo'] = self.card_no - if self.brand: - params['brand'] = self.brand.name - if self.selected_card_brand: - params['selectedCardBrand'] = self.selected_card_brand.name - if self.card_issuer: + if hasattr(self, "brand") and self.brand is not None: + params['brand'] = self.brand + if hasattr(self, "selected_card_brand") and self.selected_card_brand is not None: + params['selectedCardBrand'] = self.selected_card_brand + if hasattr(self, "card_issuer") and self.card_issuer is not None: params['cardIssuer'] = self.card_issuer - if self.country_issue: + if hasattr(self, "country_issue") and self.country_issue is not None: params['countryIssue'] = self.country_issue - if self.inst_user_name: - params['instUserName'] = self.inst_user_name.to_ams_dict() - if self.expiry_year: + if hasattr(self, "inst_user_name") and self.inst_user_name is not None: + params['instUserName'] = self.inst_user_name + if hasattr(self, "expiry_year") and self.expiry_year is not None: params['expiryYear'] = self.expiry_year - if self.expiry_month: + if hasattr(self, "expiry_month") and self.expiry_month is not None: params['expiryMonth'] = self.expiry_month - if self.billing_address: - params['billingAddress'] = self.billing_address.to_ams_dict() - if self.mask: + if hasattr(self, "billing_address") and self.billing_address is not None: + params['billingAddress'] = self.billing_address + if hasattr(self, "mask") and self.mask is not None: params['mask'] = self.mask - if self.last4: + if hasattr(self, "last4") and self.last4 is not None: params['last4'] = self.last4 - if self.payment_method_detail_metadata: + if hasattr(self, "payment_method_detail_metadata") and self.payment_method_detail_metadata is not None: params['paymentMethodDetailMetadata'] = self.payment_method_detail_metadata - if self.masked_card_no: + if hasattr(self, "masked_card_no") and self.masked_card_no is not None: params['maskedCardNo'] = self.masked_card_no - if self.fingerprint: + if hasattr(self, "fingerprint") and self.fingerprint is not None: params['fingerprint'] = self.fingerprint - if self.authentication_flow: + if hasattr(self, "authentication_flow") and self.authentication_flow is not None: params['authenticationFlow'] = self.authentication_flow - if self.funding: + if hasattr(self, "funding") and self.funding is not None: params['funding'] = self.funding - if self.avs_result_raw: + if hasattr(self, "avs_result_raw") and self.avs_result_raw is not None: params['avsResultRaw'] = self.avs_result_raw - if self.bin: + if hasattr(self, "cvv_result_raw") and self.cvv_result_raw is not None: + params['cvvResultRaw'] = self.cvv_result_raw + if hasattr(self, "bin") and self.bin is not None: params['bin'] = self.bin - if self.issuer_name: + if hasattr(self, "issuer_name") and self.issuer_name is not None: params['issuerName'] = self.issuer_name - if self.issuing_country: + if hasattr(self, "issuing_country") and self.issuing_country is not None: params['issuingCountry'] = self.issuing_country - if self.last_four: + if hasattr(self, "last_four") and self.last_four is not None: params['lastFour'] = self.last_four - if self.cardholder_name: + if hasattr(self, "cardholder_name") and self.cardholder_name is not None: params['cardholderName'] = self.cardholder_name - if self.cvv: + if hasattr(self, "cvv") and self.cvv is not None: params['cvv'] = self.cvv - if self.date_of_birth: + if hasattr(self, "date_of_birth") and self.date_of_birth is not None: params['dateOfBirth'] = self.date_of_birth - if self.businessNo: - params['businessNo'] = self.businessNo - if self.card_password_digest: + if hasattr(self, "business_no") and self.business_no is not None: + params['businessNo'] = self.business_no + if hasattr(self, "card_password_digest") and self.card_password_digest is not None: params['cardPasswordDigest'] = self.card_password_digest - if self.cpf: + if hasattr(self, "cpf") and self.cpf is not None: params['cpf'] = self.cpf - if self.payer_email: + if hasattr(self, "payer_email") and self.payer_email is not None: params['payerEmail'] = self.payer_email - if self.network_transaction_id: + if hasattr(self, "network_transaction_id") and self.network_transaction_id is not None: params['networkTransactionId'] = self.network_transaction_id - if self.is_3DS_authentication: - params['is3DSAuthentication'] = self.is_3DS_authentication - return params \ No newline at end of file + if hasattr(self, "is3_ds_authentication") and self.is3_ds_authentication is not None: + params['is3DSAuthentication'] = self.is3_ds_authentication + if hasattr(self, "request3_ds") and self.request3_ds is not None: + params['request3DS'] = self.request3_ds + if hasattr(self, "sca_exemption_indicator") and self.sca_exemption_indicator is not None: + params['scaExemptionIndicator'] = self.sca_exemption_indicator + if hasattr(self, "enable_authentication_upgrade") and self.enable_authentication_upgrade is not None: + params['enableAuthenticationUpgrade'] = self.enable_authentication_upgrade + if hasattr(self, "mpi_data") and self.mpi_data is not None: + params['mpiData'] = self.mpi_data + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'cardToken' in response_body: + self.__card_token = response_body['cardToken'] + if 'cardNo' in response_body: + self.__card_no = response_body['cardNo'] + if 'brand' in response_body: + brand_temp = CardBrand.value_of(response_body['brand']) + self.__brand = brand_temp + if 'selectedCardBrand' in response_body: + selected_card_brand_temp = CardBrand.value_of(response_body['selectedCardBrand']) + self.__selected_card_brand = selected_card_brand_temp + if 'cardIssuer' in response_body: + self.__card_issuer = response_body['cardIssuer'] + if 'countryIssue' in response_body: + self.__country_issue = response_body['countryIssue'] + if 'instUserName' in response_body: + self.__inst_user_name = UserName() + self.__inst_user_name.parse_rsp_body(response_body['instUserName']) + if 'expiryYear' in response_body: + self.__expiry_year = response_body['expiryYear'] + if 'expiryMonth' in response_body: + self.__expiry_month = response_body['expiryMonth'] + if 'billingAddress' in response_body: + self.__billing_address = Address() + self.__billing_address.parse_rsp_body(response_body['billingAddress']) + if 'mask' in response_body: + self.__mask = response_body['mask'] + if 'last4' in response_body: + self.__last4 = response_body['last4'] + if 'paymentMethodDetailMetadata' in response_body: + self.__payment_method_detail_metadata = response_body['paymentMethodDetailMetadata'] + if 'maskedCardNo' in response_body: + self.__masked_card_no = response_body['maskedCardNo'] + if 'fingerprint' in response_body: + self.__fingerprint = response_body['fingerprint'] + if 'authenticationFlow' in response_body: + self.__authentication_flow = response_body['authenticationFlow'] + if 'funding' in response_body: + self.__funding = response_body['funding'] + if 'avsResultRaw' in response_body: + self.__avs_result_raw = response_body['avsResultRaw'] + if 'cvvResultRaw' in response_body: + self.__cvv_result_raw = response_body['cvvResultRaw'] + if 'bin' in response_body: + self.__bin = response_body['bin'] + if 'issuerName' in response_body: + self.__issuer_name = response_body['issuerName'] + if 'issuingCountry' in response_body: + self.__issuing_country = response_body['issuingCountry'] + if 'lastFour' in response_body: + self.__last_four = response_body['lastFour'] + if 'cardholderName' in response_body: + self.__cardholder_name = UserName() + self.__cardholder_name.parse_rsp_body(response_body['cardholderName']) + if 'cvv' in response_body: + self.__cvv = response_body['cvv'] + if 'dateOfBirth' in response_body: + self.__date_of_birth = response_body['dateOfBirth'] + if 'businessNo' in response_body: + self.__business_no = response_body['businessNo'] + if 'cardPasswordDigest' in response_body: + self.__card_password_digest = response_body['cardPasswordDigest'] + if 'cpf' in response_body: + self.__cpf = response_body['cpf'] + if 'payerEmail' in response_body: + self.__payer_email = response_body['payerEmail'] + if 'networkTransactionId' in response_body: + self.__network_transaction_id = response_body['networkTransactionId'] + if 'is3DSAuthentication' in response_body: + self.__is3_ds_authentication = response_body['is3DSAuthentication'] + if 'request3DS' in response_body: + self.__request3_ds = response_body['request3DS'] + if 'scaExemptionIndicator' in response_body: + self.__sca_exemption_indicator = response_body['scaExemptionIndicator'] + if 'enableAuthenticationUpgrade' in response_body: + self.__enable_authentication_upgrade = response_body['enableAuthenticationUpgrade'] + if 'mpiData' in response_body: + self.__mpi_data = MpiData() + self.__mpi_data.parse_rsp_body(response_body['mpiData']) diff --git a/com/alipay/ams/api/model/card_verification_result.py b/com/alipay/ams/api/model/card_verification_result.py index cf39c79..8ed5ee6 100644 --- a/com/alipay/ams/api/model/card_verification_result.py +++ b/com/alipay/ams/api/model/card_verification_result.py @@ -1,76 +1,114 @@ -from com.alipay.ams.api.model.three_ds_result import ThreeDSResult +import json +from com.alipay.ams.api.model.risk_three_ds_result import RiskThreeDSResult + + class CardVerificationResult: def __init__(self): - self.__authentication_type = None - self.__authentication_method = None - self.__cvv_result = None - self.__avs_result = None - self.__authorization_code = None - self.__three_d_s_result = None #type: ThreeDSResult + + self.__authentication_type = None # type: str + self.__authentication_method = None # type: str + self.__cvv_result = None # type: str + self.__avs_result = None # type: str + self.__authorization_code = None # type: str + self.__three_ds_result = None # type: RiskThreeDSResult + @property def authentication_type(self): + """ + Authentication type + """ return self.__authentication_type @authentication_type.setter def authentication_type(self, value): self.__authentication_type = value - @property def authentication_method(self): + """ + The authentication method that a merchant uses for a card payment + """ return self.__authentication_method @authentication_method.setter def authentication_method(self, value): self.__authentication_method = value - @property def cvv_result(self): + """ + The verification result of the card verification value (CVV) + """ return self.__cvv_result @cvv_result.setter def cvv_result(self, value): self.__cvv_result = value - @property def avs_result(self): + """ + The address verification result. + """ return self.__avs_result @avs_result.setter def avs_result(self, value): self.__avs_result = value - @property def authorization_code(self): + """ + The authorization code granted by the payment method provider for a successful 3D authentication. + """ return self.__authorization_code @authorization_code.setter def authorization_code(self, value): self.__authorization_code = value - @property - def three_d_s_result(self): - return self.__three_d_s_result + def three_ds_result(self): + """Gets the three_ds_result of this CardVerificationResult. + + """ + return self.__three_ds_result + + @three_ds_result.setter + def three_ds_result(self, value): + self.__three_ds_result = value - @three_d_s_result.setter - def three_d_s_result(self, value): - self.__three_d_s_result = value + def to_ams_dict(self): params = dict() - if self.__authentication_type is not None: - params['authenticationType'] = self.__authentication_type - if self.__authentication_method is not None: - params['authenticationMethod'] = self.__authentication_method - if self.__cvv_result is not None: - params['cvvResult'] = self.__cvv_result - if self.__avs_result is not None: - params['avsResult'] = self.__avs_result - if self.__authorization_code is not None: - params['authorizationCode'] = self.__authorization_code - if self.__three_d_s_result is not None: - params['threeDSResult'] = self.__three_d_s_result - return params \ No newline at end of file + if hasattr(self, "authentication_type") and self.authentication_type is not None: + params['authenticationType'] = self.authentication_type + if hasattr(self, "authentication_method") and self.authentication_method is not None: + params['authenticationMethod'] = self.authentication_method + if hasattr(self, "cvv_result") and self.cvv_result is not None: + params['cvvResult'] = self.cvv_result + if hasattr(self, "avs_result") and self.avs_result is not None: + params['avsResult'] = self.avs_result + if hasattr(self, "authorization_code") and self.authorization_code is not None: + params['authorizationCode'] = self.authorization_code + if hasattr(self, "three_ds_result") and self.three_ds_result is not None: + params['threeDSResult'] = self.three_ds_result + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'authenticationType' in response_body: + self.__authentication_type = response_body['authenticationType'] + if 'authenticationMethod' in response_body: + self.__authentication_method = response_body['authenticationMethod'] + if 'cvvResult' in response_body: + self.__cvv_result = response_body['cvvResult'] + if 'avsResult' in response_body: + self.__avs_result = response_body['avsResult'] + if 'authorizationCode' in response_body: + self.__authorization_code = response_body['authorizationCode'] + if 'threeDSResult' in response_body: + self.__three_ds_result = RiskThreeDSResult() + self.__three_ds_result.parse_rsp_body(response_body['threeDSResult']) diff --git a/com/alipay/ams/api/model/certificate.py b/com/alipay/ams/api/model/certificate.py index 143fa50..7b27705 100644 --- a/com/alipay/ams/api/model/certificate.py +++ b/com/alipay/ams/api/model/certificate.py @@ -1,65 +1,101 @@ +import json from com.alipay.ams.api.model.certificate_type import CertificateType from com.alipay.ams.api.model.user_name import UserName -class Certificate(object): + + +class Certificate: def __init__(self): + self.__certificate_type = None # type: CertificateType - self.__certificate_no = None + self.__certificate_no = None # type: str self.__holder_name = None # type: UserName - self.__file_keys = None - self.__certificate_authority = None + self.__file_keys = None # type: [str] + self.__certificate_authority = None # type: str + @property def certificate_type(self): + """Gets the certificate_type of this Certificate. + + """ return self.__certificate_type + @certificate_type.setter + def certificate_type(self, value): + self.__certificate_type = value @property def certificate_no(self): + """ + The unique identification number of the certificate. More information: Maximum length: 64 characters + """ return self.__certificate_no + @certificate_no.setter + def certificate_no(self, value): + self.__certificate_no = value @property def holder_name(self): + """Gets the holder_name of this Certificate. + + """ return self.__holder_name + @holder_name.setter + def holder_name(self, value): + self.__holder_name = value @property def file_keys(self): + """ + A list of the unique key values of attachment files. Maximum file size: 32MB. The value of this parameter is obtained from the attachmentKey parameter in the submitAttachment API. Prior attachment submission using the submitAttachment API is required. Specify this parameter when the value of merchantInfo.company.certificates.certificateType is ENTERPRISE_REGISTRATION and the value of merchantInfo.company.registeredAddress.region is AU, SG, HK, GB, MY, US or the company's registered region belongs to the European Union. More information: Maximum size: 10 elements + """ return self.__file_keys + @file_keys.setter + def file_keys(self, value): + self.__file_keys = value @property def certificate_authority(self): + """ + The country that authorizes the certificate. The value of this parameter is a 2-letter country or region code based on the ISO 3166 Country Codes standard. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is US. More information: Maximum length: 64 characters + """ return self.__certificate_authority - @certificate_type.setter - def certificate_type(self, certificate_type): - self.__certificate_type = certificate_type - - @certificate_no.setter - def certificate_no(self, certificate_no): - self.__certificate_no = certificate_no - - @holder_name.setter - def holder_name(self, holder_name): - self.__holder_name = holder_name + @certificate_authority.setter + def certificate_authority(self, value): + self.__certificate_authority = value - @file_keys.setter - def file_keys(self, file_keys): - self.__file_keys = file_keys - @certificate_authority.setter - def certificate_authority(self, certificate_authority): - self.__certificate_authority = certificate_authority + def to_ams_dict(self): params = dict() - if self.certificate_type is not None: + if hasattr(self, "certificate_type") and self.certificate_type is not None: params['certificateType'] = self.certificate_type - if self.certificate_no is not None: + if hasattr(self, "certificate_no") and self.certificate_no is not None: params['certificateNo'] = self.certificate_no - if self.holder_name is not None: - params['holderName'] = self.holder_name.to_ams_dict() - if self.file_keys is not None: + if hasattr(self, "holder_name") and self.holder_name is not None: + params['holderName'] = self.holder_name + if hasattr(self, "file_keys") and self.file_keys is not None: params['fileKeys'] = self.file_keys - if self.certificate_authority is not None: + if hasattr(self, "certificate_authority") and self.certificate_authority is not None: params['certificateAuthority'] = self.certificate_authority return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'certificateType' in response_body: + certificate_type_temp = CertificateType.value_of(response_body['certificateType']) + self.__certificate_type = certificate_type_temp + if 'certificateNo' in response_body: + self.__certificate_no = response_body['certificateNo'] + if 'holderName' in response_body: + self.__holder_name = UserName() + self.__holder_name.parse_rsp_body(response_body['holderName']) + if 'fileKeys' in response_body: + self.__file_keys = response_body['fileKeys'] + if 'certificateAuthority' in response_body: + self.__certificate_authority = response_body['certificateAuthority'] diff --git a/com/alipay/ams/api/model/certificate_type.py b/com/alipay/ams/api/model/certificate_type.py index 97e81e1..db65251 100644 --- a/com/alipay/ams/api/model/certificate_type.py +++ b/com/alipay/ams/api/model/certificate_type.py @@ -1,15 +1,36 @@ from enum import Enum, unique - - @unique class CertificateType(Enum): - ID_CARD = "ID_CARD" - PASSPORT = "PASSPORT" + """CertificateType枚举类""" + ENTERPRISE_REGISTRATION = "ENTERPRISE_REGISTRATION" LICENSE_INFO = "LICENSE_INFO" + ID_CARD = "ID_CARD" + PASSPORT = "PASSPORT" DRIVING_LICENSE = "DRIVING_LICENSE" CPF = "CPF" CNPJ = "CNPJ" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if CertificateType.ENTERPRISE_REGISTRATION.value == value: + return CertificateType.ENTERPRISE_REGISTRATION + if CertificateType.LICENSE_INFO.value == value: + return CertificateType.LICENSE_INFO + if CertificateType.ID_CARD.value == value: + return CertificateType.ID_CARD + if CertificateType.PASSPORT.value == value: + return CertificateType.PASSPORT + if CertificateType.DRIVING_LICENSE.value == value: + return CertificateType.DRIVING_LICENSE + if CertificateType.CPF.value == value: + return CertificateType.CPF + if CertificateType.CNPJ.value == value: + return CertificateType.CNPJ + return None diff --git a/com/alipay/ams/api/model/challenge_action_form.py b/com/alipay/ams/api/model/challenge_action_form.py index d186a25..1e28745 100644 --- a/com/alipay/ams/api/model/challenge_action_form.py +++ b/com/alipay/ams/api/model/challenge_action_form.py @@ -1,63 +1,86 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - -from com.alipay.ams.api.model.challenge_trigger_source_type import ChallengeTriggerSourceType from com.alipay.ams.api.model.challenge_type import ChallengeType +from com.alipay.ams.api.model.challenge_trigger_source_type import ChallengeTriggerSourceType + + -class ChallengeActionForm(object): +class ChallengeActionForm: def __init__(self): - self.__challenge_type = None # type:ChallengeType - self.__challenge_render_value = None - self.__trigger_source = None # type:ChallengeTriggerSourceType - self.__extend_info = None + + self.__challenge_type = None # type: ChallengeType + self.__challenge_render_value = None # type: str + self.__trigger_source = None # type: ChallengeTriggerSourceType + self.__extend_info = None # type: str + @property def challenge_type(self): + """Gets the challenge_type of this ChallengeActionForm. + + """ return self.__challenge_type @challenge_type.setter def challenge_type(self, value): self.__challenge_type = value - @property def challenge_render_value(self): + """Gets the challenge_render_value of this ChallengeActionForm. + + """ return self.__challenge_render_value @challenge_render_value.setter def challenge_render_value(self, value): self.__challenge_render_value = value - @property def trigger_source(self): + """Gets the trigger_source of this ChallengeActionForm. + + """ return self.__trigger_source @trigger_source.setter def trigger_source(self, value): self.__trigger_source = value - @property def extend_info(self): + """Gets the extend_info of this ChallengeActionForm. + + """ return self.__extend_info @extend_info.setter def extend_info(self, value): self.__extend_info = value - def parse_rsp_body(self, challenge_action_form_body): - if type(challenge_action_form_body) == str: - challenge_action_form_body = json.loads(challenge_action_form_body) - - if 'challengeType' in challenge_action_form_body: - self.__challenge_type = challenge_action_form_body['challengeType'] - - if 'challengeRenderValue' in challenge_action_form_body: - self.__challenge_render_value = challenge_action_form_body['challengeRenderValue'] - - if 'triggerSource' in challenge_action_form_body: - self.__trigger_source = challenge_action_form_body['triggerSource'] - if 'extendInfo' in challenge_action_form_body: - self.__extend_info = challenge_action_form_body['extendInfo'] + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "challenge_type") and self.challenge_type is not None: + params['challengeType'] = self.challenge_type + if hasattr(self, "challenge_render_value") and self.challenge_render_value is not None: + params['challengeRenderValue'] = self.challenge_render_value + if hasattr(self, "trigger_source") and self.trigger_source is not None: + params['triggerSource'] = self.trigger_source + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'challengeType' in response_body: + challenge_type_temp = ChallengeType.value_of(response_body['challengeType']) + self.__challenge_type = challenge_type_temp + if 'challengeRenderValue' in response_body: + self.__challenge_render_value = response_body['challengeRenderValue'] + if 'triggerSource' in response_body: + trigger_source_temp = ChallengeTriggerSourceType.value_of(response_body['triggerSource']) + self.__trigger_source = trigger_source_temp + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] diff --git a/com/alipay/ams/api/model/challenge_trigger_source_type.py b/com/alipay/ams/api/model/challenge_trigger_source_type.py index a15254e..f2da30d 100644 --- a/com/alipay/ams/api/model/challenge_trigger_source_type.py +++ b/com/alipay/ams/api/model/challenge_trigger_source_type.py @@ -1,13 +1,21 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - from enum import Enum, unique - - @unique class ChallengeTriggerSourceType(Enum): + """ChallengeTriggerSourceType枚举类""" + AMS = "AMS" CHANNEL = "CHANNEL" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if ChallengeTriggerSourceType.AMS.value == value: + return ChallengeTriggerSourceType.AMS + if ChallengeTriggerSourceType.CHANNEL.value == value: + return ChallengeTriggerSourceType.CHANNEL + return None diff --git a/com/alipay/ams/api/model/challenge_type.py b/com/alipay/ams/api/model/challenge_type.py index ff1c2f8..fedb1a9 100644 --- a/com/alipay/ams/api/model/challenge_type.py +++ b/com/alipay/ams/api/model/challenge_type.py @@ -1,14 +1,24 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - from enum import Enum, unique - - @unique class ChallengeType(Enum): + """ChallengeType枚举类""" + SMS_OTP = "SMS_OTP" PLAINTEXT_CARD_NO = "PLAINTEXT_CARD_NO" CARD_EXPIRE_DATE = "CARD_EXPIRE_DATE" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if ChallengeType.SMS_OTP.value == value: + return ChallengeType.SMS_OTP + if ChallengeType.PLAINTEXT_CARD_NO.value == value: + return ChallengeType.PLAINTEXT_CARD_NO + if ChallengeType.CARD_EXPIRE_DATE.value == value: + return ChallengeType.CARD_EXPIRE_DATE + return None diff --git a/com/alipay/ams/api/model/class_type.py b/com/alipay/ams/api/model/class_type.py index c891487..c444536 100644 --- a/com/alipay/ams/api/model/class_type.py +++ b/com/alipay/ams/api/model/class_type.py @@ -1,11 +1,24 @@ from enum import Enum, unique - - @unique class ClassType(Enum): + """ClassType枚举类""" + FIRSTLEVEL = "FIRSTLEVEL" SECONDLEVEL = "SECONDLEVEL" THIRDLEVEL = "THIRDLEVEL" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if ClassType.FIRSTLEVEL.value == value: + return ClassType.FIRSTLEVEL + if ClassType.SECONDLEVEL.value == value: + return ClassType.SECONDLEVEL + if ClassType.THIRDLEVEL.value == value: + return ClassType.THIRDLEVEL + return None diff --git a/com/alipay/ams/api/model/code_detail.py b/com/alipay/ams/api/model/code_detail.py index 29637a5..bcbb237 100644 --- a/com/alipay/ams/api/model/code_detail.py +++ b/com/alipay/ams/api/model/code_detail.py @@ -1,53 +1,71 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - from com.alipay.ams.api.model.code_value_type import CodeValueType from com.alipay.ams.api.model.display_type import DisplayType -class CodeDetail(object): + + +class CodeDetail: def __init__(self): - self.__code_value_type = None # type:CodeValueType - self.__code_value = None - self.__display_type = None # type:DisplayType + + self.__code_value_type = None # type: CodeValueType + self.__code_value = None # type: str + self.__display_type = None # type: DisplayType + @property def code_value_type(self): + """Gets the code_value_type of this CodeDetail. + + """ return self.__code_value_type @code_value_type.setter def code_value_type(self, value): self.__code_value_type = value - @property def code_value(self): + """ + The value of the code. If the value of displayType is set toSMALLIMAGE, MIDDLEIMAGE, or BIGIMAGE, this parameter indicates a plain or Base64-encoded image URL. If the value of displayType is set to TEXT, this parameter indicates a text string. More information: Maximum length: 2048 characters + """ return self.__code_value @code_value.setter def code_value(self, value): self.__code_value = value - @property def display_type(self): + """Gets the display_type of this CodeDetail. + + """ return self.__display_type @display_type.setter def display_type(self, value): self.__display_type = value - def parse_rsp_body(self, code_detail_body): - if type(code_detail_body) == str: - code_detail_body = json.loads(code_detail_body) - if 'codeValueType' in code_detail_body: - code_value_type = CodeValueType.value_of(code_detail_body['codeValueType']) - self.__code_value_type = code_value_type + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "code_value_type") and self.code_value_type is not None: + params['codeValueType'] = self.code_value_type + if hasattr(self, "code_value") and self.code_value is not None: + params['codeValue'] = self.code_value + if hasattr(self, "display_type") and self.display_type is not None: + params['displayType'] = self.display_type + return params - if 'codeValue' in code_detail_body: - self.__code_value = code_detail_body['codeValue'] - if 'displayType' in code_detail_body: - display_type = DisplayType.value_of(code_detail_body['displayType']) - self.__display_type = display_type + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'codeValueType' in response_body: + code_value_type_temp = CodeValueType.value_of(response_body['codeValueType']) + self.__code_value_type = code_value_type_temp + if 'codeValue' in response_body: + self.__code_value = response_body['codeValue'] + if 'displayType' in response_body: + display_type_temp = DisplayType.value_of(response_body['displayType']) + self.__display_type = display_type_temp diff --git a/com/alipay/ams/api/model/code_value_type.py b/com/alipay/ams/api/model/code_value_type.py index 3ab0837..0567bfa 100644 --- a/com/alipay/ams/api/model/code_value_type.py +++ b/com/alipay/ams/api/model/code_value_type.py @@ -1,14 +1,12 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class CodeValueType(Enum): + """CodeValueType枚举类""" + BARCODE = "BARCODE" QRCODE = "QRCODE" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name @staticmethod @@ -18,7 +16,6 @@ def value_of(value): if CodeValueType.BARCODE.value == value: return CodeValueType.BARCODE - elif CodeValueType.QRCODE.value == value: + if CodeValueType.QRCODE.value == value: return CodeValueType.QRCODE - else: - return None + return None diff --git a/com/alipay/ams/api/model/company.py b/com/alipay/ams/api/model/company.py index 384e68b..1ca5afb 100644 --- a/com/alipay/ams/api/model/company.py +++ b/com/alipay/ams/api/model/company.py @@ -1,141 +1,209 @@ -from com.alipay.ams.api.model.companyType import CompanyType +import json +from com.alipay.ams.api.model.company_type import CompanyType from com.alipay.ams.api.model.address import Address -from com.alipay.ams.api.model.attachment import Attachment +from com.alipay.ams.api.model.address import Address +from com.alipay.ams.api.model.stock_info import StockInfo from com.alipay.ams.api.model.certificate import Certificate +from com.alipay.ams.api.model.attachment import Attachment from com.alipay.ams.api.model.company_unit_type import CompanyUnitType from com.alipay.ams.api.model.contact import Contact -from com.alipay.ams.api.model.stock_info import StockInfo + + class Company: def __init__(self): - self.__legal_name = None - self.__company_type = None #type:CompanyType - self.__registered_address = None #type:Address - self.__operating_address = None #type:Address - self.__incorporation_date = None - self.__stock_info = None #type:StockInfo - self.__certificates = None #type:Certificate - self.__attachments = None #type: list[Attachment] - self.__company_unit = None #type: CompanyUnitType - self.__contacts = None #type: list[Contact] - self.__vatNo = None + + self.__legal_name = None # type: str + self.__company_type = None # type: CompanyType + self.__registered_address = None # type: Address + self.__operating_address = None # type: Address + self.__incorporation_date = None # type: str + self.__stock_info = None # type: StockInfo + self.__certificates = None # type: Certificate + self.__attachments = None # type: [Attachment] + self.__company_unit = None # type: CompanyUnitType + self.__contacts = None # type: [Contact] + self.__vat_no = None # type: str + @property def legal_name(self): + """ + The legal name of the company. More information: Maximum size: 256 elements + """ return self.__legal_name @legal_name.setter def legal_name(self, value): self.__legal_name = value - @property def company_type(self): + """Gets the company_type of this Company. + + """ return self.__company_type @company_type.setter def company_type(self, value): self.__company_type = value - @property def registered_address(self): + """Gets the registered_address of this Company. + + """ return self.__registered_address @registered_address.setter def registered_address(self, value): self.__registered_address = value - @property def operating_address(self): + """Gets the operating_address of this Company. + + """ return self.__operating_address @operating_address.setter def operating_address(self, value): self.__operating_address = value - @property def incorporation_date(self): + """ + The date when the company was officially registered and incorporated with the government. The value of this parameter is in the format of YYYY-MM-DD, such as 2023-06-25. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is AU, SG, HK, US, GB, MY, or the company's registered region belongs to the European Union. More information: Maximum length: 32 characters + """ return self.__incorporation_date @incorporation_date.setter def incorporation_date(self, value): self.__incorporation_date = value - @property def stock_info(self): + """Gets the stock_info of this Company. + + """ return self.__stock_info @stock_info.setter def stock_info(self, value): self.__stock_info = value - @property def certificates(self): + """Gets the certificates of this Company. + + """ return self.__certificates @certificates.setter def certificates(self, value): self.__certificates = value - @property def attachments(self): + """ + The list of attachment information. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR, AU, SG, HK, GB, MY, or belongs to the European Union. More information: Maximum size: 10 elements + """ return self.__attachments @attachments.setter def attachments(self, value): self.__attachments = value - @property def company_unit(self): + """Gets the company_unit of this Company. + + """ return self.__company_unit @company_unit.setter def company_unit(self, value): self.__company_unit = value - @property def contacts(self): + """ + A list of contact information. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is JP. + """ return self.__contacts @contacts.setter def contacts(self, value): self.__contacts = value - @property - def vatNo(self): - return self.__vatNo - @vatNo.setter - def vatNo(self, value): - self.__vatNo = value + def vat_no(self): + """ + The Value Added Tax (VAT) number of the company. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is GB or the company's registered region belongs to the European Union. More information: Maximum length: 64 characters + """ + return self.__vat_no + + @vat_no.setter + def vat_no(self, value): + self.__vat_no = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, 'legal_name') and self.legal_name: + if hasattr(self, "legal_name") and self.legal_name is not None: params['legalName'] = self.legal_name - if hasattr(self, 'company_type') and self.company_type: - params['companyType'] = self.company_type.value - if hasattr(self, 'registered_address') and self.registered_address: - params['registeredAddress'] = self.registered_address.to_ams_dict() - if hasattr(self, 'operating_address') and self.operating_address: - params['operatingAddress'] = self.operating_address.to_ams_dict() - if hasattr(self, 'incorporation_date') and self.incorporation_date: + if hasattr(self, "company_type") and self.company_type is not None: + params['companyType'] = self.company_type + if hasattr(self, "registered_address") and self.registered_address is not None: + params['registeredAddress'] = self.registered_address + if hasattr(self, "operating_address") and self.operating_address is not None: + params['operatingAddress'] = self.operating_address + if hasattr(self, "incorporation_date") and self.incorporation_date is not None: params['incorporationDate'] = self.incorporation_date - if hasattr(self, 'stock_info') and self.stock_info: - params['stockInfo'] = self.stock_info.to_ams_dict() - if hasattr(self, 'certificates') and self.certificates: + if hasattr(self, "stock_info") and self.stock_info is not None: + params['stockInfo'] = self.stock_info + if hasattr(self, "certificates") and self.certificates is not None: params['certificates'] = self.certificates - if hasattr(self, 'attachments') and self.attachments: + if hasattr(self, "attachments") and self.attachments is not None: params['attachments'] = self.attachments - for i in range(len(self.attachments)): - params['attachments'][i] = self.attachments[i].to_ams_dict() - params['attachments'] = params['attachments'] - if hasattr(self, 'company_unit') and self.company_unit: - params['companyUnit'] = self.company_unit.value - if hasattr(self, 'contacts') and self.contacts: + if hasattr(self, "company_unit") and self.company_unit is not None: + params['companyUnit'] = self.company_unit + if hasattr(self, "contacts") and self.contacts is not None: params['contacts'] = self.contacts - for i in range(len(self.contacts)): - params['contacts'][i] = self.contacts[i].to_ams_dict() - params['contacts'] = params['contacts'] - if hasattr(self, 'vatNo') and self.vatNo: - params['vatNo'] = self.vatNo + if hasattr(self, "vat_no") and self.vat_no is not None: + params['vatNo'] = self.vat_no return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'legalName' in response_body: + self.__legal_name = response_body['legalName'] + if 'companyType' in response_body: + company_type_temp = CompanyType.value_of(response_body['companyType']) + self.__company_type = company_type_temp + if 'registeredAddress' in response_body: + self.__registered_address = Address() + self.__registered_address.parse_rsp_body(response_body['registeredAddress']) + if 'operatingAddress' in response_body: + self.__operating_address = Address() + self.__operating_address.parse_rsp_body(response_body['operatingAddress']) + if 'incorporationDate' in response_body: + self.__incorporation_date = response_body['incorporationDate'] + if 'stockInfo' in response_body: + self.__stock_info = StockInfo() + self.__stock_info.parse_rsp_body(response_body['stockInfo']) + if 'certificates' in response_body: + self.__certificates = Certificate() + self.__certificates.parse_rsp_body(response_body['certificates']) + if 'attachments' in response_body: + self.__attachments = [] + for item in response_body['attachments']: + obj = Attachment() + obj.parse_rsp_body(item) + self.__attachments.append(obj) + if 'companyUnit' in response_body: + company_unit_temp = CompanyUnitType.value_of(response_body['companyUnit']) + self.__company_unit = company_unit_temp + if 'contacts' in response_body: + self.__contacts = [] + for item in response_body['contacts']: + obj = Contact() + obj.parse_rsp_body(item) + self.__contacts.append(obj) + if 'vatNo' in response_body: + self.__vat_no = response_body['vatNo'] diff --git a/com/alipay/ams/api/model/company_type.py b/com/alipay/ams/api/model/company_type.py new file mode 100644 index 0000000..dbda004 --- /dev/null +++ b/com/alipay/ams/api/model/company_type.py @@ -0,0 +1,51 @@ +from enum import Enum, unique +@unique +class CompanyType(Enum): + """CompanyType枚举类""" + + ENTERPRISE = "ENTERPRISE" + PARTNERSHIP = "PARTNERSHIP" + SOLE_PROPRIETORSHIP = "SOLE_PROPRIETORSHIP" + STATE_OWNED_BUSINESS = "STATE_OWNED_BUSINESS" + PRIVATELY_OWNED_BUSINESS = "PRIVATELY_OWNED_BUSINESS" + PUBLICLY_LISTED_BUSINESS = "PUBLICLY_LISTED_BUSINESS" + LTDA = "LTDA" + SA = "SA" + EIRELI = "EIRELI" + BOFC = "BOFC" + MEI = "MEI" + EI = "EI" + + def to_ams_dict(self) -> str: + return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if CompanyType.ENTERPRISE.value == value: + return CompanyType.ENTERPRISE + if CompanyType.PARTNERSHIP.value == value: + return CompanyType.PARTNERSHIP + if CompanyType.SOLE_PROPRIETORSHIP.value == value: + return CompanyType.SOLE_PROPRIETORSHIP + if CompanyType.STATE_OWNED_BUSINESS.value == value: + return CompanyType.STATE_OWNED_BUSINESS + if CompanyType.PRIVATELY_OWNED_BUSINESS.value == value: + return CompanyType.PRIVATELY_OWNED_BUSINESS + if CompanyType.PUBLICLY_LISTED_BUSINESS.value == value: + return CompanyType.PUBLICLY_LISTED_BUSINESS + if CompanyType.LTDA.value == value: + return CompanyType.LTDA + if CompanyType.SA.value == value: + return CompanyType.SA + if CompanyType.EIRELI.value == value: + return CompanyType.EIRELI + if CompanyType.BOFC.value == value: + return CompanyType.BOFC + if CompanyType.MEI.value == value: + return CompanyType.MEI + if CompanyType.EI.value == value: + return CompanyType.EI + return None diff --git a/com/alipay/ams/api/model/company_unit_type.py b/com/alipay/ams/api/model/company_unit_type.py index 18193d6..b9aecb5 100644 --- a/com/alipay/ams/api/model/company_unit_type.py +++ b/com/alipay/ams/api/model/company_unit_type.py @@ -1,10 +1,21 @@ from enum import Enum, unique - - @unique class CompanyUnitType(Enum): + """CompanyUnitType枚举类""" + HEADQUARTER = "HEADQUARTER" BRANCH = "BRANCH" - def to_ams_dict(self): - return self.name \ No newline at end of file + def to_ams_dict(self) -> str: + return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if CompanyUnitType.HEADQUARTER.value == value: + return CompanyUnitType.HEADQUARTER + if CompanyUnitType.BRANCH.value == value: + return CompanyUnitType.BRANCH + return None diff --git a/com/alipay/ams/api/model/contact.py b/com/alipay/ams/api/model/contact.py index 0454748..5b88678 100644 --- a/com/alipay/ams/api/model/contact.py +++ b/com/alipay/ams/api/model/contact.py @@ -1,27 +1,99 @@ +import json +from com.alipay.ams.api.model.contact_type import ContactType + + + class Contact: def __init__(self): - self.__type = None - self.__info = None + + self.__type = None # type: ContactType + self.__info = None # type: str + self.__home = None # type: str + self.__work = None # type: str + self.__mobile = None # type: str + - def set_type(self, type): - self.__type = type - - def get_type(self): + @property + def type(self): + """Gets the type of this Contact. + + """ return self.__type - def set_info(self, info): - self.__info = info - - def get_info(self): + @type.setter + def type(self, value): + self.__type = value + @property + def info(self): + """ + The contact details of a specific contact type. More information: Maximum length: 256 characters + """ return self.__info + @info.setter + def info(self, value): + self.__info = value + @property + def home(self): + """Gets the home of this Contact. + + """ + return self.__home + + @home.setter + def home(self, value): + self.__home = value + @property + def work(self): + """Gets the work of this Contact. + + """ + return self.__work + + @work.setter + def work(self, value): + self.__work = value + @property + def mobile(self): + """Gets the mobile of this Contact. + + """ + return self.__mobile + + @mobile.setter + def mobile(self, value): + self.__mobile = value + + + + def to_ams_dict(self): params = dict() - if hasattr(self, 'type') and self.__type: - params['type'] = self.__type + if hasattr(self, "type") and self.type is not None: + params['type'] = self.type + if hasattr(self, "info") and self.info is not None: + params['info'] = self.info + if hasattr(self, "home") and self.home is not None: + params['home'] = self.home + if hasattr(self, "work") and self.work is not None: + params['work'] = self.work + if hasattr(self, "mobile") and self.mobile is not None: + params['mobile'] = self.mobile + return params - if hasattr(self, 'info') and self.__info: - params['info'] = self.__info - return params \ No newline at end of file + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'type' in response_body: + type_temp = ContactType.value_of(response_body['type']) + self.__type = type_temp + if 'info' in response_body: + self.__info = response_body['info'] + if 'home' in response_body: + self.__home = response_body['home'] + if 'work' in response_body: + self.__work = response_body['work'] + if 'mobile' in response_body: + self.__mobile = response_body['mobile'] diff --git a/com/alipay/ams/api/model/contact_type.py b/com/alipay/ams/api/model/contact_type.py new file mode 100644 index 0000000..aa873a0 --- /dev/null +++ b/com/alipay/ams/api/model/contact_type.py @@ -0,0 +1,24 @@ +from enum import Enum, unique +@unique +class ContactType(Enum): + """ContactType枚举类""" + + EMAIL = "EMAIL" + PHONE_NO = "PHONE_NO" + COMMERCIAL_PHONE_NO = "COMMERCIAL_PHONE_NO" + + def to_ams_dict(self) -> str: + return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if ContactType.EMAIL.value == value: + return ContactType.EMAIL + if ContactType.PHONE_NO.value == value: + return ContactType.PHONE_NO + if ContactType.COMMERCIAL_PHONE_NO.value == value: + return ContactType.COMMERCIAL_PHONE_NO + return None diff --git a/com/alipay/ams/api/model/coupon_payment_method_detail.py b/com/alipay/ams/api/model/coupon_payment_method_detail.py index 62a8805..fe4536a 100644 --- a/com/alipay/ams/api/model/coupon_payment_method_detail.py +++ b/com/alipay/ams/api/model/coupon_payment_method_detail.py @@ -1,107 +1,114 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - from com.alipay.ams.api.model.amount import Amount -class CouponPaymentMethodDetail(object): + +class CouponPaymentMethodDetail: def __init__(self): - self.__coupon_id = None + + self.__coupon_id = None # type: str self.__available_amount = None # type: Amount - self.__coupon_name = None - self.__coupon_description = None - self.__coupon_expire_time = None - self.__payment_method_detail_metadata = None + self.__coupon_name = None # type: str + self.__coupon_description = None # type: str + self.__coupon_expire_time = None # type: str + self.__payment_method_detail_metadata = None # type: str + @property def coupon_id(self): + """Gets the coupon_id of this CouponPaymentMethodDetail. + + """ return self.__coupon_id - @coupon_id.setter def coupon_id(self, value): self.__coupon_id = value - @property def available_amount(self): + """Gets the available_amount of this CouponPaymentMethodDetail. + + """ return self.__available_amount @available_amount.setter def available_amount(self, value): self.__available_amount = value - @property def coupon_name(self): + """Gets the coupon_name of this CouponPaymentMethodDetail. + + """ return self.__coupon_name - @coupon_name.setter def coupon_name(self, value): self.__coupon_name = value - @property def coupon_description(self): + """Gets the coupon_description of this CouponPaymentMethodDetail. + + """ return self.__coupon_description - @coupon_description.setter def coupon_description(self, value): self.__coupon_description = value - @property def coupon_expire_time(self): + """Gets the coupon_expire_time of this CouponPaymentMethodDetail. + + """ return self.__coupon_expire_time @coupon_expire_time.setter def coupon_expire_time(self, value): self.__coupon_expire_time = value - @property def payment_method_detail_metadata(self): + """Gets the payment_method_detail_metadata of this CouponPaymentMethodDetail. + + """ return self.__payment_method_detail_metadata + @payment_method_detail_metadata.setter def payment_method_detail_metadata(self, value): self.__payment_method_detail_metadata = value + + + def to_ams_dict(self): params = dict() - if self.__coupon_id: - params['couponId'] = self.__coupon_id - if self.__available_amount: - params['availableAmount'] = self.__available_amount.to_ams_dict() - if self.__coupon_name: - params['couponName'] = self.__coupon_name - if self.__coupon_description: - params['couponDescription'] = self.__coupon_description - if self.__coupon_expire_time: - params['couponExpireTime'] = self.__coupon_expire_time - if self.__payment_method_detail_metadata: - params['paymentMethodDetailMetadata'] = self.__payment_method_detail_metadata + if hasattr(self, "coupon_id") and self.coupon_id is not None: + params['couponId'] = self.coupon_id + if hasattr(self, "available_amount") and self.available_amount is not None: + params['availableAmount'] = self.available_amount + if hasattr(self, "coupon_name") and self.coupon_name is not None: + params['couponName'] = self.coupon_name + if hasattr(self, "coupon_description") and self.coupon_description is not None: + params['couponDescription'] = self.coupon_description + if hasattr(self, "coupon_expire_time") and self.coupon_expire_time is not None: + params['couponExpireTime'] = self.coupon_expire_time + if hasattr(self, "payment_method_detail_metadata") and self.payment_method_detail_metadata is not None: + params['paymentMethodDetailMetadata'] = self.payment_method_detail_metadata return params - def parse_rsp_body(self, coupon_payment_method_detail_body): - if type(coupon_payment_method_detail_body) == str: - coupon_payment_method_detail_body = json.loads(coupon_payment_method_detail_body) - - if 'couponId' in coupon_payment_method_detail_body: - self.__coupon_id = coupon_payment_method_detail_body['couponId'] - - if 'availableAmount' in coupon_payment_method_detail_body: - available_amount = Amount() - available_amount.parse_rsp_body(coupon_payment_method_detail_body['availableAmount']) - self.__available_amount = available_amount - - if 'couponName' in coupon_payment_method_detail_body: - self.__coupon_name = coupon_payment_method_detail_body['couponName'] - - if 'couponDescription' in coupon_payment_method_detail_body: - self.__coupon_description = coupon_payment_method_detail_body['couponDescription'] - - if 'couponExpireTime' in coupon_payment_method_detail_body: - self.__coupon_expire_time = coupon_payment_method_detail_body['couponExpireTime'] - if 'paymentMethodDetailMetadata' in coupon_payment_method_detail_body: - self.__payment_method_detail_metadata = coupon_payment_method_detail_body['paymentMethodDetailMetadata'] + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'couponId' in response_body: + self.__coupon_id = response_body['couponId'] + if 'availableAmount' in response_body: + self.__available_amount = Amount() + self.__available_amount.parse_rsp_body(response_body['availableAmount']) + if 'couponName' in response_body: + self.__coupon_name = response_body['couponName'] + if 'couponDescription' in response_body: + self.__coupon_description = response_body['couponDescription'] + if 'couponExpireTime' in response_body: + self.__coupon_expire_time = response_body['couponExpireTime'] + if 'paymentMethodDetailMetadata' in response_body: + self.__payment_method_detail_metadata = response_body['paymentMethodDetailMetadata'] diff --git a/com/alipay/ams/api/model/credit_pay_fee_type.py b/com/alipay/ams/api/model/credit_pay_fee_type.py index 46e8b2f..1d6d522 100644 --- a/com/alipay/ams/api/model/credit_pay_fee_type.py +++ b/com/alipay/ams/api/model/credit_pay_fee_type.py @@ -1,9 +1,18 @@ from enum import Enum, unique - - @unique class CreditPayFeeType(Enum): + """CreditPayFeeType枚举类""" + PERCENTAGE = "PERCENTAGE" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if CreditPayFeeType.PERCENTAGE.value == value: + return CreditPayFeeType.PERCENTAGE + return None diff --git a/com/alipay/ams/api/model/credit_pay_plan.py b/com/alipay/ams/api/model/credit_pay_plan.py index 4027061..c08329b 100644 --- a/com/alipay/ams/api/model/credit_pay_plan.py +++ b/com/alipay/ams/api/model/credit_pay_plan.py @@ -1,41 +1,84 @@ -class CreditPayPlan(object): +import json +from com.alipay.ams.api.model.credit_pay_fee_type import CreditPayFeeType + + + + +class CreditPayPlan: def __init__(self): - self.__installment_num = None - self.__credit_pay_fee_type = None - self.__fee_percentage = None + + self.__installment_num = None # type: int + self.__interval = None # type: str + self.__credit_pay_fee_type = None # type: CreditPayFeeType + self.__fee_percentage = None # type: int + @property def installment_num(self): + """Gets the installment_num of this CreditPayPlan. + + """ return self.__installment_num - @property - def credit_pay_fee_type(self): - return self.__credit_pay_fee_type - - @property - def fee_percentage(self): - return self.__fee_percentage - @installment_num.setter def installment_num(self, value): self.__installment_num = value + @property + def interval(self): + """Gets the interval of this CreditPayPlan. + + """ + return self.__interval + + @interval.setter + def interval(self, value): + self.__interval = value + @property + def credit_pay_fee_type(self): + """Gets the credit_pay_fee_type of this CreditPayPlan. + + """ + return self.__credit_pay_fee_type @credit_pay_fee_type.setter def credit_pay_fee_type(self, value): self.__credit_pay_fee_type = value + @property + def fee_percentage(self): + """Gets the fee_percentage of this CreditPayPlan. + + """ + return self.__fee_percentage @fee_percentage.setter def fee_percentage(self, value): self.__fee_percentage = value + + + def to_ams_dict(self): params = dict() - - if hasattr(self, "installment_num") and self.installment_num: + if hasattr(self, "installment_num") and self.installment_num is not None: params['installmentNum'] = self.installment_num - if hasattr(self, "credit_pay_fee_type") and self.credit_pay_fee_type: + if hasattr(self, "interval") and self.interval is not None: + params['interval'] = self.interval + if hasattr(self, "credit_pay_fee_type") and self.credit_pay_fee_type is not None: params['creditPayFeeType'] = self.credit_pay_fee_type - if hasattr(self, "fee_percentage") and self.fee_percentage: + if hasattr(self, "fee_percentage") and self.fee_percentage is not None: params['feePercentage'] = self.fee_percentage - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'installmentNum' in response_body: + self.__installment_num = response_body['installmentNum'] + if 'interval' in response_body: + self.__interval = response_body['interval'] + if 'creditPayFeeType' in response_body: + credit_pay_fee_type_temp = CreditPayFeeType.value_of(response_body['creditPayFeeType']) + self.__credit_pay_fee_type = credit_pay_fee_type_temp + if 'feePercentage' in response_body: + self.__fee_percentage = response_body['feePercentage'] diff --git a/com/alipay/ams/api/model/customer_belongs_to.py b/com/alipay/ams/api/model/customer_belongs_to.py index 60a4640..a761902 100644 --- a/com/alipay/ams/api/model/customer_belongs_to.py +++ b/com/alipay/ams/api/model/customer_belongs_to.py @@ -1,10 +1,9 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class CustomerBelongsTo(Enum): + """CustomerBelongsTo枚举类""" + + RABBIT_LINE_PAY = "RABBIT_LINE_PAY" TRUEMONEY = "TRUEMONEY" ALIPAY_HK = "ALIPAY_HK" TNG = "TNG" @@ -14,34 +13,81 @@ class CustomerBelongsTo(Enum): KAKAOPAY = "KAKAOPAY" BKASH = "BKASH" EASYPAISA = "EASYPAISA" - - RABBIT_LINE_PAY = "RABBIT_LINE_PAY" - PAYPAY = "PAYPAY" - BOOST = "BOOST" - GRABPAY_MY = "GRABPAY_MY" - MAYA = "MAYA" - GRABPAY_PH = "GRABPAY_PH" - GRABPAY_SG = "GRABPAY_SG" - NAVERPAY = "NAVERPAY" - JKOPAY = "JKOPAY" - KPLUS = "KPLUS" - DIRECT_DEBIT_SIAMCOMMERCIALBANK = "DIRECT_DEBIT_SIAMCOMMERCIALBANK" - DIRECT_DEBIT_KRUNGTHAIBANK = "DIRECT_DEBIT_KRUNGTHAIBANK" - ZALOPAY = "ZALOPAY" + DIRECTDEBIT_YAPILY = "DIRECTDEBIT_YAPILY" + TOSSPAY = "TOSSPAY" + MOMO = "MOMO" + ANTOM_BIZ_ACCOUNT = "ANTOM_BIZ_ACCOUNT" - DIRECTDEBIT_YAPILY = "DIRECTDEBIT_YAPILY " - - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if CustomerBelongsTo.RABBIT_LINE_PAY.value == value: + return CustomerBelongsTo.RABBIT_LINE_PAY + if CustomerBelongsTo.TRUEMONEY.value == value: + return CustomerBelongsTo.TRUEMONEY + if CustomerBelongsTo.ALIPAY_HK.value == value: + return CustomerBelongsTo.ALIPAY_HK + if CustomerBelongsTo.TNG.value == value: + return CustomerBelongsTo.TNG + if CustomerBelongsTo.ALIPAY_CN.value == value: + return CustomerBelongsTo.ALIPAY_CN + if CustomerBelongsTo.GCASH.value == value: + return CustomerBelongsTo.GCASH + if CustomerBelongsTo.DANA.value == value: + return CustomerBelongsTo.DANA + if CustomerBelongsTo.KAKAOPAY.value == value: + return CustomerBelongsTo.KAKAOPAY + if CustomerBelongsTo.BKASH.value == value: + return CustomerBelongsTo.BKASH + if CustomerBelongsTo.EASYPAISA.value == value: + return CustomerBelongsTo.EASYPAISA + if CustomerBelongsTo.PAYPAY.value == value: + return CustomerBelongsTo.PAYPAY + if CustomerBelongsTo.BOOST.value == value: + return CustomerBelongsTo.BOOST + if CustomerBelongsTo.GRABPAY_MY.value == value: + return CustomerBelongsTo.GRABPAY_MY + if CustomerBelongsTo.MAYA.value == value: + return CustomerBelongsTo.MAYA + if CustomerBelongsTo.GRABPAY_PH.value == value: + return CustomerBelongsTo.GRABPAY_PH + if CustomerBelongsTo.GRABPAY_SG.value == value: + return CustomerBelongsTo.GRABPAY_SG + if CustomerBelongsTo.NAVERPAY.value == value: + return CustomerBelongsTo.NAVERPAY + if CustomerBelongsTo.JKOPAY.value == value: + return CustomerBelongsTo.JKOPAY + if CustomerBelongsTo.KPLUS.value == value: + return CustomerBelongsTo.KPLUS + if CustomerBelongsTo.DIRECT_DEBIT_SIAMCOMMERCIALBANK.value == value: + return CustomerBelongsTo.DIRECT_DEBIT_SIAMCOMMERCIALBANK + if CustomerBelongsTo.DIRECT_DEBIT_KRUNGTHAIBANK.value == value: + return CustomerBelongsTo.DIRECT_DEBIT_KRUNGTHAIBANK + if CustomerBelongsTo.ZALOPAY.value == value: + return CustomerBelongsTo.ZALOPAY + if CustomerBelongsTo.DIRECTDEBIT_YAPILY.value == value: + return CustomerBelongsTo.DIRECTDEBIT_YAPILY + if CustomerBelongsTo.TOSSPAY.value == value: + return CustomerBelongsTo.TOSSPAY + if CustomerBelongsTo.MOMO.value == value: + return CustomerBelongsTo.MOMO + if CustomerBelongsTo.ANTOM_BIZ_ACCOUNT.value == value: + return CustomerBelongsTo.ANTOM_BIZ_ACCOUNT + return None diff --git a/com/alipay/ams/api/model/customized_info.py b/com/alipay/ams/api/model/customized_info.py new file mode 100644 index 0000000..c395db6 --- /dev/null +++ b/com/alipay/ams/api/model/customized_info.py @@ -0,0 +1,97 @@ +import json + + + + +class CustomizedInfo: + def __init__(self): + + self.__customized_field1 = None # type: str + self.__customized_field2 = None # type: str + self.__customized_field3 = None # type: str + self.__customized_field4 = None # type: str + self.__customized_field5 = None # type: str + + + @property + def customized_field1(self): + """Gets the customized_field1 of this CustomizedInfo. + + """ + return self.__customized_field1 + + @customized_field1.setter + def customized_field1(self, value): + self.__customized_field1 = value + @property + def customized_field2(self): + """Gets the customized_field2 of this CustomizedInfo. + + """ + return self.__customized_field2 + + @customized_field2.setter + def customized_field2(self, value): + self.__customized_field2 = value + @property + def customized_field3(self): + """Gets the customized_field3 of this CustomizedInfo. + + """ + return self.__customized_field3 + + @customized_field3.setter + def customized_field3(self, value): + self.__customized_field3 = value + @property + def customized_field4(self): + """Gets the customized_field4 of this CustomizedInfo. + + """ + return self.__customized_field4 + + @customized_field4.setter + def customized_field4(self, value): + self.__customized_field4 = value + @property + def customized_field5(self): + """Gets the customized_field5 of this CustomizedInfo. + + """ + return self.__customized_field5 + + @customized_field5.setter + def customized_field5(self, value): + self.__customized_field5 = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "customized_field1") and self.customized_field1 is not None: + params['customizedField1'] = self.customized_field1 + if hasattr(self, "customized_field2") and self.customized_field2 is not None: + params['customizedField2'] = self.customized_field2 + if hasattr(self, "customized_field3") and self.customized_field3 is not None: + params['customizedField3'] = self.customized_field3 + if hasattr(self, "customized_field4") and self.customized_field4 is not None: + params['customizedField4'] = self.customized_field4 + if hasattr(self, "customized_field5") and self.customized_field5 is not None: + params['customizedField5'] = self.customized_field5 + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'customizedField1' in response_body: + self.__customized_field1 = response_body['customizedField1'] + if 'customizedField2' in response_body: + self.__customized_field2 = response_body['customizedField2'] + if 'customizedField3' in response_body: + self.__customized_field3 = response_body['customizedField3'] + if 'customizedField4' in response_body: + self.__customized_field4 = response_body['customizedField4'] + if 'customizedField5' in response_body: + self.__customized_field5 = response_body['customizedField5'] diff --git a/com/alipay/ams/api/model/delivery_estimate.py b/com/alipay/ams/api/model/delivery_estimate.py index bc3cb03..cc9785c 100644 --- a/com/alipay/ams/api/model/delivery_estimate.py +++ b/com/alipay/ams/api/model/delivery_estimate.py @@ -1,23 +1,32 @@ +import json +from com.alipay.ams.api.model.delivery_estimate_info import DeliveryEstimateInfo from com.alipay.ams.api.model.delivery_estimate_info import DeliveryEstimateInfo -class DeliveryEstimate(object): - def __init__(self): - self.__minimum = None #type: DeliveryEstimateInfo - self.__maximum = None #type: DeliveryEstimateInfo +class DeliveryEstimate: + def __init__(self): + + self.__minimum = None # type: DeliveryEstimateInfo + self.__maximum = None # type: DeliveryEstimateInfo + + @property def minimum(self): + """Gets the minimum of this DeliveryEstimate. + + """ return self.__minimum @minimum.setter def minimum(self, value): self.__minimum = value - - @property def maximum(self): + """Gets the maximum of this DeliveryEstimate. + + """ return self.__maximum @maximum.setter @@ -25,9 +34,23 @@ def maximum(self, value): self.__maximum = value + + def to_ams_dict(self): params = dict() - if self.minimum is not None: - params['minimum'] = self.minimum.to_ams_dict() - if self.maximum is not None: - params['maximum'] = self.maximum.to_ams_dict() \ No newline at end of file + if hasattr(self, "minimum") and self.minimum is not None: + params['minimum'] = self.minimum + if hasattr(self, "maximum") and self.maximum is not None: + params['maximum'] = self.maximum + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'minimum' in response_body: + self.__minimum = DeliveryEstimateInfo() + self.__minimum.parse_rsp_body(response_body['minimum']) + if 'maximum' in response_body: + self.__maximum = DeliveryEstimateInfo() + self.__maximum.parse_rsp_body(response_body['maximum']) diff --git a/com/alipay/ams/api/model/delivery_estimate_info.py b/com/alipay/ams/api/model/delivery_estimate_info.py index 4b4103b..a666200 100644 --- a/com/alipay/ams/api/model/delivery_estimate_info.py +++ b/com/alipay/ams/api/model/delivery_estimate_info.py @@ -1,21 +1,30 @@ +import json -class DeliveryEstimateInfo(object): + +class DeliveryEstimateInfo: def __init__(self): - self.__unit = None - self.__value = None + + self.__unit = None # type: str + self.__value = None # type: int + @property def unit(self): + """ + Units for the longest shipping time of logistics services. The valid values include: YEAR: Indicates that the shortest shipping time unit for logistics services is in years. MONTH: Indicates that the shortest shipping time unit for logistics services is in months. DAY: Indicates that the shortest shipping time unit for logistics services is in days. HOUR: Indicates that the shortest shipping time unit for logistics services is in hours. MINUTE: Indicates that the shortest shipping time unit for logistics services is in minutes. SECOND: Indicates that the shortest shipping time unit for logistics services is in seconds. More information: Maximum length: 16 characters + """ return self.__unit @unit.setter def unit(self, value): self.__unit = value - @property def value(self): + """ + Estimated value for the longest shipping time of logistics services. More information: Value range: [0, +∞) + """ return self.__value @value.setter @@ -23,10 +32,21 @@ def value(self, value): self.__value = value + + def to_ams_dict(self): params = dict() - if self.unit is not None: + if hasattr(self, "unit") and self.unit is not None: params['unit'] = self.unit - if self.value is not None: + if hasattr(self, "value") and self.value is not None: params['value'] = self.value - return params \ No newline at end of file + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'unit' in response_body: + self.__unit = response_body['unit'] + if 'value' in response_body: + self.__value = response_body['value'] diff --git a/com/alipay/ams/api/model/discount.py b/com/alipay/ams/api/model/discount.py index 0ae82a0..76a0223 100644 --- a/com/alipay/ams/api/model/discount.py +++ b/com/alipay/ams/api/model/discount.py @@ -1,113 +1,86 @@ import json - from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.amount import Amount + -class Discount(object): +class Discount: def __init__(self): - self.__discount_tag = None - self.__discount_name = None + + self.__discount_tag = None # type: str + self.__discount_name = None # type: str self.__savings_amount = None # type: Amount self.__estimate_savings_amount = None # type: Amount - self.__promotion_code = None + @property def discount_tag(self): + """Gets the discount_tag of this Discount. + + """ return self.__discount_tag @discount_tag.setter def discount_tag(self, value): self.__discount_tag = value - @property def discount_name(self): + """ + The discount name displayed in the default language. More information: Maximum length: 128 characters + """ return self.__discount_name @discount_name.setter def discount_name(self, value): self.__discount_name = value - @property def savings_amount(self): + """Gets the savings_amount of this Discount. + + """ return self.__savings_amount @savings_amount.setter def savings_amount(self, value): self.__savings_amount = value - @property def estimate_savings_amount(self): + """Gets the estimate_savings_amount of this Discount. + + """ return self.__estimate_savings_amount @estimate_savings_amount.setter def estimate_savings_amount(self, value): self.__estimate_savings_amount = value - @property - def promotion_code(self): - return self.__promotion_code - - @promotion_code.setter - def promotion_code(self, value): - self.__promotion_code = value - - @property - def savingsAmount(self): - return self.__savings_amount - @savingsAmount.setter - def savingsAmount(self, value): - self.__savings_amount = value - - @property - def estimateSavingsAmount(self): - return self.__estimate_savings_amount - - @estimateSavingsAmount.setter - def estimateSavingsAmount(self, value): - self.__estimate_savings_amount = value - - @property - def promotionCode(self): - return self.__promotion_code - - @promotionCode.setter - def promotionCode(self, value): - self.__promotion_code = value + def to_ams_dict(self): params = dict() - if self.discountTag is not None: + if hasattr(self, "discount_tag") and self.discount_tag is not None: params['discountTag'] = self.discount_tag - if self.discountName is not None: + if hasattr(self, "discount_name") and self.discount_name is not None: params['discountName'] = self.discount_name - if self.savingsAmount is not None: - params['savingsAmount'] = self.savings_amount.to_ams_dict() - if self.estimateSavingsAmount is not None: - params['estimateSavingsAmount'] = self.estimate_savings_amount.to_ams_dict() - if self.promotionCode is not None: - params['promotionCode'] = self.promotion_code + if hasattr(self, "savings_amount") and self.savings_amount is not None: + params['savingsAmount'] = self.savings_amount + if hasattr(self, "estimate_savings_amount") and self.estimate_savings_amount is not None: + params['estimateSavingsAmount'] = self.estimate_savings_amount return params - def parse_rsp_body(self, discount_body): - if type(discount_body) == str: - discount_body = json.loads(discount_body) - - if 'discountTag' in discount_body: - self.discount_tag = discount_body['discountTag'] - - if 'discountName' in discount_body: - self.discount_name = discount_body['discountName'] - - if 'savingsAmount' in discount_body: - payment_amount = Amount() - payment_amount.parse_rsp_body(discount_body['savingsAmount']) - self.savings_amount = payment_amount - if 'estimateSavingsAmount' in discount_body: - payment_amount = Amount() - payment_amount.parse_rsp_body(discount_body['estimateSavingsAmount']) - self.estimate_savings_amount = payment_amount - if 'promotionCode' in discount_body: - self.promotion_code = discount_body['promotionCode'] + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'discountTag' in response_body: + self.__discount_tag = response_body['discountTag'] + if 'discountName' in response_body: + self.__discount_name = response_body['discountName'] + if 'savingsAmount' in response_body: + self.__savings_amount = Amount() + self.__savings_amount.parse_rsp_body(response_body['savingsAmount']) + if 'estimateSavingsAmount' in response_body: + self.__estimate_savings_amount = Amount() + self.__estimate_savings_amount.parse_rsp_body(response_body['estimateSavingsAmount']) diff --git a/com/alipay/ams/api/model/discount_payment_method_detail.py b/com/alipay/ams/api/model/discount_payment_method_detail.py index 46ee860..f2ee819 100644 --- a/com/alipay/ams/api/model/discount_payment_method_detail.py +++ b/com/alipay/ams/api/model/discount_payment_method_detail.py @@ -1,94 +1,99 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - from com.alipay.ams.api.model.amount import Amount -class DiscountPaymentMethodDetail(object): + +class DiscountPaymentMethodDetail: def __init__(self): - self.__discount_id = None + + self.__discount_id = None # type: str self.__available_amount = None # type: Amount - self.__discount_name = None - self.__discount_description = None - self.__payment_method_detail_metadata = None + self.__discount_name = None # type: str + self.__discount_description = None # type: str + self.__payment_method_detail_metadata = None # type: str + @property def discount_id(self): + """Gets the discount_id of this DiscountPaymentMethodDetail. + + """ return self.__discount_id @discount_id.setter def discount_id(self, value): self.__discount_id = value - - @property - def discount_name(self): - return self.__discount_name - - - @discount_name.setter - def discount_name(self, value): - self.__discount_name = value - @property def available_amount(self): + """Gets the available_amount of this DiscountPaymentMethodDetail. + + """ return self.__available_amount @available_amount.setter def available_amount(self, value): self.__available_amount = value + @property + def discount_name(self): + """Gets the discount_name of this DiscountPaymentMethodDetail. + + """ + return self.__discount_name + @discount_name.setter + def discount_name(self, value): + self.__discount_name = value @property def discount_description(self): + """Gets the discount_description of this DiscountPaymentMethodDetail. + + """ return self.__discount_description - @discount_description.setter def discount_description(self, value): self.__discount_description = value - @property def payment_method_detail_metadata(self): + """Gets the payment_method_detail_metadata of this DiscountPaymentMethodDetail. + + """ return self.__payment_method_detail_metadata - @payment_method_detail_metadata.setter def payment_method_detail_metadata(self, value): self.__payment_method_detail_metadata = value - def parse_rsp_body(self, external_payment_method_detail_body): - if type(external_payment_method_detail_body) == str: - external_payment_method_detail_body = json.loads(external_payment_method_detail_body) - - if 'discountId' in external_payment_method_detail_body: - self.__discount_id = external_payment_method_detail_body['discountId'] - - if 'availableAmount' in external_payment_method_detail_body: - available_amount = Amount() - available_amount.parse_rsp_body(external_payment_method_detail_body['availableAmount']) - self.__available_amount = available_amount - - if 'discountName' in external_payment_method_detail_body: - self.__discount_name = external_payment_method_detail_body['discountName'] - if 'discountDescription' in external_payment_method_detail_body: - self.__discount_description = external_payment_method_detail_body['discountDescription'] - - if 'paymentMethodDetailMetadata' in external_payment_method_detail_body: - self.__payment_method_detail_metadata = external_payment_method_detail_body['paymentMethodDetailMetadata'] + def to_ams_dict(self): params = dict() - if self.discount_id: + if hasattr(self, "discount_id") and self.discount_id is not None: params['discountId'] = self.discount_id - if self.available_amount: - params['availableAmount'] = self.available_amount.to_ams_dict() - if self.discount_name: + if hasattr(self, "available_amount") and self.available_amount is not None: + params['availableAmount'] = self.available_amount + if hasattr(self, "discount_name") and self.discount_name is not None: params['discountName'] = self.discount_name - if self.discount_description: + if hasattr(self, "discount_description") and self.discount_description is not None: params['discountDescription'] = self.discount_description - if self.payment_method_detail_metadata: + if hasattr(self, "payment_method_detail_metadata") and self.payment_method_detail_metadata is not None: params['paymentMethodDetailMetadata'] = self.payment_method_detail_metadata return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'discountId' in response_body: + self.__discount_id = response_body['discountId'] + if 'availableAmount' in response_body: + self.__available_amount = Amount() + self.__available_amount.parse_rsp_body(response_body['availableAmount']) + if 'discountName' in response_body: + self.__discount_name = response_body['discountName'] + if 'discountDescription' in response_body: + self.__discount_description = response_body['discountDescription'] + if 'paymentMethodDetailMetadata' in response_body: + self.__payment_method_detail_metadata = response_body['paymentMethodDetailMetadata'] diff --git a/com/alipay/ams/api/model/display_type.py b/com/alipay/ams/api/model/display_type.py index a31955c..56828e8 100644 --- a/com/alipay/ams/api/model/display_type.py +++ b/com/alipay/ams/api/model/display_type.py @@ -1,17 +1,15 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class DisplayType(Enum): + """DisplayType枚举类""" + TEXT = "TEXT" MIDDLEIMAGE = "MIDDLEIMAGE" SMALLIMAGE = "SMALLIMAGE" BIGIMAGE = "BIGIMAGE" IMAGE = "IMAGE" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name @staticmethod @@ -21,13 +19,12 @@ def value_of(value): if DisplayType.TEXT.value == value: return DisplayType.TEXT - elif DisplayType.MIDDLEIMAGE.value == value: + if DisplayType.MIDDLEIMAGE.value == value: return DisplayType.MIDDLEIMAGE - elif DisplayType.SMALLIMAGE.value == value: + if DisplayType.SMALLIMAGE.value == value: return DisplayType.SMALLIMAGE - elif DisplayType.BIGIMAGE.value == value: + if DisplayType.BIGIMAGE.value == value: return DisplayType.BIGIMAGE - elif DisplayType.IMAGE.value == value: + if DisplayType.IMAGE.value == value: return DisplayType.IMAGE - else: - return None + return None diff --git a/com/alipay/ams/api/model/dispute_evidence_format_type.py b/com/alipay/ams/api/model/dispute_evidence_format_type.py index 7c8f330..592ad43 100644 --- a/com/alipay/ams/api/model/dispute_evidence_format_type.py +++ b/com/alipay/ams/api/model/dispute_evidence_format_type.py @@ -1,12 +1,21 @@ from enum import Enum, unique - - @unique class DisputeEvidenceFormatType(Enum): + """DisputeEvidenceFormatType枚举类""" + PDF = "PDF" WORD = "WORD" - ZIP = "ZIP" - JPG = "JPG" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if DisputeEvidenceFormatType.PDF.value == value: + return DisputeEvidenceFormatType.PDF + if DisputeEvidenceFormatType.WORD.value == value: + return DisputeEvidenceFormatType.WORD + return None diff --git a/com/alipay/ams/api/model/dispute_evidence_type.py b/com/alipay/ams/api/model/dispute_evidence_type.py index 980c9e3..33c5a69 100644 --- a/com/alipay/ams/api/model/dispute_evidence_type.py +++ b/com/alipay/ams/api/model/dispute_evidence_type.py @@ -1,10 +1,21 @@ from enum import Enum, unique - - @unique class DisputeEvidenceType(Enum): - DISPUTE_EVIDENCE_TEMPLATE = "DISPUTE_EVIDENCE_TEMPLATE" - DISPUTE_EVIDENCE_FILE = "DISPUTE_EVIDENCE_FILE" + """DisputeEvidenceType枚举类""" + + TEMPLATE = "TEMPLATE" + FILE = "FILE" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if DisputeEvidenceType.TEMPLATE.value == value: + return DisputeEvidenceType.TEMPLATE + if DisputeEvidenceType.FILE.value == value: + return DisputeEvidenceType.FILE + return None diff --git a/com/alipay/ams/api/model/entity_associations.py b/com/alipay/ams/api/model/entity_associations.py index 0ce1c02..441d8ec 100644 --- a/com/alipay/ams/api/model/entity_associations.py +++ b/com/alipay/ams/api/model/entity_associations.py @@ -1,67 +1,105 @@ +import json from com.alipay.ams.api.model.association_type import AssociationType +from com.alipay.ams.api.model.legal_entity_type import LegalEntityType from com.alipay.ams.api.model.company import Company from com.alipay.ams.api.model.individual import Individual -from com.alipay.ams.api.model.legal_entity_type import LegalEntityType + + class EntityAssociations: def __init__(self): - self.__association_type = None #type: AssociationType - self.__legal_entity_type = None #type: LegalEntityType - self.__company = None #type: Company - self.__individual = None #type: Individual - self.__shareholding_ratio = None + + self.__association_type = None # type: AssociationType + self.__legal_entity_type = None # type: LegalEntityType + self.__company = None # type: Company + self.__individual = None # type: Individual + self.__shareholding_ratio = None # type: str + @property def association_type(self): + """Gets the association_type of this EntityAssociations. + + """ return self.__association_type @association_type.setter def association_type(self, value): self.__association_type = value - @property def legal_entity_type(self): + """Gets the legal_entity_type of this EntityAssociations. + + """ return self.__legal_entity_type @legal_entity_type.setter def legal_entity_type(self, value): self.__legal_entity_type = value - @property def company(self): + """Gets the company of this EntityAssociations. + + """ return self.__company @company.setter def company(self, value): self.__company = value - @property def individual(self): + """Gets the individual of this EntityAssociations. + + """ return self.__individual @individual.setter def individual(self, value): self.__individual = value - @property def shareholding_ratio(self): + """ + The shareholding ratio of the associated legal entity. The value of this parameter is from 0 to 100. For example, 10.5 represents that the shareholding ratio is 10.5%. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR, AU, SG, HK, US, GB, MY, or the company's registered region belongs to the European Union. More information: Maximum length: 16 characters + """ return self.__shareholding_ratio @shareholding_ratio.setter def shareholding_ratio(self, value): self.__shareholding_ratio = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, 'association_type') and self.association_type: - params['associationType'] = self.association_type.value - if hasattr(self, 'legal_entity_type') and self.legal_entity_type: - params['legalEntityType'] = self.legal_entity_type.value - if hasattr(self, 'company') and self.company: - params['company'] = self.company.to_ams_dict() - if hasattr(self, 'individual') and self.individual: - params['individual'] = self.individual.to_ams_dict() - if hasattr(self, 'shareholding_ratio') and self.shareholding_ratio: + if hasattr(self, "association_type") and self.association_type is not None: + params['associationType'] = self.association_type + if hasattr(self, "legal_entity_type") and self.legal_entity_type is not None: + params['legalEntityType'] = self.legal_entity_type + if hasattr(self, "company") and self.company is not None: + params['company'] = self.company + if hasattr(self, "individual") and self.individual is not None: + params['individual'] = self.individual + if hasattr(self, "shareholding_ratio") and self.shareholding_ratio is not None: params['shareholdingRatio'] = self.shareholding_ratio return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'associationType' in response_body: + association_type_temp = AssociationType.value_of(response_body['associationType']) + self.__association_type = association_type_temp + if 'legalEntityType' in response_body: + legal_entity_type_temp = LegalEntityType.value_of(response_body['legalEntityType']) + self.__legal_entity_type = legal_entity_type_temp + if 'company' in response_body: + self.__company = Company() + self.__company.parse_rsp_body(response_body['company']) + if 'individual' in response_body: + self.__individual = Individual() + self.__individual.parse_rsp_body(response_body['individual']) + if 'shareholdingRatio' in response_body: + self.__shareholding_ratio = response_body['shareholdingRatio'] diff --git a/com/alipay/ams/api/model/env.py b/com/alipay/ams/api/model/env.py index c95d15a..1c70f69 100644 --- a/com/alipay/ams/api/model/env.py +++ b/com/alipay/ams/api/model/env.py @@ -1,229 +1,313 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -from com.alipay.ams.api.model.browser_info import BrowserInfo -from com.alipay.ams.api.model.os_type import OsType +import json from com.alipay.ams.api.model.terminal_type import TerminalType +from com.alipay.ams.api.model.os_type import OsType +from com.alipay.ams.api.model.browser_info import BrowserInfo -class Env(object): + + +class Env: def __init__(self): + self.__terminal_type = None # type: TerminalType self.__os_type = None # type: OsType - self.__user_agent = None - self.__device_token_id = None - self.__client_ip = None - self.__cookie_id = None - self.__store_terminal_id = None - self.__store_terminal_request_time = None - self.__extend_info = None + self.__user_agent = None # type: str + self.__device_token_id = None # type: str + self.__client_ip = None # type: str + self.__cookie_id = None # type: str + self.__extend_info = None # type: str + self.__store_terminal_id = None # type: str + self.__store_terminal_request_time = None # type: str self.__browser_info = None # type: BrowserInfo - self.__color_depth = None - self.__screen_height = None - self.__screen_width = None - self.__time_zone_offset = None - self.__device_brand = None - self.__device_model = None - self.__device_language = None - self.__device_id = None + self.__color_depth = None # type: str + self.__screen_height = None # type: str + self.__screen_width = None # type: str + self.__time_zone_offset = None # type: int + self.__device_brand = None # type: str + self.__device_model = None # type: str + self.__device_language = None # type: str + self.__device_id = None # type: str + self.__env_type = None # type: str + @property def terminal_type(self): + """Gets the terminal_type of this Env. + + """ return self.__terminal_type @terminal_type.setter def terminal_type(self, value): self.__terminal_type = value - @property def os_type(self): + """Gets the os_type of this Env. + + """ return self.__os_type @os_type.setter def os_type(self, value): self.__os_type = value - @property def user_agent(self): + """Gets the user_agent of this Env. + + """ return self.__user_agent @user_agent.setter def user_agent(self, value): self.__user_agent = value - @property def device_token_id(self): + """ + The token identifier of the device. Note: Specify this parameter if you integrate with the Antom Device Fingerprint client, which is an SDK or JavaScript library that is used to collect device-related information, such as osType, deviceLanguage, deviceId, websiteLanguage, and userAgent. The device-related information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. For more information about the Antom Device Fingerprint client, contact Antom Technical Support. More information: Maximum length: 64 characters + """ return self.__device_token_id @device_token_id.setter def device_token_id(self, value): self.__device_token_id = value - @property def client_ip(self): + """ + Client IP address of the device. + """ return self.__client_ip @client_ip.setter def client_ip(self, value): self.__client_ip = value - @property def cookie_id(self): + """Gets the cookie_id of this Env. + + """ return self.__cookie_id @cookie_id.setter def cookie_id(self, value): self.__cookie_id = value + @property + def extend_info(self): + """ + Extended information. Specify this field if you need to use the extended information. More information: Maximum length: 2048 characters + """ + return self.__extend_info + @extend_info.setter + def extend_info(self, value): + self.__extend_info = value @property def store_terminal_id(self): + """Gets the store_terminal_id of this Env. + + """ return self.__store_terminal_id @store_terminal_id.setter def store_terminal_id(self, value): self.__store_terminal_id = value - @property def store_terminal_request_time(self): + """Gets the store_terminal_request_time of this Env. + + """ return self.__store_terminal_request_time @store_terminal_request_time.setter def store_terminal_request_time(self, value): self.__store_terminal_request_time = value - - @property - def extend_info(self): - return self.__extend_info - - @extend_info.setter - def extend_info(self, value): - self.__extend_info = value - @property def browser_info(self): + """Gets the browser_info of this Env. + + """ return self.__browser_info @browser_info.setter def browser_info(self, value): self.__browser_info = value - @property def color_depth(self): + """ + The color depth of the user's browser in bits per pixel. The value is obtained by using the browser's screen.colorDepth property. Valid values are 1, 4, 8, 15, 16, 24, 30, 32, or 48. For example, 8 means 8-bit color depth. More information: Value range: 0 - unlimited + """ return self.__color_depth @color_depth.setter def color_depth(self, value): self.__color_depth = value - @property def screen_height(self): + """ + The screen height of the user's device in pixels. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Value range: 1 - unlimited + """ return self.__screen_height @screen_height.setter def screen_height(self, value): self.__screen_height = value - @property def screen_width(self): + """ + The screen width of the user's device in pixels. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Value range: 1 - unlimited + """ return self.__screen_width @screen_width.setter def screen_width(self, value): self.__screen_width = value - @property def time_zone_offset(self): + """ + The time difference between UTC time and the local time of the user's browser, in minutes. The value is obtained by using the getTimezoneOffset() property. For example, if the local time of the user's browser is UTC+2, the value of this parameter is -120. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Value range: -720 - 720 + """ return self.__time_zone_offset @time_zone_offset.setter def time_zone_offset(self, value): self.__time_zone_offset = value - @property def device_brand(self): + """ + The brand of the user's device. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 64 characters + """ return self.__device_brand @device_brand.setter def device_brand(self, value): self.__device_brand = value - @property def device_model(self): + """ + The model of the user's device. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 128 characters + """ return self.__device_model @device_model.setter def device_model(self, value): self.__device_model = value - @property def device_language(self): + """ + Device language of the user. + """ return self.__device_language @device_language.setter def device_language(self, value): self.__device_language = value - @property def device_id(self): + """ + Device ID of the user. + """ return self.__device_id @device_id.setter def device_id(self, value): self.__device_id = value + @property + def env_type(self): + """ + + """ + return self.__env_type + + @env_type.setter + def env_type(self, value): + self.__env_type = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "terminal_type") and self.terminal_type: + if hasattr(self, "terminal_type") and self.terminal_type is not None: params['terminalType'] = self.terminal_type - - if hasattr(self, "os_type") and self.os_type: + if hasattr(self, "os_type") and self.os_type is not None: params['osType'] = self.os_type - - if hasattr(self, "user_agent") and self.user_agent: + if hasattr(self, "user_agent") and self.user_agent is not None: params['userAgent'] = self.user_agent - - if hasattr(self, "device_token_id ") and self.device_token_id: + if hasattr(self, "device_token_id") and self.device_token_id is not None: params['deviceTokenId'] = self.device_token_id - - if hasattr(self, "client_ip") and self.client_ip: + if hasattr(self, "client_ip") and self.client_ip is not None: params['clientIp'] = self.client_ip - - if hasattr(self, "cookie_id") and self.cookie_id: + if hasattr(self, "cookie_id") and self.cookie_id is not None: params['cookieId'] = self.cookie_id - - if hasattr(self, "store_terminal_id") and self.store_terminal_id: + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + if hasattr(self, "store_terminal_id") and self.store_terminal_id is not None: params['storeTerminalId'] = self.store_terminal_id - - if hasattr(self, "store_terminal_request_time") and self.store_terminal_request_time: + if hasattr(self, "store_terminal_request_time") and self.store_terminal_request_time is not None: params['storeTerminalRequestTime'] = self.store_terminal_request_time - - if hasattr(self, "extend_info") and self.extend_info: - params['extendInfo'] = self.extend_info - - if hasattr(self, "browser_info") and self.browser_info: + if hasattr(self, "browser_info") and self.browser_info is not None: params['browserInfo'] = self.browser_info - - if hasattr(self, "color_depth") and self.color_depth: + if hasattr(self, "color_depth") and self.color_depth is not None: params['colorDepth'] = self.color_depth - - if hasattr(self, "screen_height") and self.screen_height: + if hasattr(self, "screen_height") and self.screen_height is not None: params['screenHeight'] = self.screen_height - - if hasattr(self, "screen_width") and self.screen_width: + if hasattr(self, "screen_width") and self.screen_width is not None: params['screenWidth'] = self.screen_width - - if hasattr(self, "time_zone_offset") and self.time_zone_offset: + if hasattr(self, "time_zone_offset") and self.time_zone_offset is not None: params['timeZoneOffset'] = self.time_zone_offset - - if hasattr(self, "device_brand") and self.device_brand: + if hasattr(self, "device_brand") and self.device_brand is not None: params['deviceBrand'] = self.device_brand - - if hasattr(self, "device_model") and self.device_model: + if hasattr(self, "device_model") and self.device_model is not None: params['deviceModel'] = self.device_model - - if hasattr(self, "device_language") and self.device_language: + if hasattr(self, "device_language") and self.device_language is not None: params['deviceLanguage'] = self.device_language - - if hasattr(self, "device_id") and self.device_id: + if hasattr(self, "device_id") and self.device_id is not None: params['deviceId'] = self.device_id - + if hasattr(self, "env_type") and self.env_type is not None: + params['envType'] = self.env_type return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'terminalType' in response_body: + terminal_type_temp = TerminalType.value_of(response_body['terminalType']) + self.__terminal_type = terminal_type_temp + if 'osType' in response_body: + os_type_temp = OsType.value_of(response_body['osType']) + self.__os_type = os_type_temp + if 'userAgent' in response_body: + self.__user_agent = response_body['userAgent'] + if 'deviceTokenId' in response_body: + self.__device_token_id = response_body['deviceTokenId'] + if 'clientIp' in response_body: + self.__client_ip = response_body['clientIp'] + if 'cookieId' in response_body: + self.__cookie_id = response_body['cookieId'] + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'storeTerminalId' in response_body: + self.__store_terminal_id = response_body['storeTerminalId'] + if 'storeTerminalRequestTime' in response_body: + self.__store_terminal_request_time = response_body['storeTerminalRequestTime'] + if 'browserInfo' in response_body: + self.__browser_info = BrowserInfo() + self.__browser_info.parse_rsp_body(response_body['browserInfo']) + if 'colorDepth' in response_body: + self.__color_depth = response_body['colorDepth'] + if 'screenHeight' in response_body: + self.__screen_height = response_body['screenHeight'] + if 'screenWidth' in response_body: + self.__screen_width = response_body['screenWidth'] + if 'timeZoneOffset' in response_body: + self.__time_zone_offset = response_body['timeZoneOffset'] + if 'deviceBrand' in response_body: + self.__device_brand = response_body['deviceBrand'] + if 'deviceModel' in response_body: + self.__device_model = response_body['deviceModel'] + if 'deviceLanguage' in response_body: + self.__device_language = response_body['deviceLanguage'] + if 'deviceId' in response_body: + self.__device_id = response_body['deviceId'] + if 'envType' in response_body: + self.__env_type = response_body['envType'] diff --git a/com/alipay/ams/api/model/external_payment_method_detail.py b/com/alipay/ams/api/model/external_payment_method_detail.py index fe5240e..73187f6 100644 --- a/com/alipay/ams/api/model/external_payment_method_detail.py +++ b/com/alipay/ams/api/model/external_payment_method_detail.py @@ -1,76 +1,82 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -class ExternalPaymentMethodDetail(object): + +class ExternalPaymentMethodDetail: def __init__(self): - self.__asset_token = None - self.__account_display_name = None - self.__disable_reason = None - self.__payment_method_detail_metadata = None + + self.__asset_token = None # type: str + self.__account_display_name = None # type: str + self.__disable_reason = None # type: str + self.__payment_method_detail_metadata = None # type: str + @property def asset_token(self): + """Gets the asset_token of this ExternalPaymentMethodDetail. + + """ return self.__asset_token @asset_token.setter def asset_token(self, value): self.__asset_token = value - @property def account_display_name(self): + """Gets the account_display_name of this ExternalPaymentMethodDetail. + + """ return self.__account_display_name - @account_display_name.setter def account_display_name(self, value): self.__account_display_name = value - @property def disable_reason(self): + """Gets the disable_reason of this ExternalPaymentMethodDetail. + + """ return self.__disable_reason - @disable_reason.setter def disable_reason(self, value): self.__disable_reason = value - @property def payment_method_detail_metadata(self): + """Gets the payment_method_detail_metadata of this ExternalPaymentMethodDetail. + + """ return self.__payment_method_detail_metadata @payment_method_detail_metadata.setter def payment_method_detail_metadata(self, value): self.__payment_method_detail_metadata = value - def parse_rsp_body(self, external_payment_method_detail_body): - if type(external_payment_method_detail_body) == str: - external_payment_method_detail_body = json.loads(external_payment_method_detail_body) - - if 'assetToken' in external_payment_method_detail_body: - self.__asset_token = external_payment_method_detail_body['assetToken'] - - if 'accountDisplayName' in external_payment_method_detail_body: - self.__account_display_name = external_payment_method_detail_body['accountDisplayName'] - if 'disableReason' in external_payment_method_detail_body: - self.__disable_reason = external_payment_method_detail_body['disableReason'] - - if 'paymentMethodDetailMetadata' in external_payment_method_detail_body: - self.__payment_method_detail_metadata = external_payment_method_detail_body['paymentMethodDetailMetadata'] + def to_ams_dict(self): params = dict() - if self.asset_token: + if hasattr(self, "asset_token") and self.asset_token is not None: params['assetToken'] = self.asset_token - if self.account_display_name: + if hasattr(self, "account_display_name") and self.account_display_name is not None: params['accountDisplayName'] = self.account_display_name - if self.disable_reason: + if hasattr(self, "disable_reason") and self.disable_reason is not None: params['disableReason'] = self.disable_reason - if self.payment_method_detail_metadata: + if hasattr(self, "payment_method_detail_metadata") and self.payment_method_detail_metadata is not None: params['paymentMethodDetailMetadata'] = self.payment_method_detail_metadata - - return params \ No newline at end of file + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'assetToken' in response_body: + self.__asset_token = response_body['assetToken'] + if 'accountDisplayName' in response_body: + self.__account_display_name = response_body['accountDisplayName'] + if 'disableReason' in response_body: + self.__disable_reason = response_body['disableReason'] + if 'paymentMethodDetailMetadata' in response_body: + self.__payment_method_detail_metadata = response_body['paymentMethodDetailMetadata'] diff --git a/com/alipay/ams/api/model/gaming.py b/com/alipay/ams/api/model/gaming.py index 57806e6..bf0efc3 100644 --- a/com/alipay/ams/api/model/gaming.py +++ b/com/alipay/ams/api/model/gaming.py @@ -1,55 +1,82 @@ -class Gaming(object): +import json + + + +class Gaming: def __init__(self): - self.__game_name = None - self.__topped_up_user = None - self.__topped_up_email = None - self.__topped_up_phone_no = None + + self.__game_name = None # type: str + self.__topped_up_user = None # type: str + self.__topped_up_email = None # type: str + self.__topped_up_phone_no = None # type: str + @property def game_name(self): + """ + Game name. More information: Maximum length: 128 characters + """ return self.__game_name @game_name.setter def game_name(self, value): self.__game_name = value - @property def topped_up_user(self): + """ + Name or ID of the user whose gaming account is topped up. More information: Maximum length: 128 characters + """ return self.__topped_up_user @topped_up_user.setter def topped_up_user(self, value): self.__topped_up_user = value - @property def topped_up_email(self): + """ + More information: Maximum length: 64 characters + """ return self.__topped_up_email @topped_up_email.setter def topped_up_email(self, value): self.__topped_up_email = value - @property def topped_up_phone_no(self): + """ + More information: Maximum length: 32 characters + """ return self.__topped_up_phone_no @topped_up_phone_no.setter def topped_up_phone_no(self, value): self.__topped_up_phone_no = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "game_name") and self.game_name: + if hasattr(self, "game_name") and self.game_name is not None: params['gameName'] = self.game_name - - if hasattr(self, "topped_up_user") and self.topped_up_user: - params['toppedUpUser'] = self.topped_up_user.to_ams_dict() - - if hasattr(self, "topped_up_email") and self.topped_up_email: + if hasattr(self, "topped_up_user") and self.topped_up_user is not None: + params['toppedUpUser'] = self.topped_up_user + if hasattr(self, "topped_up_email") and self.topped_up_email is not None: params['toppedUpEmail'] = self.topped_up_email - - if hasattr(self, "topped_up_phone_no") and self.topped_up_phone_no: + if hasattr(self, "topped_up_phone_no") and self.topped_up_phone_no is not None: params['toppedUpPhoneNo'] = self.topped_up_phone_no - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'gameName' in response_body: + self.__game_name = response_body['gameName'] + if 'toppedUpUser' in response_body: + self.__topped_up_user = response_body['toppedUpUser'] + if 'toppedUpEmail' in response_body: + self.__topped_up_email = response_body['toppedUpEmail'] + if 'toppedUpPhoneNo' in response_body: + self.__topped_up_phone_no = response_body['toppedUpPhoneNo'] diff --git a/com/alipay/ams/api/model/goods.py b/com/alipay/ams/api/model/goods.py index 08e16a3..cd8c8ce 100644 --- a/com/alipay/ams/api/model/goods.py +++ b/com/alipay/ams/api/model/goods.py @@ -1,168 +1,189 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json from com.alipay.ams.api.model.amount import Amount -from com.alipay.ams.api.model.delivery_method_type import DeliveryMethodType -class Goods(object): + + +class Goods: def __init__(self): - self.__reference_goods_id = None - self.__goods_name = None - self.__goods_category = None - self.__goods_brand = None - self.__goods_unit_amount = None # type:Amount - self.__goods_quantity = None - self.__goods_sku_name = None - self.__delivery_method_type = None # type:DeliveryMethodType - self.__goods_url = None - self.__goods_image_url = None - self.__price_id = None - self.__goods_discount_amount = None # type:Amount - self.__cross_sell = None # type:Goods + + self.__reference_goods_id = None # type: str + self.__goods_name = None # type: str + self.__goods_category = None # type: str + self.__goods_brand = None # type: str + self.__goods_unit_amount = None # type: Amount + self.__goods_quantity = None # type: str + self.__goods_sku_name = None # type: str + self.__goods_url = None # type: str + self.__delivery_method_type = None # type: str + self.__goods_image_url = None # type: str + self.__price_id = None # type: str + @property def reference_goods_id(self): + """ + The unique ID to identify the goods. More information: Maximum length: 64 characters + """ return self.__reference_goods_id @reference_goods_id.setter def reference_goods_id(self, value): self.__reference_goods_id = value - @property def goods_name(self): + """ + Goods name. More information: Maximum length: 256 characters + """ return self.__goods_name @goods_name.setter def goods_name(self, value): self.__goods_name = value - @property def goods_category(self): + """ + The category of the goods. If the goods have multiple layers for categorization, use slashes between different categories and write the parent category before the subcategory, such as Digital Goods/Digital Vouchers/Food and Beverages. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 64 characters + """ return self.__goods_category @goods_category.setter def goods_category(self, value): self.__goods_category = value - @property def goods_brand(self): + """Gets the goods_brand of this Goods. + + """ return self.__goods_brand @goods_brand.setter def goods_brand(self, value): self.__goods_brand = value - @property def goods_unit_amount(self): + """Gets the goods_unit_amount of this Goods. + + """ return self.__goods_unit_amount @goods_unit_amount.setter def goods_unit_amount(self, value): self.__goods_unit_amount = value - @property def goods_quantity(self): + """ + Quantity of goods. Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Value range: 1 - unlimited + """ return self.__goods_quantity @goods_quantity.setter def goods_quantity(self, value): self.__goods_quantity = value - @property def goods_sku_name(self): + """Gets the goods_sku_name of this Goods. + + """ return self.__goods_sku_name @goods_sku_name.setter def goods_sku_name(self, value): self.__goods_sku_name = value - - @property - def delivery_method_type(self): - return self.__delivery_method_type - - @delivery_method_type.setter - def delivery_method_type(self, value): - self.__delivery_method_type = value - @property def goods_url(self): + """ + The URL of the website where the user places an order. Specify this parameter if you require risk control. Providing this information helps to identify black-market behavior. More information: Maximum length: 2048 characters + """ return self.__goods_url @goods_url.setter def goods_url(self, value): self.__goods_url = value + @property + def delivery_method_type(self): + """ + The delivery method of the goods. Valid values are: PHYSICAL: indicates that the delivery method is physical delivery. DIGITAL: indicates that the delivery method is digital delivery. Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 32 characters + """ + return self.__delivery_method_type + @delivery_method_type.setter + def delivery_method_type(self, value): + self.__delivery_method_type = value @property def goods_image_url(self): + """Gets the goods_image_url of this Goods. + + """ return self.__goods_image_url @goods_image_url.setter def goods_image_url(self, value): self.__goods_image_url = value - @property def price_id(self): + """ + The ID of the Price object. One of ​priceId​ or ​referenceGoodsId​ is required. More information: Maximum length: 64 characters + """ return self.__price_id @price_id.setter def price_id(self, value): self.__price_id = value - @property - def goods_discount_amount(self): - return self.__goods_discount_amount - - @goods_discount_amount.setter - def goods_discount_amount(self, value): - self.__goods_discount_amount = value - - @property - def cross_sell(self): - return self.__cross_sell - - @cross_sell.setter - def cross_sell(self, value): - self.__cross_sell = value + def to_ams_dict(self): params = dict() - if hasattr(self, "reference_goods_id") and self.reference_goods_id: + if hasattr(self, "reference_goods_id") and self.reference_goods_id is not None: params['referenceGoodsId'] = self.reference_goods_id - - if hasattr(self, "goods_name") and self.goods_name: + if hasattr(self, "goods_name") and self.goods_name is not None: params['goodsName'] = self.goods_name - - if hasattr(self, "goods_category") and self.goods_category: + if hasattr(self, "goods_category") and self.goods_category is not None: params['goodsCategory'] = self.goods_category - - if hasattr(self, "goods_brand") and self.goods_brand: + if hasattr(self, "goods_brand") and self.goods_brand is not None: params['goodsBrand'] = self.goods_brand - - if hasattr(self, "goods_unit_amount") and self.goods_unit_amount: + if hasattr(self, "goods_unit_amount") and self.goods_unit_amount is not None: params['goodsUnitAmount'] = self.goods_unit_amount - - if hasattr(self, "goods_quantity") and self.goods_quantity: + if hasattr(self, "goods_quantity") and self.goods_quantity is not None: params['goodsQuantity'] = self.goods_quantity - - if hasattr(self, "goods_sku_name") and self.goods_sku_name: + if hasattr(self, "goods_sku_name") and self.goods_sku_name is not None: params['goodsSkuName'] = self.goods_sku_name - - if hasattr(self, "delivery_method_type") and self.delivery_method_type: - params['deliveryMethodType'] = self.delivery_method_type - - if hasattr(self, "goods_url") and self.goods_url: + if hasattr(self, "goods_url") and self.goods_url is not None: params['goodsUrl'] = self.goods_url - - if hasattr(self, "goods_image_url") and self.goods_image_url: + if hasattr(self, "delivery_method_type") and self.delivery_method_type is not None: + params['deliveryMethodType'] = self.delivery_method_type + if hasattr(self, "goods_image_url") and self.goods_image_url is not None: params['goodsImageUrl'] = self.goods_image_url - - if hasattr(self, "price_id") and self.price_id: + if hasattr(self, "price_id") and self.price_id is not None: params['priceId'] = self.price_id + return params - if hasattr(self, "goods_discount_amount") and self.goods_discount_amount: - params['goodsDiscountAmount'] = self.goods_discount_amount - if hasattr(self, "cross_sell") and self.cross_sell: - params['crossSell'] = self.cross_sell - return params + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'referenceGoodsId' in response_body: + self.__reference_goods_id = response_body['referenceGoodsId'] + if 'goodsName' in response_body: + self.__goods_name = response_body['goodsName'] + if 'goodsCategory' in response_body: + self.__goods_category = response_body['goodsCategory'] + if 'goodsBrand' in response_body: + self.__goods_brand = response_body['goodsBrand'] + if 'goodsUnitAmount' in response_body: + self.__goods_unit_amount = Amount() + self.__goods_unit_amount.parse_rsp_body(response_body['goodsUnitAmount']) + if 'goodsQuantity' in response_body: + self.__goods_quantity = response_body['goodsQuantity'] + if 'goodsSkuName' in response_body: + self.__goods_sku_name = response_body['goodsSkuName'] + if 'goodsUrl' in response_body: + self.__goods_url = response_body['goodsUrl'] + if 'deliveryMethodType' in response_body: + self.__delivery_method_type = response_body['deliveryMethodType'] + if 'goodsImageUrl' in response_body: + self.__goods_image_url = response_body['goodsImageUrl'] + if 'priceId' in response_body: + self.__price_id = response_body['priceId'] diff --git a/com/alipay/ams/api/model/grant_type.py b/com/alipay/ams/api/model/grant_type.py index 292e706..932a4b8 100644 --- a/com/alipay/ams/api/model/grant_type.py +++ b/com/alipay/ams/api/model/grant_type.py @@ -1,12 +1,21 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class GrantType(Enum): + """GrantType枚举类""" + AUTHORIZATION_CODE = "AUTHORIZATION_CODE" REFRESH_TOKEN = "REFRESH_TOKEN" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if GrantType.AUTHORIZATION_CODE.value == value: + return GrantType.AUTHORIZATION_CODE + if GrantType.REFRESH_TOKEN.value == value: + return GrantType.REFRESH_TOKEN + return None diff --git a/com/alipay/ams/api/model/in_store_payment_scenario.py b/com/alipay/ams/api/model/in_store_payment_scenario.py index f1cfb9a..eb26d57 100644 --- a/com/alipay/ams/api/model/in_store_payment_scenario.py +++ b/com/alipay/ams/api/model/in_store_payment_scenario.py @@ -1,14 +1,24 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - from enum import Enum, unique - - @unique class InStorePaymentScenario(Enum): - PaymentCode = "PaymentCode" - OrderCode = "OrderCode" - EntryCode = "EntryCode" + """InStorePaymentScenario枚举类""" - def to_ams_dict(self): + PAYMENTCODE = "PAYMENTCODE" + ORDERCODE = "ORDERCODE" + ENTRYCODE = "ENTRYCODE" + + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if InStorePaymentScenario.PAYMENTCODE.value == value: + return InStorePaymentScenario.PAYMENTCODE + if InStorePaymentScenario.ORDERCODE.value == value: + return InStorePaymentScenario.ORDERCODE + if InStorePaymentScenario.ENTRYCODE.value == value: + return InStorePaymentScenario.ENTRYCODE + return None diff --git a/com/alipay/ams/api/model/individual.py b/com/alipay/ams/api/model/individual.py index b1a2cd5..2d9ee95 100644 --- a/com/alipay/ams/api/model/individual.py +++ b/com/alipay/ams/api/model/individual.py @@ -1,70 +1,90 @@ +import json +from com.alipay.ams.api.model.user_name import UserName +from com.alipay.ams.api.model.user_name import UserName from com.alipay.ams.api.model.address import Address from com.alipay.ams.api.model.certificate import Certificate from com.alipay.ams.api.model.contact import Contact -from com.alipay.ams.api.model.user_name import UserName -class Individual: + +class Individual: def __init__(self): - self.__name = None #type: UserName - self.__english_name = None #type: UserName - self.__date_of_birth = None - self.__place_of_birth = None #type: Address - self.__certificates = None #type: list[Certificate] - self.__nationality = None - self.__contacts = None #type: list[Contact] + + self.__name = None # type: UserName + self.__english_name = None # type: UserName + self.__date_of_birth = None # type: str + self.__place_of_birth = None # type: Address + self.__certificates = None # type: [Certificate] + self.__nationality = None # type: str + self.__contacts = None # type: [Contact] + @property def name(self): + """Gets the name of this Individual. + + """ return self.__name @name.setter def name(self, value): self.__name = value - @property def english_name(self): + """Gets the english_name of this Individual. + + """ return self.__english_name @english_name.setter def english_name(self, value): self.__english_name = value - @property def date_of_birth(self): + """ + The individual's date of birth. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR. More information: Maximum length: 32 characters + """ return self.__date_of_birth @date_of_birth.setter def date_of_birth(self, value): self.__date_of_birth = value - @property def place_of_birth(self): + """Gets the place_of_birth of this Individual. + + """ return self.__place_of_birth @place_of_birth.setter def place_of_birth(self, value): self.__place_of_birth = value - @property def certificates(self): + """ + The list of certificate information of the individual. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR or US. + """ return self.__certificates @certificates.setter def certificates(self, value): self.__certificates = value - @property def nationality(self): + """ + The nationality of the individual. The value of this parameter is a 2-letter country or region code based on the ISO 3166 Country Codes standard. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is EU, GB, MY, US, or BR. More information: Maximum length: 2 characters + """ return self.__nationality @nationality.setter def nationality(self, value): self.__nationality = value - @property def contacts(self): + """ + A list of contact information. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is JP and the value of merchantInfo.entityAssociations.associationType is LEGAL_REPRESENTATIVE. More information: Maximum size: 10 elements + """ return self.__contacts @contacts.setter @@ -72,26 +92,52 @@ def contacts(self, value): self.__contacts = value + + def to_ams_dict(self): params = dict() - if hasattr(self, 'name') and self.name: - params['name'] = self.name.to_ams_dict() - if hasattr(self, 'english_name') and self.english_name: - params['englishName'] = self.english_name.to_ams_dict() - if hasattr(self, 'date_of_birth') and self.date_of_birth: + if hasattr(self, "name") and self.name is not None: + params['name'] = self.name + if hasattr(self, "english_name") and self.english_name is not None: + params['englishName'] = self.english_name + if hasattr(self, "date_of_birth") and self.date_of_birth is not None: params['dateOfBirth'] = self.date_of_birth - if hasattr(self, 'place_of_birth') and self.place_of_birth: - params['placeOfBirth'] = self.place_of_birth.to_ams_dict() - if hasattr(self, 'certificates') and self.certificates: - certificates_list = list() - for d in self.certificates: - certificates_list.append(d.to_ams_dict()) - params['certificates'] = certificates_list - if hasattr(self, 'nationality') and self.nationality: + if hasattr(self, "place_of_birth") and self.place_of_birth is not None: + params['placeOfBirth'] = self.place_of_birth + if hasattr(self, "certificates") and self.certificates is not None: + params['certificates'] = self.certificates + if hasattr(self, "nationality") and self.nationality is not None: params['nationality'] = self.nationality - if hasattr(self, 'contacts') and self.contacts: - contacts_list = list() - for d in self.contacts: - contacts_list.append(d.to_ams_dict()) - params['contacts'] = contacts_list - return params \ No newline at end of file + if hasattr(self, "contacts") and self.contacts is not None: + params['contacts'] = self.contacts + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'name' in response_body: + self.__name = UserName() + self.__name.parse_rsp_body(response_body['name']) + if 'englishName' in response_body: + self.__english_name = UserName() + self.__english_name.parse_rsp_body(response_body['englishName']) + if 'dateOfBirth' in response_body: + self.__date_of_birth = response_body['dateOfBirth'] + if 'placeOfBirth' in response_body: + self.__place_of_birth = Address() + self.__place_of_birth.parse_rsp_body(response_body['placeOfBirth']) + if 'certificates' in response_body: + self.__certificates = [] + for item in response_body['certificates']: + obj = Certificate() + obj.parse_rsp_body(item) + self.__certificates.append(obj) + if 'nationality' in response_body: + self.__nationality = response_body['nationality'] + if 'contacts' in response_body: + self.__contacts = [] + for item in response_body['contacts']: + obj = Contact() + obj.parse_rsp_body(item) + self.__contacts.append(obj) diff --git a/com/alipay/ams/api/model/installment.py b/com/alipay/ams/api/model/installment.py index 991ec64..0e2130b 100644 --- a/com/alipay/ams/api/model/installment.py +++ b/com/alipay/ams/api/model/installment.py @@ -1,41 +1,62 @@ import json - -from com.alipay.ams.api.model.plan import Plan from com.alipay.ams.api.model.support_card_brand import SupportCardBrand +from com.alipay.ams.api.model.plan import Plan + -class Installment(object): + +class Installment: def __init__(self): - self.__support_card_brands = None # type: list[SupportCardBrand] - self.__plans = None # type: list[Plan] + + self.__support_card_brands = None # type: [SupportCardBrand] + self.__plans = None # type: [Plan] + @property def support_card_brands(self): + """ + The list of card brands that support the installment plans. This parameter is returned when the value of paymentMethodType is CARD. + """ return self.__support_card_brands @support_card_brands.setter def support_card_brands(self, value): self.__support_card_brands = value - @property def plans(self): + """ + The list of installment plans for payment methods that support installments. + """ return self.__plans @plans.setter def plans(self, value): self.__plans = value - def parse_rsp_body(self, installment_body): - if type(installment_body) == str: - installment_body = json.loads(installment_body) - if 'supportCardBrand' in installment_body: - self.support_card_brands = installment_body.get('supportCardBrand') - for support_card_brand in self.support_card_brands: - support_card_brand.parse_rsp_body(support_card_brand) - self.support_card_brands = support_card_brand - - if 'plans' in installment_body: - self.plans = installment_body.get('plans') - for plan in self.plans: - plan.parse_rsp_body(plan) - self.plans = plan + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "support_card_brands") and self.support_card_brands is not None: + params['supportCardBrands'] = self.support_card_brands + if hasattr(self, "plans") and self.plans is not None: + params['plans'] = self.plans + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'supportCardBrands' in response_body: + self.__support_card_brands = [] + for item in response_body['supportCardBrands']: + obj = SupportCardBrand() + obj.parse_rsp_body(item) + self.__support_card_brands.append(obj) + if 'plans' in response_body: + self.__plans = [] + for item in response_body['plans']: + obj = Plan() + obj.parse_rsp_body(item) + self.__plans.append(obj) diff --git a/com/alipay/ams/api/model/interest_free.py b/com/alipay/ams/api/model/interest_free.py index 99ca1b7..d9744ba 100644 --- a/com/alipay/ams/api/model/interest_free.py +++ b/com/alipay/ams/api/model/interest_free.py @@ -1,85 +1,116 @@ import json - from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.amount import Amount + + -class InterestFree(object): +class InterestFree: def __init__(self): - self.__provider = None - self.__expireTime = None - self.__installment_free_nums = None # type:list[str] - self.__min_payment_amount = None # type:Amount - self.__max_payment_amount = None # type:Amount - self.__free_percentage = None + + self.__provider = None # type: str + self.__expire_time = None # type: str + self.__installment_free_nums = None # type: [int] + self.__min_payment_amount = None # type: Amount + self.__max_payment_amount = None # type: Amount + self.__free_percentage = None # type: int + @property def provider(self): + """ + Issuing banks or financial institutions that offer interest-free installment plans. More information: Maximum length: 128 characters + """ return self.__provider @provider.setter def provider(self, value): self.__provider = value - @property - def expireTime(self): - return self.__expireTime - - @expireTime.setter - def expireTime(self, value): - self.__expireTime = value - + def expire_time(self): + """ + The promotion expiration time. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ + return self.__expire_time + + @expire_time.setter + def expire_time(self, value): + self.__expire_time = value @property def installment_free_nums(self): + """ + The number of interest-free installments. More information: Value range: 2-unlimited + """ return self.__installment_free_nums @installment_free_nums.setter def installment_free_nums(self, value): self.__installment_free_nums = value - @property def min_payment_amount(self): + """Gets the min_payment_amount of this InterestFree. + + """ return self.__min_payment_amount @min_payment_amount.setter def min_payment_amount(self, value): self.__min_payment_amount = value - @property def max_payment_amount(self): + """Gets the max_payment_amount of this InterestFree. + + """ return self.__max_payment_amount @max_payment_amount.setter def max_payment_amount(self, value): self.__max_payment_amount = value - @property def free_percentage(self): + """ + The interest-free percentage. A value of 0 indicates no interest-free, 100% indicates the buyer is completely interest-free, while the value between 0-100% indicates partial interest-free. + """ return self.__free_percentage @free_percentage.setter def free_percentage(self, value): self.__free_percentage = value - def parse_rsp_body(self, interest_free_body): - if type(interest_free_body) == str: - interest_free_body = json.loads(interest_free_body) - - if 'provider' in interest_free_body: - self.provider = interest_free_body['provider'] - - if 'expireTime' in interest_free_body: - self.expireTime = interest_free_body['expireTime'] - - if 'installmentFreeNums' in interest_free_body: - self.installment_free_nums = interest_free_body['installmentFreeNums'] - - if 'minPaymentAmount' in interest_free_body: - self.min_payment_amount = Amount() - self.min_payment_amount.parse_rsp_body(interest_free_body['minPaymentAmount']) - - if 'maxPaymentAmount' in interest_free_body: - self.max_payment_amount = Amount() - self.max_payment_amount.parse_rsp_body(interest_free_body['maxPaymentAmount']) - if 'freePercentage' in interest_free_body: - self.free_percentage = interest_free_body['freePercentage'] + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "provider") and self.provider is not None: + params['provider'] = self.provider + if hasattr(self, "expire_time") and self.expire_time is not None: + params['expireTime'] = self.expire_time + if hasattr(self, "installment_free_nums") and self.installment_free_nums is not None: + params['installmentFreeNums'] = self.installment_free_nums + if hasattr(self, "min_payment_amount") and self.min_payment_amount is not None: + params['minPaymentAmount'] = self.min_payment_amount + if hasattr(self, "max_payment_amount") and self.max_payment_amount is not None: + params['maxPaymentAmount'] = self.max_payment_amount + if hasattr(self, "free_percentage") and self.free_percentage is not None: + params['freePercentage'] = self.free_percentage + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'provider' in response_body: + self.__provider = response_body['provider'] + if 'expireTime' in response_body: + self.__expire_time = response_body['expireTime'] + if 'installmentFreeNums' in response_body: + self.__installment_free_nums = response_body['installmentFreeNums'] + if 'minPaymentAmount' in response_body: + self.__min_payment_amount = Amount() + self.__min_payment_amount.parse_rsp_body(response_body['minPaymentAmount']) + if 'maxPaymentAmount' in response_body: + self.__max_payment_amount = Amount() + self.__max_payment_amount.parse_rsp_body(response_body['maxPaymentAmount']) + if 'freePercentage' in response_body: + self.__free_percentage = response_body['freePercentage'] diff --git a/com/alipay/ams/api/model/leg.py b/com/alipay/ams/api/model/leg.py index e4a4992..126c1f5 100644 --- a/com/alipay/ams/api/model/leg.py +++ b/com/alipay/ams/api/model/leg.py @@ -1,82 +1,110 @@ -class Leg(object): +import json +from com.alipay.ams.api.model.address import Address +from com.alipay.ams.api.model.address import Address +from com.alipay.ams.api.model.class_type import ClassType + + + +class Leg: def __init__(self): - self.__departure_time = None - self.__arrival_time = None - self.__departure_address = None - self.__arrival_address = None - self.__carrier_name = None - self.__carrier_no = None - self.__class_type = None - self.__departure_airport_code = None - self.__arrival_airport_code = None + + self.__departure_time = None # type: str + self.__arrival_time = None # type: str + self.__departure_address = None # type: Address + self.__arrival_address = None # type: Address + self.__carrier_name = None # type: str + self.__carrier_no = None # type: str + self.__class_type = None # type: ClassType + self.__departure_airport_code = None # type: str + self.__arrival_airport_code = None # type: str + @property def departure_time(self): + """ + Time of departure for this leg of the trip. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__departure_time @departure_time.setter def departure_time(self, value): self.__departure_time = value - @property def arrival_time(self): + """ + Time of arrival for this leg of the trip. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__arrival_time @arrival_time.setter def arrival_time(self, value): self.__arrival_time = value - @property def departure_address(self): + """Gets the departure_address of this Leg. + + """ return self.__departure_address @departure_address.setter def departure_address(self, value): self.__departure_address = value - @property def arrival_address(self): + """Gets the arrival_address of this Leg. + + """ return self.__arrival_address @arrival_address.setter def arrival_address(self, value): self.__arrival_address = value - @property def carrier_name(self): + """ + Company name of the transportation service provider for this leg of the trip. More information: Maximum length: 128 characters + """ return self.__carrier_name @carrier_name.setter def carrier_name(self, value): self.__carrier_name = value - @property def carrier_no(self): + """ + Code for the carrier for this leg of the trip. More information: Maximum length: 64 characters + """ return self.__carrier_no @carrier_no.setter def carrier_no(self, value): self.__carrier_no = value - @property - def classs_type(self): - return self.__classs_type - - @classs_type.setter - def classs_type(self, value): - self.__classs_type = value - + def class_type(self): + """Gets the class_type of this Leg. + + """ + return self.__class_type + + @class_type.setter + def class_type(self, value): + self.__class_type = value @property def departure_airport_code(self): + """ + IATA code for the originating airport for this leg of the trip. More information: Maximum length: 8 characters + """ return self.__departure_airport_code @departure_airport_code.setter def departure_airport_code(self, value): self.__departure_airport_code = value - @property def arrival_airport_code(self): + """ + IATA code for the destination airport for this leg of the trip. More information: Maximum length: 8 characters + """ return self.__arrival_airport_code @arrival_airport_code.setter @@ -84,33 +112,52 @@ def arrival_airport_code(self, value): self.__arrival_airport_code = value + + def to_ams_dict(self): params = dict() - if hasattr(self, "departure_time") and self.departure_time: + if hasattr(self, "departure_time") and self.departure_time is not None: params['departureTime'] = self.departure_time - - if hasattr(self, "arrival_time") and self.arrival_time: + if hasattr(self, "arrival_time") and self.arrival_time is not None: params['arrivalTime'] = self.arrival_time - - if hasattr(self, "departure_address") and self.departure_address: - params['departureAddress'] = self.departure_address.to_ams_dict() - - if hasattr(self, "arrival_address") and self.arrival_address: - params['arrivalAddress'] = self.arrival_address.to_ams_dict() - - if hasattr(self, "carrier_name") and self.carrier_name: + if hasattr(self, "departure_address") and self.departure_address is not None: + params['departureAddress'] = self.departure_address + if hasattr(self, "arrival_address") and self.arrival_address is not None: + params['arrivalAddress'] = self.arrival_address + if hasattr(self, "carrier_name") and self.carrier_name is not None: params['carrierName'] = self.carrier_name - - if hasattr(self, "carrier_no") and self.carrier_no: + if hasattr(self, "carrier_no") and self.carrier_no is not None: params['carrierNo'] = self.carrier_no - - if hasattr(self, "classs_type") and self.classs_type: - params['classType'] = self.classs_type - - if hasattr(self, "departure_airport_code") and self.departure_airport_code: + if hasattr(self, "class_type") and self.class_type is not None: + params['classType'] = self.class_type + if hasattr(self, "departure_airport_code") and self.departure_airport_code is not None: params['departureAirportCode'] = self.departure_airport_code - - if hasattr(self, "arrival_airport_code") and self.arrival_airport_code: + if hasattr(self, "arrival_airport_code") and self.arrival_airport_code is not None: params['arrivalAirportCode'] = self.arrival_airport_code - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'departureTime' in response_body: + self.__departure_time = response_body['departureTime'] + if 'arrivalTime' in response_body: + self.__arrival_time = response_body['arrivalTime'] + if 'departureAddress' in response_body: + self.__departure_address = Address() + self.__departure_address.parse_rsp_body(response_body['departureAddress']) + if 'arrivalAddress' in response_body: + self.__arrival_address = Address() + self.__arrival_address.parse_rsp_body(response_body['arrivalAddress']) + if 'carrierName' in response_body: + self.__carrier_name = response_body['carrierName'] + if 'carrierNo' in response_body: + self.__carrier_no = response_body['carrierNo'] + if 'classType' in response_body: + class_type_temp = ClassType.value_of(response_body['classType']) + self.__class_type = class_type_temp + if 'departureAirportCode' in response_body: + self.__departure_airport_code = response_body['departureAirportCode'] + if 'arrivalAirportCode' in response_body: + self.__arrival_airport_code = response_body['arrivalAirportCode'] diff --git a/com/alipay/ams/api/model/legal_entity_type.py b/com/alipay/ams/api/model/legal_entity_type.py index 3be2d97..312801b 100644 --- a/com/alipay/ams/api/model/legal_entity_type.py +++ b/com/alipay/ams/api/model/legal_entity_type.py @@ -1,10 +1,21 @@ from enum import Enum, unique - - @unique class LegalEntityType(Enum): + """LegalEntityType枚举类""" + COMPANY = "COMPANY" INDIVIDUAL = "INDIVIDUAL" - def to_ams_dict(self): - return self.name \ No newline at end of file + def to_ams_dict(self) -> str: + return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if LegalEntityType.COMPANY.value == value: + return LegalEntityType.COMPANY + if LegalEntityType.INDIVIDUAL.value == value: + return LegalEntityType.INDIVIDUAL + return None diff --git a/com/alipay/ams/api/model/lodging.py b/com/alipay/ams/api/model/lodging.py index 7723818..0c3b2b8 100644 --- a/com/alipay/ams/api/model/lodging.py +++ b/com/alipay/ams/api/model/lodging.py @@ -1,95 +1,134 @@ +import json from com.alipay.ams.api.model.address import Address from com.alipay.ams.api.model.user_name import UserName -class Lodging(object): + + +class Lodging: def __init__(self): - self.__hotel_name = None + + self.__hotel_name = None # type: str self.__hotel_address = None # type: Address - self.__check_in_date = None - self.__check_out_date = None - self.__number_of_nights = None - self.__number_of_rooms = None - self.__guest_names = None # type: list[UserName] + self.__check_in_date = None # type: str + self.__check_out_date = None # type: str + self.__number_of_nights = None # type: int + self.__number_of_rooms = None # type: int + self.__guest_names = None # type: [UserName] + @property def hotel_name(self): + """ + Hotel name. More information: Maximum length: 128 characters + """ return self.__hotel_name @hotel_name.setter def hotel_name(self, value): self.__hotel_name = value - @property def hotel_address(self): + """Gets the hotel_address of this Lodging. + + """ return self.__hotel_address @hotel_address.setter def hotel_address(self, value): self.__hotel_address = value - @property def check_in_date(self): + """ + Date on which the guest checked in. In the case of a no-show or a reservation, the scheduled arrival date. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__check_in_date @check_in_date.setter def check_in_date(self, value): self.__check_in_date = value - @property def check_out_date(self): + """ + Date on which the guest checked out. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__check_out_date @check_out_date.setter def check_out_date(self, value): self.__check_out_date = value - @property def number_of_nights(self): - return self + """ + Number of rooms booked by the payer. More information: Value range: 1 - unlimited + """ + return self.__number_of_nights @number_of_nights.setter def number_of_nights(self, value): self.__number_of_nights = value - @property def number_of_rooms(self): + """ + Number of nights booked by the payer. More information: Value range: 1 - unlimited + """ return self.__number_of_rooms @number_of_rooms.setter def number_of_rooms(self, value): self.__number_of_rooms = value - @property def guest_names(self): + """ + Name of the guest under which the room is reserved. More information: Maximum size: 100 elements + """ return self.__guest_names @guest_names.setter def guest_names(self, value): self.__guest_names = value + + + def to_ams_dict(self): params = dict() - - if hasattr(self, "hotel_name") and self.hotel_name: + if hasattr(self, "hotel_name") and self.hotel_name is not None: params['hotelName'] = self.hotel_name - - if hasattr(self, "hotel_address") and self.hotel_address: - params['hotelAddress'] = self.hotel_address.to_ams_dict() - - if hasattr(self, "check_in_date") and self.check_in_date: + if hasattr(self, "hotel_address") and self.hotel_address is not None: + params['hotelAddress'] = self.hotel_address + if hasattr(self, "check_in_date") and self.check_in_date is not None: params['checkInDate'] = self.check_in_date - - if hasattr(self, "check_out_date") and self.check_out_date: + if hasattr(self, "check_out_date") and self.check_out_date is not None: params['checkOutDate'] = self.check_out_date - - if hasattr(self, "number_of_nights") and self.number_of_nights: + if hasattr(self, "number_of_nights") and self.number_of_nights is not None: params['numberOfNights'] = self.number_of_nights - - if hasattr(self, "number_of_rooms") and self.number_of_rooms: + if hasattr(self, "number_of_rooms") and self.number_of_rooms is not None: params['numberOfRooms'] = self.number_of_rooms + if hasattr(self, "guest_names") and self.guest_names is not None: + params['guestNames'] = self.guest_names + return params - if hasattr(self, "guest_names") and self.guest_names: - params['guestNames'] = [guest_name.to_ams_dict() for guest_name in self.guest_names] - return params + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'hotelName' in response_body: + self.__hotel_name = response_body['hotelName'] + if 'hotelAddress' in response_body: + self.__hotel_address = Address() + self.__hotel_address.parse_rsp_body(response_body['hotelAddress']) + if 'checkInDate' in response_body: + self.__check_in_date = response_body['checkInDate'] + if 'checkOutDate' in response_body: + self.__check_out_date = response_body['checkOutDate'] + if 'numberOfNights' in response_body: + self.__number_of_nights = response_body['numberOfNights'] + if 'numberOfRooms' in response_body: + self.__number_of_rooms = response_body['numberOfRooms'] + if 'guestNames' in response_body: + self.__guest_names = [] + for item in response_body['guestNames']: + obj = UserName() + obj.parse_rsp_body(item) + self.__guest_names.append(obj) diff --git a/com/alipay/ams/api/model/logo.py b/com/alipay/ams/api/model/logo.py index 4b4cbbf..90bdc4c 100644 --- a/com/alipay/ams/api/model/logo.py +++ b/com/alipay/ams/api/model/logo.py @@ -1,31 +1,52 @@ -class Logo(object): +import json + + + +class Logo: def __init__(self): - self.__logo_name = None - self.__logo_url = None + + self.__logo_name = None # type: str + self.__logo_url = None # type: str + @property def logo_name(self): + """ + The logo name of the card brand. See the Card brands to check the valid values. More information: Maximum length: 12 characters + """ return self.__logo_name @logo_name.setter def logo_name(self, value): self.__logo_name = value - @property def logo_url(self): + """ + The logo URL of the card brand. More information: Maximum length: 2048 characters + """ return self.__logo_url @logo_url.setter def logo_url(self, value): self.__logo_url = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "logo_name") and self.logo_name: + if hasattr(self, "logo_name") and self.logo_name is not None: params['logoName'] = self.logo_name - - if hasattr(self, "logo_url") and self.logo_url: + if hasattr(self, "logo_url") and self.logo_url is not None: params['logoUrl'] = self.logo_url - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'logoName' in response_body: + self.__logo_name = response_body['logoName'] + if 'logoUrl' in response_body: + self.__logo_url = response_body['logoUrl'] diff --git a/com/alipay/ams/api/model/merchant.py b/com/alipay/ams/api/model/merchant.py index 8f7df84..07353d4 100644 --- a/com/alipay/ams/api/model/merchant.py +++ b/com/alipay/ams/api/model/merchant.py @@ -1,107 +1,148 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json from com.alipay.ams.api.model.address import Address +from com.alipay.ams.api.model.store import Store +from com.alipay.ams.api.model.merchant_type import MerchantType -class Merchant(object): + + +class Merchant: def __init__(self): - self.__reference_merchant_id = None - self.__merchant_mcc = None - self.__merchant_name = None - self.__merchant_display_name = None + + self.__reference_merchant_id = None # type: str + self.__merchant_mcc = None # type: str + self.__merchant_name = None # type: str + self.__merchant_display_name = None # type: str self.__merchant_address = None # type: Address - self.__merchant_register_date = None + self.__merchant_register_date = None # type: str + self.__store = None # type: Store self.__merchant_type = None # type: MerchantType - self.__store = None + @property def reference_merchant_id(self): + """Gets the reference_merchant_id of this Merchant. + + """ return self.__reference_merchant_id @reference_merchant_id.setter def reference_merchant_id(self, value): self.__reference_merchant_id = value - @property def merchant_mcc(self): + """Gets the merchant_mcc of this Merchant. + + """ return self.__merchant_mcc @merchant_mcc.setter def merchant_mcc(self, value): self.__merchant_mcc = value - @property def merchant_name(self): + """Gets the merchant_name of this Merchant. + + """ return self.__merchant_name @merchant_name.setter def merchant_name(self, value): self.__merchant_name = value - @property def merchant_display_name(self): + """Gets the merchant_display_name of this Merchant. + + """ return self.__merchant_display_name @merchant_display_name.setter def merchant_display_name(self, value): self.__merchant_display_name = value - @property def merchant_address(self): + """Gets the merchant_address of this Merchant. + + """ return self.__merchant_address @merchant_address.setter def merchant_address(self, value): self.__merchant_address = value - @property def merchant_register_date(self): + """Gets the merchant_register_date of this Merchant. + + """ return self.__merchant_register_date @merchant_register_date.setter def merchant_register_date(self, value): self.__merchant_register_date = value + @property + def store(self): + """Gets the store of this Merchant. + + """ + return self.__store + @store.setter + def store(self, value): + self.__store = value @property def merchant_type(self): + """Gets the merchant_type of this Merchant. + + """ return self.__merchant_type @merchant_type.setter def merchant_type(self, value): self.__merchant_type = value - @property - def store(self): - return self.__store - @store.setter - def store(self, value): - self.__store = value + def to_ams_dict(self): params = dict() - if hasattr(self, "reference_merchant_id") and self.reference_merchant_id: + if hasattr(self, "reference_merchant_id") and self.reference_merchant_id is not None: params['referenceMerchantId'] = self.reference_merchant_id - - if hasattr(self, "merchant_mcc") and self.merchant_mcc: + if hasattr(self, "merchant_mcc") and self.merchant_mcc is not None: params['merchantMCC'] = self.merchant_mcc - - if hasattr(self, "merchant_name") and self.merchant_name: + if hasattr(self, "merchant_name") and self.merchant_name is not None: params['merchantName'] = self.merchant_name - - if hasattr(self, "merchant_display_name") and self.merchant_display_name: + if hasattr(self, "merchant_display_name") and self.merchant_display_name is not None: params['merchantDisplayName'] = self.merchant_display_name - - if hasattr(self, "merchant_address") and self.merchant_address: + if hasattr(self, "merchant_address") and self.merchant_address is not None: params['merchantAddress'] = self.merchant_address - - if hasattr(self, "merchant_register_date") and self.merchant_register_date: + if hasattr(self, "merchant_register_date") and self.merchant_register_date is not None: params['merchantRegisterDate'] = self.merchant_register_date - - if hasattr(self, "merchant_type") and self.merchant_type: + if hasattr(self, "store") and self.store is not None: + params['store'] = self.store + if hasattr(self, "merchant_type") and self.merchant_type is not None: params['merchantType'] = self.merchant_type + return params - if hasattr(self, "store") and self.store: - params['store'] = self.store - return params + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'referenceMerchantId' in response_body: + self.__reference_merchant_id = response_body['referenceMerchantId'] + if 'merchantMCC' in response_body: + self.__merchant_mcc = response_body['merchantMCC'] + if 'merchantName' in response_body: + self.__merchant_name = response_body['merchantName'] + if 'merchantDisplayName' in response_body: + self.__merchant_display_name = response_body['merchantDisplayName'] + if 'merchantAddress' in response_body: + self.__merchant_address = Address() + self.__merchant_address.parse_rsp_body(response_body['merchantAddress']) + if 'merchantRegisterDate' in response_body: + self.__merchant_register_date = response_body['merchantRegisterDate'] + if 'store' in response_body: + self.__store = Store() + self.__store.parse_rsp_body(response_body['store']) + if 'merchantType' in response_body: + merchant_type_temp = MerchantType.value_of(response_body['merchantType']) + self.__merchant_type = merchant_type_temp diff --git a/com/alipay/ams/api/model/merchant_info.py b/com/alipay/ams/api/model/merchant_info.py index 56cc49d..9f124f2 100644 --- a/com/alipay/ams/api/model/merchant_info.py +++ b/com/alipay/ams/api/model/merchant_info.py @@ -1,79 +1,123 @@ -from com.alipay.ams.api.model.business_info import BusinessInfo +import json +from com.alipay.ams.api.model.legal_entity_type import LegalEntityType from com.alipay.ams.api.model.company import Company +from com.alipay.ams.api.model.business_info import BusinessInfo from com.alipay.ams.api.model.entity_associations import EntityAssociations -from com.alipay.ams.api.model.legal_entity_type import LegalEntityType + + class MerchantInfo: def __init__(self): - self.__reference_merchant_id = None - self.__login_id = None - self.__legal_entity_type = None # type: LegalEntityType - self.__company = None # type: Company - self.__business_info = None # type: BusinessInfo - self.__entity_associations = None # type: list[EntityAssociations] + + self.__reference_merchant_id = None # type: str + self.__login_id = None # type: str + self.__legal_entity_type = None # type: LegalEntityType + self.__company = None # type: Company + self.__business_info = None # type: BusinessInfo + self.__entity_associations = None # type: [EntityAssociations] + @property def reference_merchant_id(self): + """ + The unique ID that is assigned by the marketplace to identify the sub-merchant. referenceMerchantId that fails to register the sub-merchant can be used again. More information: Maximum length: 64 characters + """ return self.__reference_merchant_id @reference_merchant_id.setter def reference_merchant_id(self, value): self.__reference_merchant_id = value - @property def login_id(self): + """ + The sub-merchant's login ID to the marketplace platform. The value of this parameter is an email. The email that is successfully used to register with Alipay cannot be used again. More information: Maximum length: 64 characters + """ return self.__login_id @login_id.setter def login_id(self, value): self.__login_id = value - @property def legal_entity_type(self): + """Gets the legal_entity_type of this MerchantInfo. + + """ return self.__legal_entity_type @legal_entity_type.setter def legal_entity_type(self, value): self.__legal_entity_type = value - @property def company(self): + """Gets the company of this MerchantInfo. + + """ return self.__company @company.setter def company(self, value): self.__company = value - @property def business_info(self): + """Gets the business_info of this MerchantInfo. + + """ return self.__business_info @business_info.setter def business_info(self, value): self.__business_info = value - @property def entity_associations(self): + """ + The list of legal entities that are associated with the sub-merchant. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR, AU, SG, HK, GB, MY, US, or belongs to the European Union. More information: Maximum size: 100 elements + """ return self.__entity_associations @entity_associations.setter def entity_associations(self, value): self.__entity_associations = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, 'reference_merchant_id') and self.reference_merchant_id: + if hasattr(self, "reference_merchant_id") and self.reference_merchant_id is not None: params['referenceMerchantId'] = self.reference_merchant_id - if hasattr(self, 'login_id') and self.login_id: + if hasattr(self, "login_id") and self.login_id is not None: params['loginId'] = self.login_id - if hasattr(self, 'legal_entity_type') and self.legal_entity_type: - params['legalEntityType'] = self.legal_entity_type.value - if hasattr(self, 'company') and self.company: - params['company'] = self.company.to_ams_dict() - if hasattr(self, 'business_info') and self.business_info: - params['businessInfo'] = self.business_info.to_ams_dict() - if hasattr(self, 'entity_associations') and self.entity_associations: - params['entityAssociations'] = [entity_association.to_ams_dict() for entity_association in self.entity_associations] - - return params \ No newline at end of file + if hasattr(self, "legal_entity_type") and self.legal_entity_type is not None: + params['legalEntityType'] = self.legal_entity_type + if hasattr(self, "company") and self.company is not None: + params['company'] = self.company + if hasattr(self, "business_info") and self.business_info is not None: + params['businessInfo'] = self.business_info + if hasattr(self, "entity_associations") and self.entity_associations is not None: + params['entityAssociations'] = self.entity_associations + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'referenceMerchantId' in response_body: + self.__reference_merchant_id = response_body['referenceMerchantId'] + if 'loginId' in response_body: + self.__login_id = response_body['loginId'] + if 'legalEntityType' in response_body: + legal_entity_type_temp = LegalEntityType.value_of(response_body['legalEntityType']) + self.__legal_entity_type = legal_entity_type_temp + if 'company' in response_body: + self.__company = Company() + self.__company.parse_rsp_body(response_body['company']) + if 'businessInfo' in response_body: + self.__business_info = BusinessInfo() + self.__business_info.parse_rsp_body(response_body['businessInfo']) + if 'entityAssociations' in response_body: + self.__entity_associations = [] + for item in response_body['entityAssociations']: + obj = EntityAssociations() + obj.parse_rsp_body(item) + self.__entity_associations.append(obj) diff --git a/com/alipay/ams/api/model/merchant_type.py b/com/alipay/ams/api/model/merchant_type.py index da52a52..216677c 100644 --- a/com/alipay/ams/api/model/merchant_type.py +++ b/com/alipay/ams/api/model/merchant_type.py @@ -1,10 +1,21 @@ from enum import Enum, unique - - @unique class MerchantType(Enum): + """MerchantType枚举类""" + INDIVIDUAL = "INDIVIDUAL" ENTERPRISE = "ENTERPRISE" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if MerchantType.INDIVIDUAL.value == value: + return MerchantType.INDIVIDUAL + if MerchantType.ENTERPRISE.value == value: + return MerchantType.ENTERPRISE + return None diff --git a/com/alipay/ams/api/model/mpi_data.py b/com/alipay/ams/api/model/mpi_data.py new file mode 100644 index 0000000..416949c --- /dev/null +++ b/com/alipay/ams/api/model/mpi_data.py @@ -0,0 +1,82 @@ +import json + + + + +class MpiData: + def __init__(self): + + self.__three_ds_version = None # type: str + self.__eci = None # type: str + self.__cavv = None # type: str + self.__ds_transaction_id = None # type: str + + + @property + def three_ds_version(self): + """Gets the three_ds_version of this MpiData. + + """ + return self.__three_ds_version + + @three_ds_version.setter + def three_ds_version(self, value): + self.__three_ds_version = value + @property + def eci(self): + """Gets the eci of this MpiData. + + """ + return self.__eci + + @eci.setter + def eci(self, value): + self.__eci = value + @property + def cavv(self): + """Gets the cavv of this MpiData. + + """ + return self.__cavv + + @cavv.setter + def cavv(self, value): + self.__cavv = value + @property + def ds_transaction_id(self): + """Gets the ds_transaction_id of this MpiData. + + """ + return self.__ds_transaction_id + + @ds_transaction_id.setter + def ds_transaction_id(self, value): + self.__ds_transaction_id = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "three_ds_version") and self.three_ds_version is not None: + params['threeDSVersion'] = self.three_ds_version + if hasattr(self, "eci") and self.eci is not None: + params['eci'] = self.eci + if hasattr(self, "cavv") and self.cavv is not None: + params['cavv'] = self.cavv + if hasattr(self, "ds_transaction_id") and self.ds_transaction_id is not None: + params['dsTransactionId'] = self.ds_transaction_id + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'threeDSVersion' in response_body: + self.__three_ds_version = response_body['threeDSVersion'] + if 'eci' in response_body: + self.__eci = response_body['eci'] + if 'cavv' in response_body: + self.__cavv = response_body['cavv'] + if 'dsTransactionId' in response_body: + self.__ds_transaction_id = response_body['dsTransactionId'] diff --git a/com/alipay/ams/api/model/order.py b/com/alipay/ams/api/model/order.py index 3962e91..b101c3f 100644 --- a/com/alipay/ams/api/model/order.py +++ b/com/alipay/ams/api/model/order.py @@ -1,212 +1,253 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json from com.alipay.ams.api.model.amount import Amount -from com.alipay.ams.api.model.buyer import Buyer -from com.alipay.ams.api.model.env import Env -from com.alipay.ams.api.model.gaming import Gaming -from com.alipay.ams.api.model.goods import Goods -from com.alipay.ams.api.model.lodging import Lodging from com.alipay.ams.api.model.merchant import Merchant +from com.alipay.ams.api.model.goods import Goods from com.alipay.ams.api.model.shipping import Shipping +from com.alipay.ams.api.model.buyer import Buyer +from com.alipay.ams.api.model.env import Env from com.alipay.ams.api.model.transit import Transit +from com.alipay.ams.api.model.lodging import Lodging +from com.alipay.ams.api.model.gaming import Gaming + -class Order(object): +class Order: def __init__(self): - self.__reference_order_id = None - self.__order_description = None - self.__order_amount = None + + self.__reference_order_id = None # type: str + self.__order_description = None # type: str + self.__order_amount = None # type: Amount self.__merchant = None # type: Merchant - self.__goods = None # type: list[Goods] + self.__goods = None # type: [Goods] self.__shipping = None # type: Shipping self.__buyer = None # type: Buyer self.__env = None # type: Env - self.__extend_info = None + self.__extend_info = None # type: str self.__transit = None # type: Transit - self.lodging = None # type: Lodging + self.__lodging = None # type: Lodging self.__gaming = None # type: Gaming - self.__order_created_time = None - self.__need_declaration = None - self.__order_discount_amount = None # type: Amount - self.__sub_total_order_amount = None # type: Amount + self.__need_declaration = None # type: bool + self.__order_type = None # type: str + @property def reference_order_id(self): + """ + The unique ID to identify the order on the merchant side, which is assigned by the merchant that provides services or goods directly to the customer. This field is used for user consumption records display and other further actions such as disputes track or handling of customer complaints. More information: Maximum length: 64 characters + """ return self.__reference_order_id @reference_order_id.setter def reference_order_id(self, value): self.__reference_order_id = value - @property def order_description(self): + """ + Summary description of the order, which is used for user consumption records display or other further actions. More information: Maximum length: 256 characters + """ return self.__order_description @order_description.setter def order_description(self, value): self.__order_description = value - @property def order_amount(self): + """Gets the order_amount of this Order. + + """ return self.__order_amount @order_amount.setter def order_amount(self, value): self.__order_amount = value - @property def merchant(self): + """Gets the merchant of this Order. + + """ return self.__merchant @merchant.setter def merchant(self, value): self.__merchant = value - @property def goods(self): + """ + Goods information, including the ID, name, price, and quantity of the goods in the order. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum size: 100 elements + """ return self.__goods @goods.setter def goods(self, value): self.__goods = value - @property def shipping(self): + """Gets the shipping of this Order. + + """ return self.__shipping @shipping.setter def shipping(self, value): self.__shipping = value - @property def buyer(self): + """Gets the buyer of this Order. + + """ return self.__buyer @buyer.setter def buyer(self, value): self.__buyer = value - @property def env(self): + """Gets the env of this Order. + + """ return self.__env @env.setter def env(self, value): self.__env = value - @property def extend_info(self): + """Gets the extend_info of this Order. + + """ return self.__extend_info @extend_info.setter def extend_info(self, value): self.__extend_info = value - @property def transit(self): + """Gets the transit of this Order. + + """ return self.__transit @transit.setter def transit(self, value): self.__transit = value - @property def lodging(self): + """Gets the lodging of this Order. + + """ return self.__lodging @lodging.setter def lodging(self, value): self.__lodging = value - @property def gaming(self): + """Gets the gaming of this Order. + + """ return self.__gaming @gaming.setter def gaming(self, value): self.__gaming = value - - @property - def order_created_time(self): - return self.__order_created_time - - @order_created_time.setter - def order_created_time(self, value): - self.__order_created_time = value @property def need_declaration(self): + """Gets the need_declaration of this Order. + + """ return self.__need_declaration @need_declaration.setter def need_declaration(self, value): self.__need_declaration = value - @property - def order_discount_amount(self): - return self.__order_discount_amount - - @order_discount_amount.setter - def order_discount_amount(self, value): - self.__order_discount_amount = value + def order_type(self): + """ + test + """ + return self.__order_type + @order_type.setter + def order_type(self, value): + self.__order_type = value - @property - def sub_total_order_amount(self): - return self.__sub_total_order_amount - @sub_total_order_amount.setter - def sub_total_order_amount(self, value): - self.__sub_total_order_amount = value + def to_ams_dict(self): params = dict() - if hasattr(self, "reference_order_id") and self.reference_order_id: + if hasattr(self, "reference_order_id") and self.reference_order_id is not None: params['referenceOrderId'] = self.reference_order_id - - if hasattr(self, "order_description") and self.order_description: + if hasattr(self, "order_description") and self.order_description is not None: params['orderDescription'] = self.order_description - - if hasattr(self, "order_amount") and self.order_amount: + if hasattr(self, "order_amount") and self.order_amount is not None: params['orderAmount'] = self.order_amount - - if hasattr(self, "merchant") and self.merchant: + if hasattr(self, "merchant") and self.merchant is not None: params['merchant'] = self.merchant - - if hasattr(self, "goods") and self.goods: + if hasattr(self, "goods") and self.goods is not None: params['goods'] = self.goods - - if hasattr(self, "shipping") and self.shipping: + if hasattr(self, "shipping") and self.shipping is not None: params['shipping'] = self.shipping - - if hasattr(self, "buyer") and self.buyer: + if hasattr(self, "buyer") and self.buyer is not None: params['buyer'] = self.buyer - - if hasattr(self, "env") and self.env: + if hasattr(self, "env") and self.env is not None: params['env'] = self.env - - if hasattr(self, "extend_info") and self.extend_info: + if hasattr(self, "extend_info") and self.extend_info is not None: params['extendInfo'] = self.extend_info - - if hasattr(self, "transit") and self.transit: + if hasattr(self, "transit") and self.transit is not None: params['transit'] = self.transit - - if hasattr(self, "lodging") and self.lodging: + if hasattr(self, "lodging") and self.lodging is not None: params['lodging'] = self.lodging - - if hasattr(self, "gaming") and self.gaming: + if hasattr(self, "gaming") and self.gaming is not None: params['gaming'] = self.gaming - - if hasattr(self, "order_created_time") and self.order_created_time: - params['orderCreatedTime'] = self.order_created_time - - if hasattr(self, "need_declaration") and self.need_declaration: + if hasattr(self, "need_declaration") and self.need_declaration is not None: params['needDeclaration'] = self.need_declaration + if hasattr(self, "order_type") and self.order_type is not None: + params['orderType'] = self.order_type + return params - if hasattr(self, "order_discount_amount") and self.order_discount_amount: - params['orderDiscountAmount'] = self.order_discount_amount - - if hasattr(self, "sub_total_order_amount") and self.sub_total_order_amount: - params['subTotalOrderAmount'] = self.sub_total_order_amount - return params + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'referenceOrderId' in response_body: + self.__reference_order_id = response_body['referenceOrderId'] + if 'orderDescription' in response_body: + self.__order_description = response_body['orderDescription'] + if 'orderAmount' in response_body: + self.__order_amount = Amount() + self.__order_amount.parse_rsp_body(response_body['orderAmount']) + if 'merchant' in response_body: + self.__merchant = Merchant() + self.__merchant.parse_rsp_body(response_body['merchant']) + if 'goods' in response_body: + self.__goods = [] + for item in response_body['goods']: + obj = Goods() + obj.parse_rsp_body(item) + self.__goods.append(obj) + if 'shipping' in response_body: + self.__shipping = Shipping() + self.__shipping.parse_rsp_body(response_body['shipping']) + if 'buyer' in response_body: + self.__buyer = Buyer() + self.__buyer.parse_rsp_body(response_body['buyer']) + if 'env' in response_body: + self.__env = Env() + self.__env.parse_rsp_body(response_body['env']) + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'transit' in response_body: + self.__transit = Transit() + self.__transit.parse_rsp_body(response_body['transit']) + if 'lodging' in response_body: + self.__lodging = Lodging() + self.__lodging.parse_rsp_body(response_body['lodging']) + if 'gaming' in response_body: + self.__gaming = Gaming() + self.__gaming.parse_rsp_body(response_body['gaming']) + if 'needDeclaration' in response_body: + self.__need_declaration = response_body['needDeclaration'] + if 'orderType' in response_body: + self.__order_type = response_body['orderType'] diff --git a/com/alipay/ams/api/model/order_code_form.py b/com/alipay/ams/api/model/order_code_form.py index 4b377f1..6016085 100644 --- a/com/alipay/ams/api/model/order_code_form.py +++ b/com/alipay/ams/api/model/order_code_form.py @@ -1,66 +1,87 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - from com.alipay.ams.api.model.code_detail import CodeDetail -class OrderCodeForm(object): + + +class OrderCodeForm: def __init__(self): - self.__payment_method_type = None - self.__expire_time = None - self.__code_details = None # type: list[CodeDetail] - self.__extend_info = None + + self.__payment_method_type = None # type: str + self.__expire_time = None # type: str + self.__code_details = None # type: [CodeDetail] + self.__extend_info = None # type: str + @property def payment_method_type(self): + """Gets the payment_method_type of this OrderCodeForm. + + """ return self.__payment_method_type @payment_method_type.setter def payment_method_type(self, value): self.__payment_method_type = value - @property def expire_time(self): + """ + Expiry time of the order code information. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__expire_time @expire_time.setter def expire_time(self, value): self.__expire_time = value - @property def code_details(self): + """ + Details about the code. More information: Maximum size: 4 elements + """ return self.__code_details @code_details.setter def code_details(self, value): self.__code_details = value - @property def extend_info(self): + """ + Extended information. Note: This field is returned when extended information exists. More information: Maximum length: 2048 characters + """ return self.__extend_info @extend_info.setter def extend_info(self, value): self.__extend_info = value - def parse_rsp_body(self, order_code_form_body): - if type(order_code_form_body) == str: - order_code_form_body = json.loads(order_code_form_body) - - if 'paymentMethodType' in order_code_form_body: - self.__payment_method_type = order_code_form_body['paymentMethodType'] - if 'expireTime' in order_code_form_body: - self.__expire_time = order_code_form_body['expireTime'] - - if 'codeDetails' in order_code_form_body: + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "payment_method_type") and self.payment_method_type is not None: + params['paymentMethodType'] = self.payment_method_type + if hasattr(self, "expire_time") and self.expire_time is not None: + params['expireTime'] = self.expire_time + if hasattr(self, "code_details") and self.code_details is not None: + params['codeDetails'] = self.code_details + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'paymentMethodType' in response_body: + self.__payment_method_type = response_body['paymentMethodType'] + if 'expireTime' in response_body: + self.__expire_time = response_body['expireTime'] + if 'codeDetails' in response_body: self.__code_details = [] - for entry in order_code_form_body['codeDetails']: - code_detail = CodeDetail() - code_detail.parse_rsp_body(entry) - self.__code_details.append(code_detail) - - if 'extendInfo' in order_code_form_body: - self.__extend_info = order_code_form_body['extendInfo'] + for item in response_body['codeDetails']: + obj = CodeDetail() + obj.parse_rsp_body(item) + self.__code_details.append(obj) + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] diff --git a/com/alipay/ams/api/model/order_info.py b/com/alipay/ams/api/model/order_info.py index fbb9883..ed8f07b 100644 --- a/com/alipay/ams/api/model/order_info.py +++ b/com/alipay/ams/api/model/order_info.py @@ -1,22 +1,39 @@ import json - from com.alipay.ams.api.model.amount import Amount -class OrderInfo(object): + + +class OrderInfo: def __init__(self): - self.__order_amount = None #type: Amount + + self.__order_amount = None # type: Amount + @property def order_amount(self): + """Gets the order_amount of this OrderInfo. + + """ return self.__order_amount @order_amount.setter def order_amount(self, value): self.__order_amount = value + + + def to_ams_dict(self): params = dict() - if self.order_amount is not None: - params['orderAmount'] = self.order_amount.to_ams_dict() + if hasattr(self, "order_amount") and self.order_amount is not None: + params['orderAmount'] = self.order_amount return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'orderAmount' in response_body: + self.__order_amount = Amount() + self.__order_amount.parse_rsp_body(response_body['orderAmount']) diff --git a/com/alipay/ams/api/model/os_type.py b/com/alipay/ams/api/model/os_type.py index 4e3c618..aa00832 100644 --- a/com/alipay/ams/api/model/os_type.py +++ b/com/alipay/ams/api/model/os_type.py @@ -1,12 +1,21 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class OsType(Enum): + """OsType枚举类""" + IOS = "IOS" ANDROID = "ANDROID" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if OsType.IOS.value == value: + return OsType.IOS + if OsType.ANDROID.value == value: + return OsType.ANDROID + return None diff --git a/com/alipay/ams/api/model/passenger.py b/com/alipay/ams/api/model/passenger.py new file mode 100644 index 0000000..2dc6142 --- /dev/null +++ b/com/alipay/ams/api/model/passenger.py @@ -0,0 +1,69 @@ +import json +from com.alipay.ams.api.model.user_name import UserName + + + + +class Passenger: + def __init__(self): + + self.__passenger_name = None # type: UserName + self.__passenger_email = None # type: str + self.__passenger_phone_no = None # type: str + + + @property + def passenger_name(self): + """Gets the passenger_name of this Passenger. + + """ + return self.__passenger_name + + @passenger_name.setter + def passenger_name(self, value): + self.__passenger_name = value + @property + def passenger_email(self): + """Gets the passenger_email of this Passenger. + + """ + return self.__passenger_email + + @passenger_email.setter + def passenger_email(self, value): + self.__passenger_email = value + @property + def passenger_phone_no(self): + """Gets the passenger_phone_no of this Passenger. + + """ + return self.__passenger_phone_no + + @passenger_phone_no.setter + def passenger_phone_no(self, value): + self.__passenger_phone_no = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "passenger_name") and self.passenger_name is not None: + params['passengerName'] = self.passenger_name + if hasattr(self, "passenger_email") and self.passenger_email is not None: + params['passengerEmail'] = self.passenger_email + if hasattr(self, "passenger_phone_no") and self.passenger_phone_no is not None: + params['passengerPhoneNo'] = self.passenger_phone_no + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'passengerName' in response_body: + self.__passenger_name = UserName() + self.__passenger_name.parse_rsp_body(response_body['passengerName']) + if 'passengerEmail' in response_body: + self.__passenger_email = response_body['passengerEmail'] + if 'passengerPhoneNo' in response_body: + self.__passenger_phone_no = response_body['passengerPhoneNo'] diff --git a/com/alipay/ams/api/model/payment_factor.py b/com/alipay/ams/api/model/payment_factor.py index e02ea67..0a6d627 100644 --- a/com/alipay/ams/api/model/payment_factor.py +++ b/com/alipay/ams/api/model/payment_factor.py @@ -1,73 +1,101 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -from com.alipay.ams.api.model.capture_mode import CaptureMode +import json from com.alipay.ams.api.model.in_store_payment_scenario import InStorePaymentScenario from com.alipay.ams.api.model.presentment_mode import PresentmentMode -class PaymentFactor(object): + + +class PaymentFactor: def __init__(self): - self.__is_payment_evaluation = None + + self.__is_payment_evaluation = None # type: bool self.__in_store_payment_scenario = None # type: InStorePaymentScenario self.__presentment_mode = None # type: PresentmentMode - self.__capture_mode = None # type: CaptureMode - self.__is_authorization = None + self.__capture_mode = None # type: str + self.__is_authorization = None # type: bool + @property def is_payment_evaluation(self): + """Gets the is_payment_evaluation of this PaymentFactor. + + """ return self.__is_payment_evaluation @is_payment_evaluation.setter def is_payment_evaluation(self, value): self.__is_payment_evaluation = value - @property def in_store_payment_scenario(self): + """Gets the in_store_payment_scenario of this PaymentFactor. + + """ return self.__in_store_payment_scenario @in_store_payment_scenario.setter def in_store_payment_scenario(self, value): self.__in_store_payment_scenario = value - @property def presentment_mode(self): + """Gets the presentment_mode of this PaymentFactor. + + """ return self.__presentment_mode @presentment_mode.setter def presentment_mode(self, value): self.__presentment_mode = value + @property + def capture_mode(self): + """ + Indicates the method for capturing funds after the user authorizes the payment. Valid values are: AUTOMATIC: indicates that Antom automatically captures the funds after the authorization. The same applies when the value is empty or you do not pass in this parameter. MANUAL: indicates that you manually capture the funds by calling the capture (Checkout Payment) API. Specify this parameter if you want to designate the capture mode of the payment. More information: Maximum length: 64 characters + """ + return self.__capture_mode + @capture_mode.setter + def capture_mode(self, value): + self.__capture_mode = value @property def is_authorization(self): + """ + Indicates whether the payment scenario is authorization. Specify this parameter when the value of paymentMethodType is CARD and you integrate the client-side SDK. Valid values of this parameter are: true: indicates that the payment scenario is authorization. false: indicates that the payment scenario is a regular payment without authorization. Under the authorization scenario, the payment funds are guaranteed and held on the payment method side. You can use the capture (Checkout Payment) API to deduct the payment funds. + """ return self.__is_authorization @is_authorization.setter def is_authorization(self, value): self.__is_authorization = value - @property - def capture_mode(self): - return self.__capture_mode - @capture_mode.setter - def capture_mode(self, value): - self.__capture_mode = value + def to_ams_dict(self): params = dict() - if hasattr(self, "is_payment_evaluation") and self.__is_payment_evaluation: + if hasattr(self, "is_payment_evaluation") and self.is_payment_evaluation is not None: params['isPaymentEvaluation'] = self.is_payment_evaluation - - if hasattr(self, "in_store_payment_scenario") and self.in_store_payment_scenario: + if hasattr(self, "in_store_payment_scenario") and self.in_store_payment_scenario is not None: params['inStorePaymentScenario'] = self.in_store_payment_scenario - - if hasattr(self, "presentment_mode") and self.presentment_mode: + if hasattr(self, "presentment_mode") and self.presentment_mode is not None: params['presentmentMode'] = self.presentment_mode - - if hasattr(self, "is_authorization") and self.is_authorization: + if hasattr(self, "capture_mode") and self.capture_mode is not None: + params['captureMode'] = self.capture_mode + if hasattr(self, "is_authorization") and self.is_authorization is not None: params['isAuthorization'] = self.is_authorization + return params - if hasattr(self, "capture_mode") and self.capture_mode: - params['captureMode'] = self.capture_mode - return params + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'isPaymentEvaluation' in response_body: + self.__is_payment_evaluation = response_body['isPaymentEvaluation'] + if 'inStorePaymentScenario' in response_body: + in_store_payment_scenario_temp = InStorePaymentScenario.value_of(response_body['inStorePaymentScenario']) + self.__in_store_payment_scenario = in_store_payment_scenario_temp + if 'presentmentMode' in response_body: + presentment_mode_temp = PresentmentMode.value_of(response_body['presentmentMode']) + self.__presentment_mode = presentment_mode_temp + if 'captureMode' in response_body: + self.__capture_mode = response_body['captureMode'] + if 'isAuthorization' in response_body: + self.__is_authorization = response_body['isAuthorization'] diff --git a/com/alipay/ams/api/model/payment_method.py b/com/alipay/ams/api/model/payment_method.py index 1a37d4f..492dceb 100644 --- a/com/alipay/ams/api/model/payment_method.py +++ b/com/alipay/ams/api/model/payment_method.py @@ -1,86 +1,112 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import json -class PaymentMethod(object): + + +class PaymentMethod: def __init__(self): - self.__payment_method_id = None - self.__payment_method_type = None - self.__payment_method_meta_data = None #type: map - self.__customer_id = None - self.__extend_info = None + + self.__payment_method_type = None # type: str + self.__payment_method_id = None # type: str + self.__payment_method_meta_data = None # type: {str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},)} + self.__customer_id = None # type: str + self.__extend_info = None # type: str + self.__require_issuer_authentication = None # type: bool + @property def payment_method_type(self): + """ + The payment method that is used to accept the subscription payment. See Payment methods to check the valid values. Note: Card payment method is not currently supported when you work with Antom as your acquirer. More information: Maximum length: 64 characters + """ return self.__payment_method_type @payment_method_type.setter def payment_method_type(self, value): self.__payment_method_type = value - @property def payment_method_id(self): + """ + The unique ID that is used to identify a payment method. Pass the corresponding token to this field when the user has a bound payment method. More information: Maximum length: 128 characters + """ return self.__payment_method_id @payment_method_id.setter def payment_method_id(self, value): self.__payment_method_id = value - @property def payment_method_meta_data(self): + """Gets the payment_method_meta_data of this PaymentMethod. + + """ return self.__payment_method_meta_data @payment_method_meta_data.setter def payment_method_meta_data(self, value): self.__payment_method_meta_data = value - @property def customer_id(self): + """Gets the customer_id of this PaymentMethod. + + """ return self.__customer_id @customer_id.setter def customer_id(self, value): self.__customer_id = value - @property def extend_info(self): + """Gets the extend_info of this PaymentMethod. + + """ return self.__extend_info @extend_info.setter def extend_info(self, value): self.__extend_info = value + @property + def require_issuer_authentication(self): + """Gets the require_issuer_authentication of this PaymentMethod. + + """ + return self.__require_issuer_authentication + + @require_issuer_authentication.setter + def require_issuer_authentication(self, value): + self.__require_issuer_authentication = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "payment_method_type") and self.payment_method_type: + if hasattr(self, "payment_method_type") and self.payment_method_type is not None: params['paymentMethodType'] = self.payment_method_type - - if hasattr(self, "payment_method_meta_data") and self.payment_method_meta_data: + if hasattr(self, "payment_method_id") and self.payment_method_id is not None: + params['paymentMethodId'] = self.payment_method_id + if hasattr(self, "payment_method_meta_data") and self.payment_method_meta_data is not None: params['paymentMethodMetaData'] = self.payment_method_meta_data - - if hasattr(self, "customer_id") and self.customer_id: + if hasattr(self, "customer_id") and self.customer_id is not None: params['customerId'] = self.customer_id - - if hasattr(self, "payment_method_id") and self.payment_method_id: - params['paymentMethodId'] = self.payment_method_id - - if hasattr(self, "extend_info") and self.extend_info: + if hasattr(self, "extend_info") and self.extend_info is not None: params['extendInfo'] = self.extend_info - + if hasattr(self, "require_issuer_authentication") and self.require_issuer_authentication is not None: + params['requireIssuerAuthentication'] = self.require_issuer_authentication return params + def parse_rsp_body(self, response_body): - if type(response_body) == str: + if isinstance(response_body, str): response_body = json.loads(response_body) - if 'paymentMethodType' in response_body: - self.transfer_from_method = response_body['paymentMethodType'] - if hasattr(self, "payment_method_meta_data") and self.payment_method_meta_data: - self.payment_method_meta_data = response_body['paymentMethodMetaData'] - if 'customerId' in response_body: - self.customer_id = response_body['customerId'] + self.__payment_method_type = response_body['paymentMethodType'] if 'paymentMethodId' in response_body: - self.payment_method_id = response_body['paymentMethodId'] + self.__payment_method_id = response_body['paymentMethodId'] + if 'paymentMethodMetaData' in response_body: + self.__payment_method_meta_data = response_body['paymentMethodMetaData'] + if 'customerId' in response_body: + self.__customer_id = response_body['customerId'] if 'extendInfo' in response_body: - self.extend_info = response_body['extendInfo'] \ No newline at end of file + self.__extend_info = response_body['extendInfo'] + if 'requireIssuerAuthentication' in response_body: + self.__require_issuer_authentication = response_body['requireIssuerAuthentication'] diff --git a/com/alipay/ams/api/model/payment_method_category_type.py b/com/alipay/ams/api/model/payment_method_category_type.py index e05c9d8..52337c8 100644 --- a/com/alipay/ams/api/model/payment_method_category_type.py +++ b/com/alipay/ams/api/model/payment_method_category_type.py @@ -1,19 +1,17 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class PaymentMethodCategoryType(Enum): - WALLET = "WALLET" - CARD = "CARD" + """PaymentMethodCategoryType枚举类""" + ALIPAY_PLUS = "ALIPAY_PLUS" - BANK_TRANSFER = "BANK_TRANSFER" + WALLET = "WALLET" MOBILE_BANKING_APP = "MOBILE_BANKING_APP" + BANK_TRANSFER = "BANK_TRANSFER" ONLINE_BANKING = "ONLINE_BANKING" + CARD = "CARD" OTC = "OTC" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name @staticmethod @@ -21,9 +19,18 @@ def value_of(value): if not value: return None + if PaymentMethodCategoryType.ALIPAY_PLUS.value == value: + return PaymentMethodCategoryType.ALIPAY_PLUS if PaymentMethodCategoryType.WALLET.value == value: return PaymentMethodCategoryType.WALLET - elif PaymentMethodCategoryType.CARD.value == value: + if PaymentMethodCategoryType.MOBILE_BANKING_APP.value == value: + return PaymentMethodCategoryType.MOBILE_BANKING_APP + if PaymentMethodCategoryType.BANK_TRANSFER.value == value: + return PaymentMethodCategoryType.BANK_TRANSFER + if PaymentMethodCategoryType.ONLINE_BANKING.value == value: + return PaymentMethodCategoryType.ONLINE_BANKING + if PaymentMethodCategoryType.CARD.value == value: return PaymentMethodCategoryType.CARD - else: - return None + if PaymentMethodCategoryType.OTC.value == value: + return PaymentMethodCategoryType.OTC + return None diff --git a/com/alipay/ams/api/model/payment_method_detail.py b/com/alipay/ams/api/model/payment_method_detail.py index 318b90b..a0dde6f 100644 --- a/com/alipay/ams/api/model/payment_method_detail.py +++ b/com/alipay/ams/api/model/payment_method_detail.py @@ -1,129 +1,169 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - +from com.alipay.ams.api.model.payment_method_detail_type import PaymentMethodDetailType from com.alipay.ams.api.model.card_payment_method_detail import CardPaymentMethodDetail -from com.alipay.ams.api.model.coupon_payment_method_detail import CouponPaymentMethodDetail -from com.alipay.ams.api.model.discount_payment_method_detail import DiscountPaymentMethodDetail from com.alipay.ams.api.model.external_payment_method_detail import ExternalPaymentMethodDetail -from com.alipay.ams.api.model.payment_method_detail_type import PaymentMethodDetailType +from com.alipay.ams.api.model.discount_payment_method_detail import DiscountPaymentMethodDetail +from com.alipay.ams.api.model.coupon_payment_method_detail import CouponPaymentMethodDetail +from com.alipay.ams.api.model.wallet import Wallet + -class PaymentMethodDetail(object): +class PaymentMethodDetail: def __init__(self): + self.__payment_method_detail_type = None # type: PaymentMethodDetailType self.__card = None # type: CardPaymentMethodDetail self.__external_account = None # type: ExternalPaymentMethodDetail self.__discount = None # type: DiscountPaymentMethodDetail self.__coupon = None # type: CouponPaymentMethodDetail - self.__extend_info = None - self.__payment_method_type = None - + self.__payment_method_type = None # type: str + self.__extend_info = None # type: str + self.__wallet = None # type: Wallet + self.__interaction_type = None # type: str + @property def payment_method_detail_type(self): + """Gets the payment_method_detail_type of this PaymentMethodDetail. + + """ return self.__payment_method_detail_type + @payment_method_detail_type.setter + def payment_method_detail_type(self, value): + self.__payment_method_detail_type = value @property def card(self): + """Gets the card of this PaymentMethodDetail. + + """ return self.__card + @card.setter + def card(self, value): + self.__card = value @property def external_account(self): + """Gets the external_account of this PaymentMethodDetail. + + """ return self.__external_account + @external_account.setter + def external_account(self, value): + self.__external_account = value @property def discount(self): + """Gets the discount of this PaymentMethodDetail. + + """ return self.__discount + @discount.setter + def discount(self, value): + self.__discount = value @property def coupon(self): + """Gets the coupon of this PaymentMethodDetail. + + """ return self.__coupon - @property - def extend_info(self): - return self.__extend_info - + @coupon.setter + def coupon(self, value): + self.__coupon = value @property def payment_method_type(self): + """ + The type of payment method to be vaulted. The value of this parameter is fixed to CARD. More information: Maximum length: 64 characters + """ return self.__payment_method_type @payment_method_type.setter def payment_method_type(self, value): self.__payment_method_type = value - @card.setter - def card(self, value): - self.__card = value - @external_account.setter - def external_account(self, value): - self.__external_account = value - @discount.setter - def discount(self, value): - self.__discount = value - @coupon.setter - def coupon(self, value): - self.__coupon = value + @property + def extend_info(self): + """Gets the extend_info of this PaymentMethodDetail. + + """ + return self.__extend_info + @extend_info.setter def extend_info(self, value): self.__extend_info = value + @property + def wallet(self): + """Gets the wallet of this PaymentMethodDetail. + + """ + return self.__wallet + + @wallet.setter + def wallet(self, value): + self.__wallet = value + @property + def interaction_type(self): + """Gets the interaction_type of this PaymentMethodDetail. + + """ + return self.__interaction_type + @interaction_type.setter + def interaction_type(self, value): + self.__interaction_type = value - def parse_rsp_body(self, external_payment_method_detail_body): - if type(external_payment_method_detail_body) == str: - external_payment_method_detail_body = json.loads(external_payment_method_detail_body) - - if 'paymentMethodDetailType' in external_payment_method_detail_body: - payment_method_detail_type = PaymentMethodDetailType.value_of( - external_payment_method_detail_body['paymentMethodDetailType']) - self.__payment_method_detail_type = payment_method_detail_type - - if 'card' in external_payment_method_detail_body: - card = CardPaymentMethodDetail() - card.parse_rsp_body(external_payment_method_detail_body['card']) - self.__card = card - - if 'externalAccount' in external_payment_method_detail_body: - external_account = ExternalPaymentMethodDetail() - external_account.parse_rsp_body(external_payment_method_detail_body['externalAccount']) - self.__external_account = external_account - - if 'discount' in external_payment_method_detail_body: - discount = DiscountPaymentMethodDetail() - discount.parse_rsp_body(external_payment_method_detail_body['discount']) - self.__discount = discount - - if 'coupon' in external_payment_method_detail_body: - coupon = CouponPaymentMethodDetail() - coupon.parse_rsp_body(external_payment_method_detail_body['coupon']) - self.__coupon = coupon - - if 'extendInfo' in external_payment_method_detail_body: - self.__extend_info = external_payment_method_detail_body['extendInfo'] - - if 'paymentMethodType' in external_payment_method_detail_body: - self.__payment_method_type = external_payment_method_detail_body['paymentMethodType'] - + def to_ams_dict(self): params = dict() - if self.payment_method_detail_type: - params['paymentMethodDetailType'] = self.payment_method_detail_type.name - if self.card: - params['card'] = self.card.to_ams_dict() - if self.external_account: - params['externalAccount'] = self.external_account.to_ams_dict() - - if self.discount: - params['discount'] = self.discount.to_ams_dict() - if self.coupon: - params['coupon'] = self.coupon.to_ams_dict() - if self.extend_info: - params['extendInfo'] = self.extend_info - if self.payment_method_type: + if hasattr(self, "payment_method_detail_type") and self.payment_method_detail_type is not None: + params['paymentMethodDetailType'] = self.payment_method_detail_type + if hasattr(self, "card") and self.card is not None: + params['card'] = self.card + if hasattr(self, "external_account") and self.external_account is not None: + params['externalAccount'] = self.external_account + if hasattr(self, "discount") and self.discount is not None: + params['discount'] = self.discount + if hasattr(self, "coupon") and self.coupon is not None: + params['coupon'] = self.coupon + if hasattr(self, "payment_method_type") and self.payment_method_type is not None: params['paymentMethodType'] = self.payment_method_type - - - return params \ No newline at end of file + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + if hasattr(self, "wallet") and self.wallet is not None: + params['wallet'] = self.wallet + if hasattr(self, "interaction_type") and self.interaction_type is not None: + params['interactionType'] = self.interaction_type + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'paymentMethodDetailType' in response_body: + payment_method_detail_type_temp = PaymentMethodDetailType.value_of(response_body['paymentMethodDetailType']) + self.__payment_method_detail_type = payment_method_detail_type_temp + if 'card' in response_body: + self.__card = CardPaymentMethodDetail() + self.__card.parse_rsp_body(response_body['card']) + if 'externalAccount' in response_body: + self.__external_account = ExternalPaymentMethodDetail() + self.__external_account.parse_rsp_body(response_body['externalAccount']) + if 'discount' in response_body: + self.__discount = DiscountPaymentMethodDetail() + self.__discount.parse_rsp_body(response_body['discount']) + if 'coupon' in response_body: + self.__coupon = CouponPaymentMethodDetail() + self.__coupon.parse_rsp_body(response_body['coupon']) + if 'paymentMethodType' in response_body: + self.__payment_method_type = response_body['paymentMethodType'] + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'wallet' in response_body: + self.__wallet = Wallet() + self.__wallet.parse_rsp_body(response_body['wallet']) + if 'interactionType' in response_body: + self.__interaction_type = response_body['interactionType'] diff --git a/com/alipay/ams/api/model/payment_method_detail_type.py b/com/alipay/ams/api/model/payment_method_detail_type.py index 9ef21b2..5e21168 100644 --- a/com/alipay/ams/api/model/payment_method_detail_type.py +++ b/com/alipay/ams/api/model/payment_method_detail_type.py @@ -1,16 +1,14 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class PaymentMethodDetailType(Enum): + """PaymentMethodDetailType枚举类""" + CARD = "CARD" EXTERNALACCOUNT = "EXTERNALACCOUNT" COUPON = "COUPON" DISCOUNT = "DISCOUNT" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name @staticmethod @@ -20,11 +18,10 @@ def value_of(value): if PaymentMethodDetailType.CARD.value == value: return PaymentMethodDetailType.CARD - elif PaymentMethodDetailType.EXTERNALACCOUNT.value == value: + if PaymentMethodDetailType.EXTERNALACCOUNT.value == value: return PaymentMethodDetailType.EXTERNALACCOUNT - elif PaymentMethodDetailType.COUPON.value == value: + if PaymentMethodDetailType.COUPON.value == value: return PaymentMethodDetailType.COUPON - elif PaymentMethodDetailType.DISCOUNT.value == value: + if PaymentMethodDetailType.DISCOUNT.value == value: return PaymentMethodDetailType.DISCOUNT - else: - return None + return None diff --git a/com/alipay/ams/api/model/payment_method_info.py b/com/alipay/ams/api/model/payment_method_info.py index 9accd6b..854c606 100644 --- a/com/alipay/ams/api/model/payment_method_info.py +++ b/com/alipay/ams/api/model/payment_method_info.py @@ -1,53 +1,97 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -class PaymentMethodInfo(object): + +class PaymentMethodInfo: def __init__(self): - self.__payment_method_type = None - self.__payment_method_detail = None - self.__enabled = None - self.__preferred = None - self.__extend_info = None + + self.__payment_method_type = None # type: str + self.__payment_method_detail = None # type: str + self.__enabled = None # type: bool + self.__preferred = None # type: bool + self.__extend_info = None # type: str + @property def payment_method_type(self): + """Gets the payment_method_type of this PaymentMethodInfo. + + """ return self.__payment_method_type + @payment_method_type.setter + def payment_method_type(self, value): + self.__payment_method_type = value @property def payment_method_detail(self): + """Gets the payment_method_detail of this PaymentMethodInfo. + + """ return self.__payment_method_detail + @payment_method_detail.setter + def payment_method_detail(self, value): + self.__payment_method_detail = value @property def enabled(self): + """Gets the enabled of this PaymentMethodInfo. + + """ return self.__enabled + @enabled.setter + def enabled(self, value): + self.__enabled = value @property def preferred(self): + """Gets the preferred of this PaymentMethodInfo. + + """ return self.__preferred + @preferred.setter + def preferred(self, value): + self.__preferred = value @property def extend_info(self): + """Gets the extend_info of this PaymentMethodInfo. + + """ return self.__extend_info - def parse_rsp_body(self, payment_method_info_body): - if type(payment_method_info_body) == str: - payment_method_info_body = json.loads(payment_method_info_body) + @extend_info.setter + def extend_info(self, value): + self.__extend_info = value - if 'paymentMethodType' in payment_method_info_body: - self.__payment_method_type = payment_method_info_body['paymentMethodType'] - if 'paymentMethodDetail' in payment_method_info_body: - self.__payment_method_detail = payment_method_info_body['paymentMethodDetail'] + - if 'enabled' in payment_method_info_body: - self.__enabled = payment_method_info_body['enabled'] + def to_ams_dict(self): + params = dict() + if hasattr(self, "payment_method_type") and self.payment_method_type is not None: + params['paymentMethodType'] = self.payment_method_type + if hasattr(self, "payment_method_detail") and self.payment_method_detail is not None: + params['paymentMethodDetail'] = self.payment_method_detail + if hasattr(self, "enabled") and self.enabled is not None: + params['enabled'] = self.enabled + if hasattr(self, "preferred") and self.preferred is not None: + params['preferred'] = self.preferred + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + return params - if 'preferred' in payment_method_info_body: - self.__preferred = payment_method_info_body['preferred'] - if 'extendInfo' in payment_method_info_body: - self.__extend_info = payment_method_info_body['extendInfo'] + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'paymentMethodType' in response_body: + self.__payment_method_type = response_body['paymentMethodType'] + if 'paymentMethodDetail' in response_body: + self.__payment_method_detail = response_body['paymentMethodDetail'] + if 'enabled' in response_body: + self.__enabled = response_body['enabled'] + if 'preferred' in response_body: + self.__preferred = response_body['preferred'] + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] diff --git a/com/alipay/ams/api/model/payment_method_type_item.py b/com/alipay/ams/api/model/payment_method_type_item.py index 1ee3166..d01a260 100644 --- a/com/alipay/ams/api/model/payment_method_type_item.py +++ b/com/alipay/ams/api/model/payment_method_type_item.py @@ -1,40 +1,67 @@ -class PaymentMethodTypeItem: +import json + + + +class PaymentMethodTypeItem: def __init__(self): - self.__payment_method_type = None - self.__payment_method_order = None - self.__express_checkout = None + + self.__payment_method_type = None # type: str + self.__payment_method_order = None # type: str + self.__express_checkout = None # type: str + @property def payment_method_type(self): + """ + The payment method type that is included in payment method options. See Payment methods to check the valid values. More information: Value range: 64 + """ return self.__payment_method_type @payment_method_type.setter def payment_method_type(self, value): self.__payment_method_type = value - @property def payment_method_order(self): + """ + The priority order of the payment methods configured by the user is indicated by numerical values, with smaller numbers representing higher priority. If the user does not specify a setting, Antom will apply a default sorting method. More information: Value range: [1, +∞) + """ return self.__payment_method_order @payment_method_order.setter def payment_method_order(self, value): self.__payment_method_order = value - @property def express_checkout(self): + """ + Indicates whether the payment method selected by the user is displayed as a quick payment method. The currently supported quick payment methods include ALIPAY_CN, APPLEPAY, and GOOGLAPAY. The valid values include: true: The payment method selected by the user is displayed as a quick payment method. false: The payment method selected by the user is not displayed as a quick payment method. + """ return self.__express_checkout @express_checkout.setter def express_checkout(self, value): self.__express_checkout = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "payment_method_type") and self.payment_method_type: + if hasattr(self, "payment_method_type") and self.payment_method_type is not None: params['paymentMethodType'] = self.payment_method_type - if hasattr(self, "payment_method_order") and self.payment_method_order: + if hasattr(self, "payment_method_order") and self.payment_method_order is not None: params['paymentMethodOrder'] = self.payment_method_order - if hasattr(self, "express_checkout") and self.express_checkout: - params['expressCheckout'] = self.express_checkout.to_ams_dict() - return params \ No newline at end of file + if hasattr(self, "express_checkout") and self.express_checkout is not None: + params['expressCheckout'] = self.express_checkout + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'paymentMethodType' in response_body: + self.__payment_method_type = response_body['paymentMethodType'] + if 'paymentMethodOrder' in response_body: + self.__payment_method_order = response_body['paymentMethodOrder'] + if 'expressCheckout' in response_body: + self.__express_checkout = response_body['expressCheckout'] diff --git a/com/alipay/ams/api/model/payment_option.py b/com/alipay/ams/api/model/payment_option.py index d2aaf7e..6042ac5 100644 --- a/com/alipay/ams/api/model/payment_option.py +++ b/com/alipay/ams/api/model/payment_option.py @@ -1,137 +1,248 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - -from com.alipay.ams.api.model.disable_reason_type import DisableReasonType -from com.alipay.ams.api.model.amount_limit_info import AmountLimitInfo -from com.alipay.ams.api.model.installment import Installment -from com.alipay.ams.api.model.logo import Logo -from com.alipay.ams.api.model.paymentOptionDetail import PaymentOptionDetail from com.alipay.ams.api.model.payment_method_category_type import PaymentMethodCategoryType +from com.alipay.ams.api.model. amount_limit import AmountLimit +from com.alipay.ams.api.model.payment_option_detail import PaymentOptionDetail +from com.alipay.ams.api.model.logo import Logo +from com.alipay.ams.api.model.installment import Installment from com.alipay.ams.api.model.promotion_info import PromotionInfo -class PaymentOption(object): + +class PaymentOption: def __init__(self): - self.__payment_method_type = None + + self.__payment_method_type = None # type: str self.__payment_method_category = None # type: PaymentMethodCategoryType - self.__enabled = None - self.__preferred = None - self.__disable_reason = None # type: DisableReasonType - self.__amount_limit_info_map = None - self.__supported_currencies = None + self.__payment_method_region = None # type: [str] + self.__enabled = None # type: bool + self.__preferred = None # type: bool + self.__disable_reason = None # type: str + self.__amount_limit_info_map = None # type: {str: (AmountLimit,)} + self.__supported_currencies = None # type: [str] self.__payment_option_detail = None # type: PaymentOptionDetail - self.__extend_info = None + self.__extend_info = None # type: str self.__logo = None # type: Logo - self.__promo_names = None + self.__promo_names = None # type: [str] self.__installment = None # type: Installment - self.__promotion_infos = None # type: list[PromotionInfo] - self.__payment_method_region = None # type: list[str] + self.__promotion_infos = None # type: [PromotionInfo] + @property def payment_method_type(self): + """ + The payment method type. See Payment methods to check the valid values. More information: Maximum length: 64 characters + """ return self.__payment_method_type + @payment_method_type.setter + def payment_method_type(self, value): + self.__payment_method_type = value @property def payment_method_category(self): + """Gets the payment_method_category of this PaymentOption. + + """ return self.__payment_method_category + @payment_method_category.setter + def payment_method_category(self, value): + self.__payment_method_category = value + @property + def payment_method_region(self): + """ + A list of region codes that represent the countries or regions of payment methods. The value of this parameter is a 2-letter ISO country code or GLOBAL. More information: Maximum length: 6 characters + """ + return self.__payment_method_region + + @payment_method_region.setter + def payment_method_region(self, value): + self.__payment_method_region = value @property def enabled(self): + """ + Indicates whether the payment method is available. + """ return self.__enabled + @enabled.setter + def enabled(self, value): + self.__enabled = value @property def preferred(self): + """Gets the preferred of this PaymentOption. + + """ return self.__preferred + @preferred.setter + def preferred(self, value): + self.__preferred = value @property def disable_reason(self): + """ + The reason why the payment method is not available. Valid values are: PAYMENT_ACCOUNT_NOT_AVAILABLE EXCEED_CHANNEL_LIMIT_RULE SERVICE_DEGRADE CHANNEL_NOT_SUPPORT_CURRENCY CHANNEL_DISABLE CHANNEL_NOT_IN_SERVICE_TIME QUERY_IPP_INFO_FAILED LIMIT_CENTER_ACCESS_FAIL CURRENT_CHANNEL_NOT_EXIST + """ return self.__disable_reason + @disable_reason.setter + def disable_reason(self, value): + self.__disable_reason = value @property def amount_limit_info_map(self): + """Gets the amount_limit_info_map of this PaymentOption. + + """ return self.__amount_limit_info_map + @amount_limit_info_map.setter + def amount_limit_info_map(self, value): + self.__amount_limit_info_map = value @property def supported_currencies(self): + """Gets the supported_currencies of this PaymentOption. + + """ return self.__supported_currencies + @supported_currencies.setter + def supported_currencies(self, value): + self.__supported_currencies = value @property def payment_option_detail(self): + """Gets the payment_option_detail of this PaymentOption. + + """ return self.__payment_option_detail + @payment_option_detail.setter + def payment_option_detail(self, value): + self.__payment_option_detail = value @property def extend_info(self): + """Gets the extend_info of this PaymentOption. + + """ return self.__extend_info + @extend_info.setter + def extend_info(self, value): + self.__extend_info = value @property def logo(self): + """Gets the logo of this PaymentOption. + + """ return self.__logo + @logo.setter + def logo(self, value): + self.__logo = value @property def promo_names(self): + """ + The list of the promotion names. In JSON format. The keys are returned as a language and a country code, connected by an underscore, such as zh_CN, while the value is the promotion name, such as RM1 Voucher. More information: Maximum length: 512 characters + """ return self.__promo_names + @promo_names.setter + def promo_names(self, value): + self.__promo_names = value @property def installment(self): + """Gets the installment of this PaymentOption. + + """ return self.__installment + @installment.setter + def installment(self, value): + self.__installment = value @property def promotion_infos(self): + """ + Promotion information. This parameter is returned when the payment method offers a promotion to the buyer. + """ return self.__promotion_infos - def parse_rsp_body(self, payment_option_body): - if type(payment_option_body) == str: - payment_option_body = json.loads(payment_option_body) - - if 'paymentMethodType' in payment_option_body: - self.__payment_method_type = payment_option_body['paymentMethodType'] - - if 'paymentMethodCategory' in payment_option_body: - payment_method_category = PaymentMethodCategoryType.value_of(payment_option_body['paymentMethodCategory']) - self.__payment_method_category = payment_method_category - - if 'enabled' in payment_option_body: - self.__enabled = payment_option_body['enabled'] - - if 'preferred' in payment_option_body: - self.__preferred = payment_option_body['preferred'] - - if 'disableReason' in payment_option_body: - self.__disable_reason = payment_option_body['disableReason'] - - if 'amountLimitInfoMap' in payment_option_body: - amount_limit_info_map = dict() - for key, value in payment_option_body['amountLimitInfoMap']: - amount_limit_info = AmountLimitInfo() - amount_limit_info.parse_rsp_body(value) - amount_limit_info_map[key] = amount_limit_info - self.__amount_limit_info_map = amount_limit_info_map - - if 'supportedCurrencies' in payment_option_body: - self.__supported_currencies = payment_option_body['supportedCurrencies'] - - if 'paymentOptionDetail' in payment_option_body: - self.__payment_option_detail = payment_option_body['paymentOptionDetail'] - - if 'extendInfo' in payment_option_body: - self.__extend_info = payment_option_body['extendInfo'] - - if 'logo' in payment_option_body: - self.__logo = payment_option_body['logo'] - - if 'promoNames' in payment_option_body: - self.__promo_names = payment_option_body['promoNames'] - - if 'installment' in payment_option_body: - self.__installment = payment_option_body['installment'] - - if 'promotionInfos' in payment_option_body: - promotion_infos = list() - for promotion_info_body in payment_option_body['promotionInfos']: - promotion_info = PromotionInfo() - promotion_info.parse_rsp_body(promotion_info_body) - promotion_infos.append(promotion_info) - self.__promotion_infos = promotion_infos + @promotion_infos.setter + def promotion_infos(self, value): + self.__promotion_infos = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "payment_method_type") and self.payment_method_type is not None: + params['paymentMethodType'] = self.payment_method_type + if hasattr(self, "payment_method_category") and self.payment_method_category is not None: + params['paymentMethodCategory'] = self.payment_method_category + if hasattr(self, "payment_method_region") and self.payment_method_region is not None: + params['paymentMethodRegion'] = self.payment_method_region + if hasattr(self, "enabled") and self.enabled is not None: + params['enabled'] = self.enabled + if hasattr(self, "preferred") and self.preferred is not None: + params['preferred'] = self.preferred + if hasattr(self, "disable_reason") and self.disable_reason is not None: + params['disableReason'] = self.disable_reason + if hasattr(self, "amount_limit_info_map") and self.amount_limit_info_map is not None: + params['amountLimitInfoMap'] = self.amount_limit_info_map + if hasattr(self, "supported_currencies") and self.supported_currencies is not None: + params['supportedCurrencies'] = self.supported_currencies + if hasattr(self, "payment_option_detail") and self.payment_option_detail is not None: + params['paymentOptionDetail'] = self.payment_option_detail + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + if hasattr(self, "logo") and self.logo is not None: + params['logo'] = self.logo + if hasattr(self, "promo_names") and self.promo_names is not None: + params['promoNames'] = self.promo_names + if hasattr(self, "installment") and self.installment is not None: + params['installment'] = self.installment + if hasattr(self, "promotion_infos") and self.promotion_infos is not None: + params['promotionInfos'] = self.promotion_infos + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'paymentMethodType' in response_body: + self.__payment_method_type = response_body['paymentMethodType'] + if 'paymentMethodCategory' in response_body: + payment_method_category_temp = PaymentMethodCategoryType.value_of(response_body['paymentMethodCategory']) + self.__payment_method_category = payment_method_category_temp + if 'paymentMethodRegion' in response_body: + self.__payment_method_region = response_body['paymentMethodRegion'] + if 'enabled' in response_body: + self.__enabled = response_body['enabled'] + if 'preferred' in response_body: + self.__preferred = response_body['preferred'] + if 'disableReason' in response_body: + self.__disable_reason = response_body['disableReason'] + if 'amountLimitInfoMap' in response_body: + self.__amount_limit_info_map = {} + for key, value in response_body['amountLimitInfoMap'].items(): + self.__amount_limit_info_map[key] = value + if 'supportedCurrencies' in response_body: + self.__supported_currencies = response_body['supportedCurrencies'] + if 'paymentOptionDetail' in response_body: + self.__payment_option_detail = PaymentOptionDetail() + self.__payment_option_detail.parse_rsp_body(response_body['paymentOptionDetail']) + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'logo' in response_body: + self.__logo = Logo() + self.__logo.parse_rsp_body(response_body['logo']) + if 'promoNames' in response_body: + self.__promo_names = response_body['promoNames'] + if 'installment' in response_body: + self.__installment = Installment() + self.__installment.parse_rsp_body(response_body['installment']) + if 'promotionInfos' in response_body: + self.__promotion_infos = [] + for item in response_body['promotionInfos']: + obj = PromotionInfo() + obj.parse_rsp_body(item) + self.__promotion_infos.append(obj) diff --git a/com/alipay/ams/api/model/payment_option_detail.py b/com/alipay/ams/api/model/payment_option_detail.py new file mode 100644 index 0000000..f2362b1 --- /dev/null +++ b/com/alipay/ams/api/model/payment_option_detail.py @@ -0,0 +1,77 @@ +import json +from com.alipay.ams.api.model.support_card_brand import SupportCardBrand +from com.alipay.ams.api.model.support_bank import SupportBank + + + + +class PaymentOptionDetail: + def __init__(self): + + self.__support_card_brands = None # type: [SupportCardBrand] + self.__funding = None # type: [str] + self.__support_banks = None # type: [SupportBank] + + + @property + def support_card_brands(self): + """ + The list of supported card brands. Note: This parameter is returned when the value of paymentMethodType is ​CARD​. + """ + return self.__support_card_brands + + @support_card_brands.setter + def support_card_brands(self, value): + self.__support_card_brands = value + @property + def funding(self): + """ + The funding type of the card. Valid values are: CREDIT: indicates a credit card. DEBIT: indicates a debit card. PREPAID: indicates a prepaid card CHARGE: indicates a charge card DEFERRED_DEBIT: indicates a deferred debit card This parameter is returned when all the following conditions are met: The value of paymentMethodType is CARD. The value of cardNo is valid. The information is available in the Antom card database. + """ + return self.__funding + + @funding.setter + def funding(self, value): + self.__funding = value + @property + def support_banks(self): + """ + The list of supported banks. This parameter is returned when the value of paymentMethodType is ​P24​ or ONLINEBANKING_FPX. + """ + return self.__support_banks + + @support_banks.setter + def support_banks(self, value): + self.__support_banks = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "support_card_brands") and self.support_card_brands is not None: + params['supportCardBrands'] = self.support_card_brands + if hasattr(self, "funding") and self.funding is not None: + params['funding'] = self.funding + if hasattr(self, "support_banks") and self.support_banks is not None: + params['supportBanks'] = self.support_banks + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'supportCardBrands' in response_body: + self.__support_card_brands = [] + for item in response_body['supportCardBrands']: + obj = SupportCardBrand() + obj.parse_rsp_body(item) + self.__support_card_brands.append(obj) + if 'funding' in response_body: + self.__funding = response_body['funding'] + if 'supportBanks' in response_body: + self.__support_banks = [] + for item in response_body['supportBanks']: + obj = SupportBank() + obj.parse_rsp_body(item) + self.__support_banks.append(obj) diff --git a/com/alipay/ams/api/model/payment_result_info.py b/com/alipay/ams/api/model/payment_result_info.py index 4121a55..d2742c5 100644 --- a/com/alipay/ams/api/model/payment_result_info.py +++ b/com/alipay/ams/api/model/payment_result_info.py @@ -1,225 +1,328 @@ import json +from com.alipay.ams.api.model.acquirer_info import AcquirerInfo +from com.alipay.ams.api.model.three_ds_result import ThreeDSResult +from com.alipay.ams.api.model.credit_pay_plan import CreditPayPlan -class PaymentResultInfo(object): - def __init__(self): - self.__avs_result_raw = None - self.__cvv_result_raw = None - self.__network_transaction_id = None - self.__card_no = None - self.__card_brand = None - self.__card_token = None - self.__issuing_country = None - self.__funding = None - self.__payment_method_region = None - self.__three_dS_result = None # type: ThreeDSResult - self.__credit_pay_plan = None - self.__cardholder_name = None - self.__cardB_bin = None - self.__last_four = None - self.__expiry_month = None - self.__expiry_year = None +class PaymentResultInfo: + def __init__(self): + + self.__refusal_code_raw = None # type: str + self.__refusal_reason_raw = None # type: str + self.__merchant_advice_code = None # type: str + self.__acquirer_info = None # type: AcquirerInfo + self.__card_no = None # type: str + self.__card_brand = None # type: str + self.__card_token = None # type: str + self.__issuing_country = None # type: str + self.__funding = None # type: str + self.__payment_method_region = None # type: str + self.__three_ds_result = None # type: ThreeDSResult + self.__avs_result_raw = None # type: str + self.__cvv_result_raw = None # type: str + self.__network_transaction_id = None # type: str + self.__credit_pay_plan = None # type: CreditPayPlan + self.__cardholder_name = None # type: str + self.__card_bin = None # type: str + self.__last_four = None # type: str + self.__expiry_month = None # type: str + self.__expiry_year = None # type: str + @property - def avs_result_raw(self): - return self.__avs_result_raw - - @avs_result_raw.setter - def avs_result_raw(self, value): - self.__avs_result_raw = value - + def refusal_code_raw(self): + """ + 卡支付失败且渠道返回时的原始错误码 + """ + return self.__refusal_code_raw + + @refusal_code_raw.setter + def refusal_code_raw(self, value): + self.__refusal_code_raw = value @property - def cvv_result_raw(self): - return self.__cvv_result_raw - - @cvv_result_raw.setter - def cvv_result_raw(self, value): - self.__cvv_result_raw = value - + def refusal_reason_raw(self): + """ + 卡支付失败且渠道返回时的原始拒付原因 + """ + return self.__refusal_reason_raw + + @refusal_reason_raw.setter + def refusal_reason_raw(self, value): + self.__refusal_reason_raw = value @property - def network_transaction_id(self): - return self.__network_transaction_id - - @network_transaction_id.setter - def network_transaction_id(self, value): - self.__network_transaction_id = value - + def merchant_advice_code(self): + """ + 支付结果的商户建议码 + """ + return self.__merchant_advice_code + + @merchant_advice_code.setter + def merchant_advice_code(self, value): + self.__merchant_advice_code = value + @property + def acquirer_info(self): + """Gets the acquirer_info of this PaymentResultInfo. + + """ + return self.__acquirer_info + + @acquirer_info.setter + def acquirer_info(self, value): + self.__acquirer_info = value @property def card_no(self): + """ + The masked card number, which just shows part of the card number and can be used to display to the user + """ return self.__card_no @card_no.setter def card_no(self, value): self.__card_no = value - @property def card_brand(self): + """ + The card brand, which can be used to display to the user + """ return self.__card_brand @card_brand.setter def card_brand(self, value): self.__card_brand = value - @property def card_token(self): + """ + The token of the card, the value of this parameter is used by paymentMethodId in the pay + """ return self.__card_token @card_token.setter def card_token(self, value): self.__card_token = value - @property def issuing_country(self): + """ + The issuing country of the card + """ return self.__issuing_country @issuing_country.setter def issuing_country(self, value): self.__issuing_country = value - @property def funding(self): + """ + The funding type of the card. + """ return self.__funding @funding.setter def funding(self, value): self.__funding = value - @property def payment_method_region(self): + """ + The region code that represents the country or region of the payment method + """ return self.__payment_method_region @payment_method_region.setter def payment_method_region(self, value): self.__payment_method_region = value + @property + def three_ds_result(self): + """Gets the three_ds_result of this PaymentResultInfo. + + """ + return self.__three_ds_result + + @three_ds_result.setter + def three_ds_result(self, value): + self.__three_ds_result = value + @property + def avs_result_raw(self): + """ + The raw AVS result. See AVS result codes to check the valid values + """ + return self.__avs_result_raw + @avs_result_raw.setter + def avs_result_raw(self, value): + self.__avs_result_raw = value @property - def three_dS_result(self): - return self.__three_dS_result + def cvv_result_raw(self): + """ + The raw Card Verification Value (CVV), Card Security Code (CSC), or Card Verification Code (CVC) result + """ + return self.__cvv_result_raw - @three_dS_result.setter - def three_dS_result(self, value): - self.__three_dS_result = value + @cvv_result_raw.setter + def cvv_result_raw(self, value): + self.__cvv_result_raw = value + @property + def network_transaction_id(self): + """ + The unique ID assigned by the card scheme to identify a transaction. The value of this parameter is used by the same parameter of pay (Cashier Payment) request in subsequent payments + """ + return self.__network_transaction_id + @network_transaction_id.setter + def network_transaction_id(self, value): + self.__network_transaction_id = value @property def credit_pay_plan(self): + """Gets the credit_pay_plan of this PaymentResultInfo. + + """ return self.__credit_pay_plan @credit_pay_plan.setter def credit_pay_plan(self, value): self.__credit_pay_plan = value - @property def cardholder_name(self): + """ + The cardholder's name. Note: This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD for specific merchants in specific regions. More information: Maximum length: 64 characters + """ return self.__cardholder_name @cardholder_name.setter def cardholder_name(self, value): self.__cardholder_name = value - @property - def cardB_bin(self): - return self.__cardB_bin - - @cardB_bin.setter - def cardB_bin(self, value): - self.__cardB_bin = value - + def card_bin(self): + """ + The first six digits of the bank card number, used to identify the issuing bank and card type of the bank card. Note: This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD for specific merchants in specific regions. More information: Maximum length: 8 characters + """ + return self.__card_bin + + @card_bin.setter + def card_bin(self, value): + self.__card_bin = value @property def last_four(self): + """ + Last 4 digits of the card number. Note: This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD for specific merchants in specific regions. More information: Maximum length: 4 characters + """ return self.__last_four @last_four.setter def last_four(self, value): self.__last_four = value - @property def expiry_month(self): + """ + The month the card expires. Pass in two digits representing the month. For example, if the expiry month is February, the value of this parameter is 02. Note: This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD for specific merchants in specific regions. More information: Maximum length: 2 characters + """ return self.__expiry_month @expiry_month.setter def expiry_month(self, value): self.__expiry_month = value - @property def expiry_year(self): + """ + The year the card expires. Pass in the last two digits of the year number. For example, if the expiry year is 2025, the value of this parameter is 25. Note: This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD for specific merchants in specific regions. More information: Maximum length: 2 characters + """ return self.__expiry_year @expiry_year.setter def expiry_year(self, value): self.__expiry_year = value + + + def to_ams_dict(self): - param = dict() - if hasattr(self, 'avs_result_raw') and self.avs_result_raw: - param['avsResultRaw'] = self.avs_result_raw - if hasattr(self, 'cvv_result_raw') and self.cvv_result_raw: - param['cvvResultRaw'] = self.cvv_result_raw - if hasattr(self, 'network_transaction_id') and self.network_transaction_id: - param['networkTransactionId'] = self.network_transaction_id - if hasattr(self, 'card_no') and self.card_no: - param['cardNo'] = self.card_no - if hasattr(self, 'card_brand') and self.card_brand: - param['cardBrand'] = self.card_brand - if hasattr(self, 'card_token') and self.card_token: - param['cardToken'] = self.card_token - if hasattr(self, 'issuing_country') and self.issuing_country: - param['issuingCountry'] = self.issuing_country - if hasattr(self, 'funding') and self.funding: - param['funding'] = self.funding - if hasattr(self, 'payment_method_region') and self.payment_method_region: - param['paymentMethodRegion'] = self.payment_method_region - if hasattr(self, 'three_dS_result') and self.three_dS_result: - param['threeDSResult'] = self.three_dS_result - if hasattr(self, 'credit_pay_plan') and self.credit_pay_plan: - param['creditPayPlan'] = self.credit_pay_plan - if hasattr(self, 'cardholder_name') and self.cardholder_name: - param['cardholderName'] = self.cardholder_name - if hasattr(self, 'cardB_bin') and self.cardB_bin: - param['cardBin'] = self.cardB_bin - if hasattr(self, 'last_four') and self.last_four: - param['lastFour'] = self.last_four - if hasattr(self, 'expiry_month') and self.expiry_month: - param['expiryMonth'] = self.expiry_month - if hasattr(self, 'expiry_year') and self.expiry_year: - param['expiryYear'] = self.expiry_year - - return param - - def parse_rsp_body(self, payment_result_info_body): - if type(payment_result_info_body) == str: - payment_result_info_body = json.loads(payment_result_info_body) - - if 'avsResultRaw' in payment_result_info_body: - self.avs_result_raw = payment_result_info_body['avsResultRaw'] - if 'cvvResultRaw' in payment_result_info_body: - self.cvv_result_raw = payment_result_info_body['cvvResultRaw'] - if 'networkTransactionId' in payment_result_info_body: - self.network_transaction_id = payment_result_info_body['networkTransactionId'] - if 'cardNo' in payment_result_info_body: - self.card_no = payment_result_info_body['cardNo'] - if 'cardBrand' in payment_result_info_body: - self.card_brand = payment_result_info_body['cardBrand'] - if 'cardToken' in payment_result_info_body: - self.card_token = payment_result_info_body['cardToken'] - if 'issuingCountry' in payment_result_info_body: - self.issuing_country = payment_result_info_body['issuingCountry'] - if 'funding' in payment_result_info_body: - self.funding = payment_result_info_body['funding'] - if 'paymentMethodRegion' in payment_result_info_body: - self.payment_method_region = payment_result_info_body['paymentMethodRegion'] - if 'threeDSResult' in payment_result_info_body: - self.three_dS_result = payment_result_info_body['threeDSResult'] - if 'creditPayPlan' in payment_result_info_body: - self.credit_pay_plan = payment_result_info_body['creditPayPlan'] - if 'cardholderName' in payment_result_info_body: - self.cardholder_name = payment_result_info_body['cardholderName'] - if 'cardBin' in payment_result_info_body: - self.cardB_bin = payment_result_info_body['cardBin'] - if 'lastFour' in payment_result_info_body: - self.last_four = payment_result_info_body['lastFour'] - if 'expiryMonth' in payment_result_info_body: - self.expiry_month = payment_result_info_body['expiryMonth'] - if 'expiryYear' in payment_result_info_body: - self.expiry_year = payment_result_info_body['expiryYear'] + params = dict() + if hasattr(self, "refusal_code_raw") and self.refusal_code_raw is not None: + params['refusalCodeRaw'] = self.refusal_code_raw + if hasattr(self, "refusal_reason_raw") and self.refusal_reason_raw is not None: + params['refusalReasonRaw'] = self.refusal_reason_raw + if hasattr(self, "merchant_advice_code") and self.merchant_advice_code is not None: + params['merchantAdviceCode'] = self.merchant_advice_code + if hasattr(self, "acquirer_info") and self.acquirer_info is not None: + params['acquirerInfo'] = self.acquirer_info + if hasattr(self, "card_no") and self.card_no is not None: + params['cardNo'] = self.card_no + if hasattr(self, "card_brand") and self.card_brand is not None: + params['cardBrand'] = self.card_brand + if hasattr(self, "card_token") and self.card_token is not None: + params['cardToken'] = self.card_token + if hasattr(self, "issuing_country") and self.issuing_country is not None: + params['issuingCountry'] = self.issuing_country + if hasattr(self, "funding") and self.funding is not None: + params['funding'] = self.funding + if hasattr(self, "payment_method_region") and self.payment_method_region is not None: + params['paymentMethodRegion'] = self.payment_method_region + if hasattr(self, "three_ds_result") and self.three_ds_result is not None: + params['threeDSResult'] = self.three_ds_result + if hasattr(self, "avs_result_raw") and self.avs_result_raw is not None: + params['avsResultRaw'] = self.avs_result_raw + if hasattr(self, "cvv_result_raw") and self.cvv_result_raw is not None: + params['cvvResultRaw'] = self.cvv_result_raw + if hasattr(self, "network_transaction_id") and self.network_transaction_id is not None: + params['networkTransactionId'] = self.network_transaction_id + if hasattr(self, "credit_pay_plan") and self.credit_pay_plan is not None: + params['creditPayPlan'] = self.credit_pay_plan + if hasattr(self, "cardholder_name") and self.cardholder_name is not None: + params['cardholderName'] = self.cardholder_name + if hasattr(self, "card_bin") and self.card_bin is not None: + params['cardBin'] = self.card_bin + if hasattr(self, "last_four") and self.last_four is not None: + params['lastFour'] = self.last_four + if hasattr(self, "expiry_month") and self.expiry_month is not None: + params['expiryMonth'] = self.expiry_month + if hasattr(self, "expiry_year") and self.expiry_year is not None: + params['expiryYear'] = self.expiry_year + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'refusalCodeRaw' in response_body: + self.__refusal_code_raw = response_body['refusalCodeRaw'] + if 'refusalReasonRaw' in response_body: + self.__refusal_reason_raw = response_body['refusalReasonRaw'] + if 'merchantAdviceCode' in response_body: + self.__merchant_advice_code = response_body['merchantAdviceCode'] + if 'acquirerInfo' in response_body: + self.__acquirer_info = AcquirerInfo() + self.__acquirer_info.parse_rsp_body(response_body['acquirerInfo']) + if 'cardNo' in response_body: + self.__card_no = response_body['cardNo'] + if 'cardBrand' in response_body: + self.__card_brand = response_body['cardBrand'] + if 'cardToken' in response_body: + self.__card_token = response_body['cardToken'] + if 'issuingCountry' in response_body: + self.__issuing_country = response_body['issuingCountry'] + if 'funding' in response_body: + self.__funding = response_body['funding'] + if 'paymentMethodRegion' in response_body: + self.__payment_method_region = response_body['paymentMethodRegion'] + if 'threeDSResult' in response_body: + self.__three_ds_result = ThreeDSResult() + self.__three_ds_result.parse_rsp_body(response_body['threeDSResult']) + if 'avsResultRaw' in response_body: + self.__avs_result_raw = response_body['avsResultRaw'] + if 'cvvResultRaw' in response_body: + self.__cvv_result_raw = response_body['cvvResultRaw'] + if 'networkTransactionId' in response_body: + self.__network_transaction_id = response_body['networkTransactionId'] + if 'creditPayPlan' in response_body: + self.__credit_pay_plan = CreditPayPlan() + self.__credit_pay_plan.parse_rsp_body(response_body['creditPayPlan']) + if 'cardholderName' in response_body: + self.__cardholder_name = response_body['cardholderName'] + if 'cardBin' in response_body: + self.__card_bin = response_body['cardBin'] + if 'lastFour' in response_body: + self.__last_four = response_body['lastFour'] + if 'expiryMonth' in response_body: + self.__expiry_month = response_body['expiryMonth'] + if 'expiryYear' in response_body: + self.__expiry_year = response_body['expiryYear'] diff --git a/com/alipay/ams/api/model/payment_verification_data.py b/com/alipay/ams/api/model/payment_verification_data.py index af8539b..351c661 100644 --- a/com/alipay/ams/api/model/payment_verification_data.py +++ b/com/alipay/ams/api/model/payment_verification_data.py @@ -1,34 +1,52 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json -class PaymentVerificationData(object): + + +class PaymentVerificationData: def __init__(self): - self.__verify_request_id = None - self.__authentication_code = None + + self.__verify_request_id = None # type: str + self.__authentication_code = None # type: str + @property def verify_request_id(self): + """Gets the verify_request_id of this PaymentVerificationData. + + """ return self.__verify_request_id @verify_request_id.setter def verify_request_id(self, value): self.__verify_request_id = value - @property def authentication_code(self): + """Gets the authentication_code of this PaymentVerificationData. + + """ return self.__authentication_code @authentication_code.setter def authentication_code(self, value): self.__authentication_code = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "verify_request_id") and self.verify_request_id: + if hasattr(self, "verify_request_id") and self.verify_request_id is not None: params['verifyRequestId'] = self.verify_request_id - - if hasattr(self, "authentication_code") and self.authentication_code: + if hasattr(self, "authentication_code") and self.authentication_code is not None: params['authenticationCode'] = self.authentication_code - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'verifyRequestId' in response_body: + self.__verify_request_id = response_body['verifyRequestId'] + if 'authenticationCode' in response_body: + self.__authentication_code = response_body['authenticationCode'] diff --git a/com/alipay/ams/api/model/period_rule.py b/com/alipay/ams/api/model/period_rule.py index a823726..6412248 100644 --- a/com/alipay/ams/api/model/period_rule.py +++ b/com/alipay/ams/api/model/period_rule.py @@ -1,23 +1,30 @@ import json -from com.alipay.ams.api.model.period_type import PeriodType -class PeriodRule(object): + +class PeriodRule: def __init__(self): - self.__period_type = None #type: PeriodType - self.__period_count = None + + self.__period_type = None # type: str + self.__period_count = None # type: int + @property def period_type(self): + """ + The subscription period type. Valid values are: YEAR: indicates that the subscription period is measured in years. MONTH: indicates that the subscription period is measured in months. WEEK: indicates that the subscription period is measured in weeks. DAY: indicates that the subscription period is measured in days. More information: Maximum length: 20 characters + """ return self.__period_type @period_type.setter def period_type(self, value): self.__period_type = value - @property def period_count(self): + """ + The number of period types within one subscription period. For example, if the value of periodType is MONTH and the value of periodCount is 2, it means that the subscription period is two months. More information: Value range: [1, +∞) + """ return self.__period_count @period_count.setter @@ -25,24 +32,21 @@ def period_count(self, value): self.__period_count = value + + def to_ams_dict(self): params = dict() - if hasattr(self, "period_type") and self.period_type: + if hasattr(self, "period_type") and self.period_type is not None: params['periodType'] = self.period_type - if hasattr(self, "period_count") and self.period_count: + if hasattr(self, "period_count") and self.period_count is not None: params['periodCount'] = self.period_count - return params - def parse_rsp_body(self, result_body): - if type(result_body) == str: - result_body = json.loads(result_body) - - if 'periodType' in result_body: - self.__period_type = result_body['periodType'] - if 'periodCount' in result_body: - self.__period_count = result_body['periodCount'] - - - + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'periodType' in response_body: + self.__period_type = response_body['periodType'] + if 'periodCount' in response_body: + self.__period_count = response_body['periodCount'] diff --git a/com/alipay/ams/api/model/plan.py b/com/alipay/ams/api/model/plan.py index 299de2c..b157259 100644 --- a/com/alipay/ams/api/model/plan.py +++ b/com/alipay/ams/api/model/plan.py @@ -1,106 +1,116 @@ import json - from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.amount import Amount + -class Plan(object): + +class Plan: def __init__(self): - self.__interest_rate = None + + self.__interest_rate = None # type: str self.__min_installment_amount = None # type: Amount self.__max_installment_amount = None # type: Amount - self.__installment_num = None - self.__interval = None - self.__enabled = None + self.__installment_num = None # type: str + self.__interval = None # type: str + self.__enabled = None # type: bool + @property def interest_rate(self): + """ + The interest rate the customer is charged on the installments. More information: Maximum length: 8 characters + """ return self.__interest_rate @interest_rate.setter def interest_rate(self, value): self.__interest_rate = value - @property def min_installment_amount(self): + """Gets the min_installment_amount of this Plan. + + """ return self.__min_installment_amount @min_installment_amount.setter def min_installment_amount(self, value): self.__min_installment_amount = value - @property def max_installment_amount(self): + """Gets the max_installment_amount of this Plan. + + """ return self.__max_installment_amount @max_installment_amount.setter def max_installment_amount(self, value): self.__max_installment_amount = value - @property def installment_num(self): + """ + The number of installment payments. The valid value is from 2 to 12. More information: Maximum length: 8 characters + """ return self.__installment_num @installment_num.setter def installment_num(self, value): self.__installment_num = value - @property def interval(self): + """ + The interval of each installment payment. The valid value is MONTH. More information: Maximum length: 16 characters + """ return self.__interval @interval.setter def interval(self, value): self.__interval = value - @property def enabled(self): + """ + Indicates whether the installment payment is available. + """ return self.__enabled @enabled.setter def enabled(self, value): self.__enabled = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "interest_rate") and self.interest_rate: + if hasattr(self, "interest_rate") and self.interest_rate is not None: params['interestRate'] = self.interest_rate - - if hasattr(self, "min_installment_amount") and self.min_installment_amount: - params['minInstallmentAmount'] = self.min_installment_amount.to_ams_dict() - - if hasattr(self, "max_installment_amount") and self.max_installment_amount: - params['maxInstallmentAmount'] = self.max_installment_amount.to_ams_dict() - - if hasattr(self, "installment_num") and self.installment_num: + if hasattr(self, "min_installment_amount") and self.min_installment_amount is not None: + params['minInstallmentAmount'] = self.min_installment_amount + if hasattr(self, "max_installment_amount") and self.max_installment_amount is not None: + params['maxInstallmentAmount'] = self.max_installment_amount + if hasattr(self, "installment_num") and self.installment_num is not None: params['installmentNum'] = self.installment_num - - if hasattr(self, "interval") and self.interval: + if hasattr(self, "interval") and self.interval is not None: params['interval'] = self.interval - - if hasattr(self, "enabled") and self.enabled: + if hasattr(self, "enabled") and self.enabled is not None: params['enabled'] = self.enabled return params - def parse_rsp_body(self, plan_body): - if type(plan_body) == str: - payment_option_body = json.loads(plan_body) - - if "interestRate" in plan_body: - self.interest_rate = plan_body["interestRate"] - - if "minInstallmentAmount" in plan_body: - self.min_installment_amount = Amount() - self.min_installment_amount.parse_rsp_body(plan_body["minInstallmentAmount"]) - - if "maxInstallmentAmount" in plan_body: - self.max_installment_amount = Amount() - self.max_installment_amount.parse_rsp_body(plan_body["maxInstallmentAmount"]) - - if "installmentNum" in plan_body: - self.installment_num = plan_body["installmentNum"] - - if "interval" in plan_body: - self.interval = plan_body["interval"] - if "enabled" in plan_body: - self.enabled = plan_body["enabled"] + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'interestRate' in response_body: + self.__interest_rate = response_body['interestRate'] + if 'minInstallmentAmount' in response_body: + self.__min_installment_amount = Amount() + self.__min_installment_amount.parse_rsp_body(response_body['minInstallmentAmount']) + if 'maxInstallmentAmount' in response_body: + self.__max_installment_amount = Amount() + self.__max_installment_amount.parse_rsp_body(response_body['maxInstallmentAmount']) + if 'installmentNum' in response_body: + self.__installment_num = response_body['installmentNum'] + if 'interval' in response_body: + self.__interval = response_body['interval'] + if 'enabled' in response_body: + self.__enabled = response_body['enabled'] diff --git a/com/alipay/ams/api/model/presentment_mode.py b/com/alipay/ams/api/model/presentment_mode.py index f8e3620..a8080ca 100644 --- a/com/alipay/ams/api/model/presentment_mode.py +++ b/com/alipay/ams/api/model/presentment_mode.py @@ -1,11 +1,24 @@ from enum import Enum, unique - - @unique class PresentmentMode(Enum): + """PresentmentMode枚举类""" + BUNDLE = "BUNDLE" - TILED = "TILED" + TILE = "TILE" UNIFIED = "UNIFIED" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if PresentmentMode.BUNDLE.value == value: + return PresentmentMode.BUNDLE + if PresentmentMode.TILE.value == value: + return PresentmentMode.TILE + if PresentmentMode.UNIFIED.value == value: + return PresentmentMode.UNIFIED + return None diff --git a/com/alipay/ams/api/model/product_code_type.py b/com/alipay/ams/api/model/product_code_type.py index d55f9c8..f0a28ba 100644 --- a/com/alipay/ams/api/model/product_code_type.py +++ b/com/alipay/ams/api/model/product_code_type.py @@ -1,13 +1,24 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class ProductCodeType(Enum): + """ProductCodeType枚举类""" + + CASHIER_PAYMENT = "CASHIER_PAYMENT" AGREEMENT_PAYMENT = "AGREEMENT_PAYMENT" IN_STORE_PAYMENT = "IN_STORE_PAYMENT" - CASHIER_PAYMENT = "CASHIER_PAYMENT" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if ProductCodeType.CASHIER_PAYMENT.value == value: + return ProductCodeType.CASHIER_PAYMENT + if ProductCodeType.AGREEMENT_PAYMENT.value == value: + return ProductCodeType.AGREEMENT_PAYMENT + if ProductCodeType.IN_STORE_PAYMENT.value == value: + return ProductCodeType.IN_STORE_PAYMENT + return None diff --git a/com/alipay/ams/api/model/promotion_info.py b/com/alipay/ams/api/model/promotion_info.py index acda785..b26cee5 100644 --- a/com/alipay/ams/api/model/promotion_info.py +++ b/com/alipay/ams/api/model/promotion_info.py @@ -1,66 +1,73 @@ import json - +from com.alipay.ams.api.model.promotion_type import PromotionType from com.alipay.ams.api.model.discount import Discount from com.alipay.ams.api.model.interest_free import InterestFree -from com.alipay.ams.api.model.promotion_type import PromotionType -class PromotionInfo(object): + + +class PromotionInfo: def __init__(self): - self.__promotion_type = None # type:PromotionType - self.__discount = None # type:Discount - self.__interest_free = None # type:InterestFree + + self.__promotion_type = None # type: PromotionType + self.__discount = None # type: Discount + self.__interest_free = None # type: InterestFree + @property def promotion_type(self): + """Gets the promotion_type of this PromotionInfo. + + """ return self.__promotion_type @promotion_type.setter def promotion_type(self, value): self.__promotion_type = value - @property def discount(self): + """Gets the discount of this PromotionInfo. + + """ return self.__discount @discount.setter def discount(self, value): self.__discount = value - @property def interest_free(self): + """Gets the interest_free of this PromotionInfo. + + """ return self.__interest_free @interest_free.setter def interest_free(self, value): self.__interest_free = value - def to_ams_dict(self): - params = dict() - if hasattr(self, "promotion_type") and self.promotion_type: - params['promotionType'] = self.promotion_type.value - if hasattr(self, "discount") and self.discount: - params['discount'] = self.discount.to_ams_dict() - - if hasattr(self, "interest_free") and self.interest_free: - params['interestFree'] = self.interest_free.to_ams_dict() + + def to_ams_dict(self): + params = dict() + if hasattr(self, "promotion_type") and self.promotion_type is not None: + params['promotionType'] = self.promotion_type + if hasattr(self, "discount") and self.discount is not None: + params['discount'] = self.discount + if hasattr(self, "interest_free") and self.interest_free is not None: + params['interestFree'] = self.interest_free return params - def parse_rsp_body(self, promotion_info_body): - if type(promotion_info_body) == str: - promotion_info_body = json.loads(promotion_info_body) - - if 'promotionType' in promotion_info_body: - self.promotion_type = PromotionType(promotion_info_body['promotionType']) - - if 'discount' in promotion_info_body: - discount_result = Discount() - discount_result.parse_rsp_body(promotion_info_body['discount']) - self.discount = discount_result - if 'interestFree' in promotion_info_body: - interest_free_result = InterestFree() - interest_free_result.parse_rsp_body(promotion_info_body['interestFree']) - self.interest_free = interest_free_result + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'promotionType' in response_body: + promotion_type_temp = PromotionType.value_of(response_body['promotionType']) + self.__promotion_type = promotion_type_temp + if 'discount' in response_body: + self.__discount = Discount() + self.__discount.parse_rsp_body(response_body['discount']) + if 'interestFree' in response_body: + self.__interest_free = InterestFree() + self.__interest_free.parse_rsp_body(response_body['interestFree']) diff --git a/com/alipay/ams/api/model/promotion_result.py b/com/alipay/ams/api/model/promotion_result.py index 9b8aad5..ee60037 100644 --- a/com/alipay/ams/api/model/promotion_result.py +++ b/com/alipay/ams/api/model/promotion_result.py @@ -1,49 +1,56 @@ import json - -from com.alipay.ams.api.model.discount import Discount from com.alipay.ams.api.model.promotion_type import PromotionType +from com.alipay.ams.api.model.discount import Discount -class PromotionResult(object): + +class PromotionResult: def __init__(self): - self.__promotion_type = None # type:PromotionType - self.__discount = None # type:Discount + + self.__promotion_type = None # type: PromotionType + self.__discount = None # type: Discount + @property def promotion_type(self): + """Gets the promotion_type of this PromotionResult. + + """ return self.__promotion_type @promotion_type.setter - def promotion_type(self, promotion_type): - self.__promotion_type = promotion_type - + def promotion_type(self, value): + self.__promotion_type = value @property def discount(self): + """Gets the discount of this PromotionResult. + + """ return self.__discount @discount.setter - def discount(self, discount): - self.__discount = discount + def discount(self, value): + self.__discount = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "promotion_type") and self.promotion_type: + if hasattr(self, "promotion_type") and self.promotion_type is not None: params['promotionType'] = self.promotion_type - - if hasattr(self, "discount") and self.discount: + if hasattr(self, "discount") and self.discount is not None: params['discount'] = self.discount - return params - def parse_rsp_body(self, promotion_result_body): - if type(promotion_result_body) == str: - promotion_result_body = json.loads(promotion_result_body) - - if 'promotionType' in promotion_result_body: - self.promotion_type = promotion_result_body['promotionType'] - if 'discount' in promotion_result_body: - discount_result = Discount() - discount_result.parse_rsp_body(promotion_result_body['discount']) - self.__promotion_result = discount_result + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'promotionType' in response_body: + promotion_type_temp = PromotionType.value_of(response_body['promotionType']) + self.__promotion_type = promotion_type_temp + if 'discount' in response_body: + self.__discount = Discount() + self.__discount.parse_rsp_body(response_body['discount']) diff --git a/com/alipay/ams/api/model/promotion_type.py b/com/alipay/ams/api/model/promotion_type.py index 4c6db8d..7d90340 100644 --- a/com/alipay/ams/api/model/promotion_type.py +++ b/com/alipay/ams/api/model/promotion_type.py @@ -1,10 +1,21 @@ from enum import Enum, unique - - @unique class PromotionType(Enum): + """PromotionType枚举类""" + DISCOUNT = "DISCOUNT" INTEREST_FREE = "INTEREST_FREE" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if PromotionType.DISCOUNT.value == value: + return PromotionType.DISCOUNT + if PromotionType.INTEREST_FREE.value == value: + return PromotionType.INTEREST_FREE + return None diff --git a/com/alipay/ams/api/model/psp_customer_info.py b/com/alipay/ams/api/model/psp_customer_info.py index ddbd13b..2fa52e8 100644 --- a/com/alipay/ams/api/model/psp_customer_info.py +++ b/com/alipay/ams/api/model/psp_customer_info.py @@ -1,78 +1,112 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -class PspCustomerInfo(object): + + +class PspCustomerInfo: def __init__(self): - self.__psp_name = None - self.__psp_customer_id = None - self.__display_customer_id = None - self.__display_customer_name = None - self.__customer_2088_id = None - self.__extend_info = None + + self.__psp_name = None # type: str + self.__psp_customer_id = None # type: str + self.__display_customer_id = None # type: str + self.__display_customer_name = None # type: str + self.__customer2088_id = None # type: str + self.__extend_info = None # type: str + @property def psp_name(self): + """ + The name of Alipay+ payment methods. Note: This field is returned when the Alipay+ payment methods can provide the related information. More information: Maximum length: 64 characters + """ return self.__psp_name @psp_name.setter def psp_name(self, value): self.__psp_name = value - @property def psp_customer_id(self): + """ + The customer ID of Alipay+ payment methods. Note: This field is returned when the Alipay+ payment methods can provide the related information. More information: Maximum length: 64 characters + """ return self.__psp_customer_id @psp_customer_id.setter def psp_customer_id(self, value): self.__psp_customer_id = value - @property def display_customer_id(self): + """ + The customer ID used for display. For example, loginId. Note: This field is returned when the Alipay+ payment methods can provide the related information. More information: Maximum length: 64 characters + """ return self.__display_customer_id @display_customer_id.setter def display_customer_id(self, value): self.__display_customer_id = value - @property def display_customer_name(self): + """Gets the display_customer_name of this PspCustomerInfo. + + """ return self.__display_customer_name @display_customer_name.setter def display_customer_name(self, value): self.__display_customer_name = value - @property - def customer_2088_id(self): - return self.__customer_2088_id - - @customer_2088_id.setter - def customer_2088_id(self, value): - self.__customer_2088_id = value - + def customer2088_id(self): + """Gets the customer2088_id of this PspCustomerInfo. + + """ + return self.__customer2088_id + + @customer2088_id.setter + def customer2088_id(self, value): + self.__customer2088_id = value @property def extend_info(self): + """Gets the extend_info of this PspCustomerInfo. + + """ return self.__extend_info @extend_info.setter def extend_info(self, value): self.__extend_info = value - def parse_rsp_body(self, psp_customer_info_body): - if type(psp_customer_info_body) == str: - psp_customer_info_body = json.loads(psp_customer_info_body) - if 'pspName' in psp_customer_info_body: - self.__psp_name = psp_customer_info_body['pspName'] - if 'pspCustomerId' in psp_customer_info_body: - self.__psp_customer_id = psp_customer_info_body['pspCustomerId'] - if 'displayCustomerId' in psp_customer_info_body: - self.__display_customer_id = psp_customer_info_body['displayCustomerId'] - if 'displayCustomerName' in psp_customer_info_body: - self.__display_customer_name = psp_customer_info_body['displayCustomerName'] - if 'customer2088Id' in psp_customer_info_body: - self.__customer_2088_id = psp_customer_info_body['customer2088Id'] - if 'extendInfo' in psp_customer_info_body: - self.__extend_info = psp_customer_info_body['extendInfo'] + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "psp_name") and self.psp_name is not None: + params['pspName'] = self.psp_name + if hasattr(self, "psp_customer_id") and self.psp_customer_id is not None: + params['pspCustomerId'] = self.psp_customer_id + if hasattr(self, "display_customer_id") and self.display_customer_id is not None: + params['displayCustomerId'] = self.display_customer_id + if hasattr(self, "display_customer_name") and self.display_customer_name is not None: + params['displayCustomerName'] = self.display_customer_name + if hasattr(self, "customer2088_id") and self.customer2088_id is not None: + params['customer2088Id'] = self.customer2088_id + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'pspName' in response_body: + self.__psp_name = response_body['pspName'] + if 'pspCustomerId' in response_body: + self.__psp_customer_id = response_body['pspCustomerId'] + if 'displayCustomerId' in response_body: + self.__display_customer_id = response_body['displayCustomerId'] + if 'displayCustomerName' in response_body: + self.__display_customer_name = response_body['displayCustomerName'] + if 'customer2088Id' in response_body: + self.__customer2088_id = response_body['customer2088Id'] + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] diff --git a/com/alipay/ams/api/model/quote.py b/com/alipay/ams/api/model/quote.py index 34d21dd..d6de043 100644 --- a/com/alipay/ams/api/model/quote.py +++ b/com/alipay/ams/api/model/quote.py @@ -1,84 +1,112 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -class Quote(object): + + +class Quote: def __init__(self): - self.__quote_id = None - self.__quote_currency_pair = None - self.__quote_price = None - self.__quote_start_time = None - self.__quote_expiry_time = None - self.__guaranteed = None + + self.__quote_id = None # type: str + self.__quote_currency_pair = None # type: str + self.__quote_price = None # type: float + self.__quote_start_time = None # type: str + self.__quote_expiry_time = None # type: str + self.__guaranteed = None # type: bool + @property def quote_id(self): + """ + The unique ID that is assigned by Alipay to identify an exchange rate. More information: Maximum length: 64 characters + """ return self.__quote_id @quote_id.setter def quote_id(self, value): self.__quote_id = value - @property def quote_currency_pair(self): + """ + The exchange rate between settlement currency and transaction currency. Two currencies are separated with a slash and use the 3-letter ISO-4217 currency code. More information: Maximum length: 16 characters + """ return self.__quote_currency_pair @quote_currency_pair.setter def quote_currency_pair(self, value): self.__quote_currency_pair = value - @property def quote_price(self): + """ + The exchange rate used when a currency conversion between settlement currency and transaction currency occurs. More information: Value range: 1 - unlimited + """ return self.__quote_price @quote_price.setter def quote_price(self, value): self.__quote_price = value - @property def quote_start_time(self): + """ + Effective time of the exchange rate. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__quote_start_time @quote_start_time.setter def quote_start_time(self, value): self.__quote_start_time = value - @property def quote_expiry_time(self): - return self.__quote_start_time + """ + Expiration time of the exchange rate. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ + return self.__quote_expiry_time @quote_expiry_time.setter - def quote_start_time(self, value): + def quote_expiry_time(self, value): self.__quote_expiry_time = value - @property def guaranteed(self): + """ + Guaranteed exchange rate available for payment. + """ return self.__guaranteed @guaranteed.setter def guaranteed(self, value): self.__guaranteed = value - def parse_rsp_body(self, quote_body): - if type(quote_body) == str: - quote_body = json.loads(quote_body) - - if 'quoteId' in quote_body: - self.__quote_id = quote_body['quoteId'] - - if 'quoteCurrencyPair' in quote_body: - self.__quote_currency_pair = quote_body['quoteCurrencyPair'] - - if 'quotePrice' in quote_body: - self.__quote_price = quote_body['quotePrice'] - - if 'quoteStartTime' in quote_body: - self.__quote_start_time = quote_body['quoteStartTime'] - - if 'quoteExpiryTime' in quote_body: - self.__quote_expiry_time = quote_body['quoteExpiryTime'] - if 'guaranteed' in quote_body: - self.__guaranteed = quote_body['guaranteed'] + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "quote_id") and self.quote_id is not None: + params['quoteId'] = self.quote_id + if hasattr(self, "quote_currency_pair") and self.quote_currency_pair is not None: + params['quoteCurrencyPair'] = self.quote_currency_pair + if hasattr(self, "quote_price") and self.quote_price is not None: + params['quotePrice'] = self.quote_price + if hasattr(self, "quote_start_time") and self.quote_start_time is not None: + params['quoteStartTime'] = self.quote_start_time + if hasattr(self, "quote_expiry_time") and self.quote_expiry_time is not None: + params['quoteExpiryTime'] = self.quote_expiry_time + if hasattr(self, "guaranteed") and self.guaranteed is not None: + params['guaranteed'] = self.guaranteed + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'quoteId' in response_body: + self.__quote_id = response_body['quoteId'] + if 'quoteCurrencyPair' in response_body: + self.__quote_currency_pair = response_body['quoteCurrencyPair'] + if 'quotePrice' in response_body: + self.__quote_price = response_body['quotePrice'] + if 'quoteStartTime' in response_body: + self.__quote_start_time = response_body['quoteStartTime'] + if 'quoteExpiryTime' in response_body: + self.__quote_expiry_time = response_body['quoteExpiryTime'] + if 'guaranteed' in response_body: + self.__guaranteed = response_body['guaranteed'] diff --git a/com/alipay/ams/api/model/redirect_action_form.py b/com/alipay/ams/api/model/redirect_action_form.py index af9ab3a..c955803 100644 --- a/com/alipay/ams/api/model/redirect_action_form.py +++ b/com/alipay/ams/api/model/redirect_action_form.py @@ -1,63 +1,82 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -from com.alipay.ams.api.model.method_type import MethodType -class RedirectActionForm(object): +class RedirectActionForm: def __init__(self): - self.__method = None # type:MethodType - self.__parameters = None - self.__redirect_url = None - self.__action_form_type = None + + self.__method = None # type: str + self.__parameters = None # type: str + self.__redirect_url = None # type: str + self.__action_form_type = None # type: str + @property def method(self): + """ + The HTTP method to be used when the merchant initiates a redirection to the redirection URL. Valid values are: POST: Indicates that the request that is sent to the redirection address needs to be a POST request. GET: Indicates that the request that is sent to the redirection address needs to be a GET request. + """ return self.__method @method.setter def method(self, value): self.__method = value - @property def parameters(self): + """ + Parameters required for the HTTP method in the key-value pair. Note: This field is returned only when the method is POST. More information: Maximum length: 2048 characters + """ return self.__parameters @parameters.setter def parameters(self, value): self.__parameters = value - @property def redirect_url(self): + """ + The URL where the user is redirected to. More information: Maximum length: 2048 characters + """ return self.__redirect_url @redirect_url.setter def redirect_url(self, value): self.__redirect_url = value - @property def action_form_type(self): + """ + The value is fixed as RedirectActionForm. More information: Maximum length: 32 characters + """ return self.__action_form_type @action_form_type.setter def action_form_type(self, value): self.__action_form_type = value - def parse_rsp_body(self, redirect_action_form_body): - if type(redirect_action_form_body) == str: - redirect_action_form_body = json.loads(redirect_action_form_body) - - if 'method' in redirect_action_form_body: - self.__method = redirect_action_form_body['method'] - - if 'parameters' in redirect_action_form_body: - self.__parameters = redirect_action_form_body['parameters'] - - if 'redirectUrl' in redirect_action_form_body: - self.__redirect_url = redirect_action_form_body['redirectUrl'] - if 'actionFormType' in redirect_action_form_body: - self.__action_form_type = redirect_action_form_body['actionFormType'] + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "method") and self.method is not None: + params['method'] = self.method + if hasattr(self, "parameters") and self.parameters is not None: + params['parameters'] = self.parameters + if hasattr(self, "redirect_url") and self.redirect_url is not None: + params['redirectUrl'] = self.redirect_url + if hasattr(self, "action_form_type") and self.action_form_type is not None: + params['actionFormType'] = self.action_form_type + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'method' in response_body: + self.__method = response_body['method'] + if 'parameters' in response_body: + self.__parameters = response_body['parameters'] + if 'redirectUrl' in response_body: + self.__redirect_url = response_body['redirectUrl'] + if 'actionFormType' in response_body: + self.__action_form_type = response_body['actionFormType'] diff --git a/com/alipay/ams/api/model/refund_detail.py b/com/alipay/ams/api/model/refund_detail.py index c492040..dd8fcb7 100644 --- a/com/alipay/ams/api/model/refund_detail.py +++ b/com/alipay/ams/api/model/refund_detail.py @@ -1,35 +1,56 @@ import json - from com.alipay.ams.api.model.amount import Amount from com.alipay.ams.api.model.refund_from_type import RefundFromType -class RefundDetail(object): + + +class RefundDetail: def __init__(self): - self.__refund_amount = None # type:Amount - self.__refund_from = None # type:RefundFromType + + self.__refund_amount = None # type: Amount + self.__refund_from = None # type: RefundFromType + @property def refund_amount(self): + """Gets the refund_amount of this RefundDetail. + + """ return self.__refund_amount @refund_amount.setter def refund_amount(self, value): self.__refund_amount = value - @property def refund_from(self): + """Gets the refund_from of this RefundDetail. + + """ return self.__refund_from @refund_from.setter def refund_from(self, value): self.__refund_from = value - def parse_rsp_body(self, quote_body): - if type(quote_body) == str: - quote_body = json.loads(quote_body) - if 'refundAmount' in quote_body: + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "refund_amount") and self.refund_amount is not None: + params['refundAmount'] = self.refund_amount + if hasattr(self, "refund_from") and self.refund_from is not None: + params['refundFrom'] = self.refund_from + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'refundAmount' in response_body: self.__refund_amount = Amount() - self.__refund_amount.parse_rsp_body(quote_body['refundAmount']) - if 'refundFrom' in quote_body: - self.__refund_from = quote_body['refundFrom'] + self.__refund_amount.parse_rsp_body(response_body['refundAmount']) + if 'refundFrom' in response_body: + refund_from_temp = RefundFromType.value_of(response_body['refundFrom']) + self.__refund_from = refund_from_temp diff --git a/com/alipay/ams/api/model/refund_from_type.py b/com/alipay/ams/api/model/refund_from_type.py index 52388d9..1884ab7 100644 --- a/com/alipay/ams/api/model/refund_from_type.py +++ b/com/alipay/ams/api/model/refund_from_type.py @@ -1,11 +1,24 @@ from enum import Enum, unique - - @unique class RefundFromType(Enum): + """RefundFromType枚举类""" + SELLER = "SELLER" MARKETPLACE = "MARKETPLACE" UNSETTLED_FUNDS = "UNSETTLED_FUNDS" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if RefundFromType.SELLER.value == value: + return RefundFromType.SELLER + if RefundFromType.MARKETPLACE.value == value: + return RefundFromType.MARKETPLACE + if RefundFromType.UNSETTLED_FUNDS.value == value: + return RefundFromType.UNSETTLED_FUNDS + return None diff --git a/com/alipay/ams/api/model/result.py b/com/alipay/ams/api/model/result.py index 4e43c72..07e1954 100644 --- a/com/alipay/ams/api/model/result.py +++ b/com/alipay/ams/api/model/result.py @@ -1,39 +1,69 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - from com.alipay.ams.api.model.result_status_type import ResultStatusType -class Result(object): + + +class Result: def __init__(self): - self.__result_code = None - self.__result_message = None - self.__result_status = None + + self.__result_code = None # type: str + self.__result_status = None # type: ResultStatusType + self.__result_message = None # type: str + @property def result_code(self): + """ + The result code. + """ return self.__result_code + @result_code.setter + def result_code(self, value): + self.__result_code = value + @property + def result_status(self): + """Gets the result_status of this Result. + + """ + return self.__result_status + + @result_status.setter + def result_status(self, value): + self.__result_status = value @property def result_message(self): + """ + The result message. + """ return self.__result_message - @property - def result_status(self): - return self.__result_status + @result_message.setter + def result_message(self, value): + self.__result_message = value + - def parse_rsp_body(self, result_body): - if type(result_body) == str: - result_body = json.loads(result_body) + - if 'resultCode' in result_body: - self.__result_code = result_body['resultCode'] + def to_ams_dict(self): + params = dict() + if hasattr(self, "result_code") and self.result_code is not None: + params['resultCode'] = self.result_code + if hasattr(self, "result_status") and self.result_status is not None: + params['resultStatus'] = self.result_status + if hasattr(self, "result_message") and self.result_message is not None: + params['resultMessage'] = self.result_message + return params - if 'resultMessage' in result_body: - self.__result_message = result_body['resultMessage'] - if 'resultStatus' in result_body: - result_status = ResultStatusType.value_of(result_body['resultStatus']) - self.__result_status = result_status + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'resultCode' in response_body: + self.__result_code = response_body['resultCode'] + if 'resultStatus' in response_body: + result_status_temp = ResultStatusType.value_of(response_body['resultStatus']) + self.__result_status = result_status_temp + if 'resultMessage' in response_body: + self.__result_message = response_body['resultMessage'] diff --git a/com/alipay/ams/api/model/result_status_type.py b/com/alipay/ams/api/model/result_status_type.py index a669ffb..8eca7cd 100644 --- a/com/alipay/ams/api/model/result_status_type.py +++ b/com/alipay/ams/api/model/result_status_type.py @@ -1,15 +1,13 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class ResultStatusType(Enum): + """ResultStatusType枚举类""" + S = "S" F = "F" U = "U" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name @staticmethod @@ -19,9 +17,8 @@ def value_of(value): if ResultStatusType.S.value == value: return ResultStatusType.S - elif ResultStatusType.F.value == value: + if ResultStatusType.F.value == value: return ResultStatusType.F - elif ResultStatusType.U.value == value: + if ResultStatusType.U.value == value: return ResultStatusType.U - else: - return None + return None diff --git a/com/alipay/ams/api/model/risk_address.py b/com/alipay/ams/api/model/risk_address.py new file mode 100644 index 0000000..903b641 --- /dev/null +++ b/com/alipay/ams/api/model/risk_address.py @@ -0,0 +1,97 @@ +import json + + + + +class RiskAddress: + def __init__(self): + + self.__shipping_phone_type = None # type: str + self.__is_bill_ship_state_same = None # type: bool + self.__is_previous_state_same = None # type: bool + self.__loc_to_ship_distance = None # type: int + self.__min_previous_ship_to_bill_distance = None # type: int + + + @property + def shipping_phone_type(self): + """ + The type of the receiver's phone number + """ + return self.__shipping_phone_type + + @shipping_phone_type.setter + def shipping_phone_type(self, value): + self.__shipping_phone_type = value + @property + def is_bill_ship_state_same(self): + """ + Indicates whether the billing state is the same as the shipping state + """ + return self.__is_bill_ship_state_same + + @is_bill_ship_state_same.setter + def is_bill_ship_state_same(self, value): + self.__is_bill_ship_state_same = value + @property + def is_previous_state_same(self): + """ + Indicates whether a previous billing state is the same as the shipping state + """ + return self.__is_previous_state_same + + @is_previous_state_same.setter + def is_previous_state_same(self, value): + self.__is_previous_state_same = value + @property + def loc_to_ship_distance(self): + """ + The distance in meters between the buyer's location and their shipping address. + """ + return self.__loc_to_ship_distance + + @loc_to_ship_distance.setter + def loc_to_ship_distance(self, value): + self.__loc_to_ship_distance = value + @property + def min_previous_ship_to_bill_distance(self): + """ + The minimum distance in meters between the buyer's previous shipping address and their billing address. + """ + return self.__min_previous_ship_to_bill_distance + + @min_previous_ship_to_bill_distance.setter + def min_previous_ship_to_bill_distance(self, value): + self.__min_previous_ship_to_bill_distance = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "shipping_phone_type") and self.shipping_phone_type is not None: + params['shippingPhoneType'] = self.shipping_phone_type + if hasattr(self, "is_bill_ship_state_same") and self.is_bill_ship_state_same is not None: + params['isBillShipStateSame'] = self.is_bill_ship_state_same + if hasattr(self, "is_previous_state_same") and self.is_previous_state_same is not None: + params['isPreviousStateSame'] = self.is_previous_state_same + if hasattr(self, "loc_to_ship_distance") and self.loc_to_ship_distance is not None: + params['locToShipDistance'] = self.loc_to_ship_distance + if hasattr(self, "min_previous_ship_to_bill_distance") and self.min_previous_ship_to_bill_distance is not None: + params['minPreviousShipToBillDistance'] = self.min_previous_ship_to_bill_distance + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'shippingPhoneType' in response_body: + self.__shipping_phone_type = response_body['shippingPhoneType'] + if 'isBillShipStateSame' in response_body: + self.__is_bill_ship_state_same = response_body['isBillShipStateSame'] + if 'isPreviousStateSame' in response_body: + self.__is_previous_state_same = response_body['isPreviousStateSame'] + if 'locToShipDistance' in response_body: + self.__loc_to_ship_distance = response_body['locToShipDistance'] + if 'minPreviousShipToBillDistance' in response_body: + self.__min_previous_ship_to_bill_distance = response_body['minPreviousShipToBillDistance'] diff --git a/com/alipay/ams/api/model/risk_buyer.py b/com/alipay/ams/api/model/risk_buyer.py new file mode 100644 index 0000000..34bd926 --- /dev/null +++ b/com/alipay/ams/api/model/risk_buyer.py @@ -0,0 +1,82 @@ +import json + + + + +class RiskBuyer: + def __init__(self): + + self.__note_to_merchant = None # type: str + self.__note_to_shipping = None # type: str + self.__order_count_in1_h = None # type: int + self.__order_count_in24_h = None # type: int + + + @property + def note_to_merchant(self): + """ + The buyer's note to a merchant. + """ + return self.__note_to_merchant + + @note_to_merchant.setter + def note_to_merchant(self, value): + self.__note_to_merchant = value + @property + def note_to_shipping(self): + """ + The buyer's note to a deliveryman or a take-out rider. + """ + return self.__note_to_shipping + + @note_to_shipping.setter + def note_to_shipping(self, value): + self.__note_to_shipping = value + @property + def order_count_in1_h(self): + """ + The successful orders the buyer made within the last one hour. + """ + return self.__order_count_in1_h + + @order_count_in1_h.setter + def order_count_in1_h(self, value): + self.__order_count_in1_h = value + @property + def order_count_in24_h(self): + """ + The successful orders the buyer made within the last 24 hour. + """ + return self.__order_count_in24_h + + @order_count_in24_h.setter + def order_count_in24_h(self, value): + self.__order_count_in24_h = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "note_to_merchant") and self.note_to_merchant is not None: + params['noteToMerchant'] = self.note_to_merchant + if hasattr(self, "note_to_shipping") and self.note_to_shipping is not None: + params['noteToShipping'] = self.note_to_shipping + if hasattr(self, "order_count_in1_h") and self.order_count_in1_h is not None: + params['orderCountIn1H'] = self.order_count_in1_h + if hasattr(self, "order_count_in24_h") and self.order_count_in24_h is not None: + params['orderCountIn24H'] = self.order_count_in24_h + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'noteToMerchant' in response_body: + self.__note_to_merchant = response_body['noteToMerchant'] + if 'noteToShipping' in response_body: + self.__note_to_shipping = response_body['noteToShipping'] + if 'orderCountIn1H' in response_body: + self.__order_count_in1_h = response_body['orderCountIn1H'] + if 'orderCountIn24H' in response_body: + self.__order_count_in24_h = response_body['orderCountIn24H'] diff --git a/com/alipay/ams/api/model/risk_data.py b/com/alipay/ams/api/model/risk_data.py new file mode 100644 index 0000000..d2c6317 --- /dev/null +++ b/com/alipay/ams/api/model/risk_data.py @@ -0,0 +1,124 @@ +import json +from com.alipay.ams.api.model.risk_order import RiskOrder +from com.alipay.ams.api.model.risk_buyer import RiskBuyer +from com.alipay.ams.api.model.risk_env import RiskEnv +from com.alipay.ams.api.model.risk_signal import RiskSignal +from com.alipay.ams.api.model.risk_address import RiskAddress +from com.alipay.ams.api.model.card_verification_result import CardVerificationResult + + + + +class RiskData: + def __init__(self): + + self.__order = None # type: RiskOrder + self.__buyer = None # type: RiskBuyer + self.__env = None # type: RiskEnv + self.__risk_signal = None # type: RiskSignal + self.__address = None # type: RiskAddress + self.__card_verification_result = None # type: CardVerificationResult + + + @property + def order(self): + """Gets the order of this RiskData. + + """ + return self.__order + + @order.setter + def order(self, value): + self.__order = value + @property + def buyer(self): + """Gets the buyer of this RiskData. + + """ + return self.__buyer + + @buyer.setter + def buyer(self, value): + self.__buyer = value + @property + def env(self): + """Gets the env of this RiskData. + + """ + return self.__env + + @env.setter + def env(self, value): + self.__env = value + @property + def risk_signal(self): + """Gets the risk_signal of this RiskData. + + """ + return self.__risk_signal + + @risk_signal.setter + def risk_signal(self, value): + self.__risk_signal = value + @property + def address(self): + """Gets the address of this RiskData. + + """ + return self.__address + + @address.setter + def address(self, value): + self.__address = value + @property + def card_verification_result(self): + """Gets the card_verification_result of this RiskData. + + """ + return self.__card_verification_result + + @card_verification_result.setter + def card_verification_result(self, value): + self.__card_verification_result = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "order") and self.order is not None: + params['order'] = self.order + if hasattr(self, "buyer") and self.buyer is not None: + params['buyer'] = self.buyer + if hasattr(self, "env") and self.env is not None: + params['env'] = self.env + if hasattr(self, "risk_signal") and self.risk_signal is not None: + params['riskSignal'] = self.risk_signal + if hasattr(self, "address") and self.address is not None: + params['address'] = self.address + if hasattr(self, "card_verification_result") and self.card_verification_result is not None: + params['cardVerificationResult'] = self.card_verification_result + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'order' in response_body: + self.__order = RiskOrder() + self.__order.parse_rsp_body(response_body['order']) + if 'buyer' in response_body: + self.__buyer = RiskBuyer() + self.__buyer.parse_rsp_body(response_body['buyer']) + if 'env' in response_body: + self.__env = RiskEnv() + self.__env.parse_rsp_body(response_body['env']) + if 'riskSignal' in response_body: + self.__risk_signal = RiskSignal() + self.__risk_signal.parse_rsp_body(response_body['riskSignal']) + if 'address' in response_body: + self.__address = RiskAddress() + self.__address.parse_rsp_body(response_body['address']) + if 'cardVerificationResult' in response_body: + self.__card_verification_result = CardVerificationResult() + self.__card_verification_result.parse_rsp_body(response_body['cardVerificationResult']) diff --git a/com/alipay/ams/api/model/risk_env.py b/com/alipay/ams/api/model/risk_env.py new file mode 100644 index 0000000..6f3b916 --- /dev/null +++ b/com/alipay/ams/api/model/risk_env.py @@ -0,0 +1,37 @@ +import json + + + + +class RiskEnv: + def __init__(self): + + self.__ip_address_type = None # type: str + + + @property + def ip_address_type(self): + """ + The type of an IP address + """ + return self.__ip_address_type + + @ip_address_type.setter + def ip_address_type(self, value): + self.__ip_address_type = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "ip_address_type") and self.ip_address_type is not None: + params['ipAddressType'] = self.ip_address_type + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'ipAddressType' in response_body: + self.__ip_address_type = response_body['ipAddressType'] diff --git a/com/alipay/ams/api/model/risk_order.py b/com/alipay/ams/api/model/risk_order.py new file mode 100644 index 0000000..211441a --- /dev/null +++ b/com/alipay/ams/api/model/risk_order.py @@ -0,0 +1,52 @@ +import json + + + + +class RiskOrder: + def __init__(self): + + self.__order_type = None # type: str + self.__referring_site = None # type: str + + + @property + def order_type(self): + """ + The order type + """ + return self.__order_type + + @order_type.setter + def order_type(self, value): + self.__order_type = value + @property + def referring_site(self): + """ + The webpage where the buyer accessed the merchant. + """ + return self.__referring_site + + @referring_site.setter + def referring_site(self, value): + self.__referring_site = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "order_type") and self.order_type is not None: + params['orderType'] = self.order_type + if hasattr(self, "referring_site") and self.referring_site is not None: + params['referringSite'] = self.referring_site + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'orderType' in response_body: + self.__order_type = response_body['orderType'] + if 'referringSite' in response_body: + self.__referring_site = response_body['referringSite'] diff --git a/com/alipay/ams/api/model/risk_signal.py b/com/alipay/ams/api/model/risk_signal.py new file mode 100644 index 0000000..a9a06cf --- /dev/null +++ b/com/alipay/ams/api/model/risk_signal.py @@ -0,0 +1,52 @@ +import json + + + + +class RiskSignal: + def __init__(self): + + self.__risk_code = None # type: str + self.__risk_reason = None # type: str + + + @property + def risk_code(self): + """ + The tag assigned by a merchant to a risky transaction. + """ + return self.__risk_code + + @risk_code.setter + def risk_code(self, value): + self.__risk_code = value + @property + def risk_reason(self): + """ + The reason why a transaction is identified as risky provided by a merchant. + """ + return self.__risk_reason + + @risk_reason.setter + def risk_reason(self, value): + self.__risk_reason = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "risk_code") and self.risk_code is not None: + params['riskCode'] = self.risk_code + if hasattr(self, "risk_reason") and self.risk_reason is not None: + params['riskReason'] = self.risk_reason + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'riskCode' in response_body: + self.__risk_code = response_body['riskCode'] + if 'riskReason' in response_body: + self.__risk_reason = response_body['riskReason'] diff --git a/com/alipay/ams/api/model/risk_three_ds_result.py b/com/alipay/ams/api/model/risk_three_ds_result.py new file mode 100644 index 0000000..078bc50 --- /dev/null +++ b/com/alipay/ams/api/model/risk_three_ds_result.py @@ -0,0 +1,82 @@ +import json + + + + +class RiskThreeDSResult: + def __init__(self): + + self.__three_ds_version = None # type: str + self.__three_ds_interaction_mode = None # type: str + self.__eci = None # type: str + self.__cavv = None # type: str + + + @property + def three_ds_version(self): + """ + The version of 3D Secure protocol + """ + return self.__three_ds_version + + @three_ds_version.setter + def three_ds_version(self, value): + self.__three_ds_version = value + @property + def three_ds_interaction_mode(self): + """ + Indicates the type of user interactions during 3DS 2.0 authentication + """ + return self.__three_ds_interaction_mode + + @three_ds_interaction_mode.setter + def three_ds_interaction_mode(self, value): + self.__three_ds_interaction_mode = value + @property + def eci(self): + """ + Electronic Commerce Indicator (ECI) that is returned by the card scheme + """ + return self.__eci + + @eci.setter + def eci(self, value): + self.__eci = value + @property + def cavv(self): + """ + The cardholder authentication value + """ + return self.__cavv + + @cavv.setter + def cavv(self, value): + self.__cavv = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "three_ds_version") and self.three_ds_version is not None: + params['threeDSVersion'] = self.three_ds_version + if hasattr(self, "three_ds_interaction_mode") and self.three_ds_interaction_mode is not None: + params['threeDSInteractionMode'] = self.three_ds_interaction_mode + if hasattr(self, "eci") and self.eci is not None: + params['eci'] = self.eci + if hasattr(self, "cavv") and self.cavv is not None: + params['cavv'] = self.cavv + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'threeDSVersion' in response_body: + self.__three_ds_version = response_body['threeDSVersion'] + if 'threeDSInteractionMode' in response_body: + self.__three_ds_interaction_mode = response_body['threeDSInteractionMode'] + if 'eci' in response_body: + self.__eci = response_body['eci'] + if 'cavv' in response_body: + self.__cavv = response_body['cavv'] diff --git a/com/alipay/ams/api/model/scope_type.py b/com/alipay/ams/api/model/scope_type.py index 33c8730..a2e59f2 100644 --- a/com/alipay/ams/api/model/scope_type.py +++ b/com/alipay/ams/api/model/scope_type.py @@ -1,10 +1,8 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class ScopeType(Enum): + """ScopeType枚举类""" + BASE_USER_INFO = "BASE_USER_INFO" AGREEMENT_PAY = "AGREEMENT_PAY" USER_INFO = "USER_INFO" @@ -13,5 +11,26 @@ class ScopeType(Enum): SEND_OTP = "SEND_OTP" TAOBAO_REBIND = "TAOBAO_REBIND" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if ScopeType.BASE_USER_INFO.value == value: + return ScopeType.BASE_USER_INFO + if ScopeType.AGREEMENT_PAY.value == value: + return ScopeType.AGREEMENT_PAY + if ScopeType.USER_INFO.value == value: + return ScopeType.USER_INFO + if ScopeType.USER_LOGIN_ID.value == value: + return ScopeType.USER_LOGIN_ID + if ScopeType.HASH_LOGIN_ID.value == value: + return ScopeType.HASH_LOGIN_ID + if ScopeType.SEND_OTP.value == value: + return ScopeType.SEND_OTP + if ScopeType.TAOBAO_REBIND.value == value: + return ScopeType.TAOBAO_REBIND + return None diff --git a/com/alipay/ams/api/model/settle_to_type.py b/com/alipay/ams/api/model/settle_to_type.py index 8e5851b..92f0258 100644 --- a/com/alipay/ams/api/model/settle_to_type.py +++ b/com/alipay/ams/api/model/settle_to_type.py @@ -1,10 +1,21 @@ from enum import Enum, unique - - @unique class SettleToType(Enum): + """SettleToType枚举类""" + SELLER = "SELLER" MARKETPLACE = "MARKETPLACE" - def to_ams_dict(self): - return self.name \ No newline at end of file + def to_ams_dict(self) -> str: + return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if SettleToType.SELLER.value == value: + return SettleToType.SELLER + if SettleToType.MARKETPLACE.value == value: + return SettleToType.MARKETPLACE + return None diff --git a/com/alipay/ams/api/model/settlement_bank_account.py b/com/alipay/ams/api/model/settlement_bank_account.py index f61c819..a03975e 100644 --- a/com/alipay/ams/api/model/settlement_bank_account.py +++ b/com/alipay/ams/api/model/settlement_bank_account.py @@ -1,143 +1,208 @@ +import json from com.alipay.ams.api.model.account_holder_type import AccountHolderType from com.alipay.ams.api.model.account_type import AccountType from com.alipay.ams.api.model.address import Address + + class SettlementBankAccount: def __init__(self): - self.__bank_account_no = None - self.__account_holder_name = None - self.__swift_code = None - self.__bank_region = None + + self.__bank_account_no = None # type: str + self.__account_holder_name = None # type: str + self.__swift_code = None # type: str + self.__bank_region = None # type: str self.__account_holder_type = None # type: AccountHolderType - self.__routing_number = None - self.__branch_code = None - self.__account_holder_tIN = None + self.__routing_number = None # type: str + self.__branch_code = None # type: str + self.__account_holder_tin = None # type: str self.__account_type = None # type: AccountType - self.__bank_name = None + self.__bank_name = None # type: str self.__account_holder_address = None # type: Address - self.__iban = None + self.__iban = None # type: str + @property def bank_account_no(self): + """ + The international bank account number. The standardized formats in different areas are: Brazil: ^[0-9]{0,20}$ such as 123456789 More information: Maximum length: 64 characters + """ return self.__bank_account_no @bank_account_no.setter def bank_account_no(self, value): self.__bank_account_no = value - @property def account_holder_name(self): + """ + The full name of the account holder. The standardized formats in different areas are: Brazil: ^[A-Za-z0-9/() .,\\-?:'+]{0,50}$ More information: Maximum length: 64 characters + """ return self.__account_holder_name @account_holder_name.setter def account_holder_name(self, value): self.__account_holder_name = value - @property def swift_code(self): + """ + The eight-character or eleven-character BIC or SWIFT code of the bank. Specify this parameter when the bank card issuing country is Brazil. More information: Maximum length: 11 characters + """ return self.__swift_code @swift_code.setter def swift_code(self, value): self.__swift_code = value - @property def bank_region(self): + """ + The region where the bank is located. The value of this parameter is a 2-letter region or country code that follows the ISO 3166 Country Codes standard. More information: Maximum length: 2 characters + """ return self.__bank_region @bank_region.setter def bank_region(self, value): self.__bank_region = value - @property def account_holder_type(self): + """Gets the account_holder_type of this SettlementBankAccount. + + """ return self.__account_holder_type @account_holder_type.setter def account_holder_type(self, value): self.__account_holder_type = value - @property def routing_number(self): + """ + The routing number. See Bank routing number for valid values. Specify this parameter when the issuing bank is in Brazil. More information: Maximum length: 9 characters + """ return self.__routing_number @routing_number.setter def routing_number(self, value): self.__routing_number = value - @property def branch_code(self): + """ + The branch code of the bank. See Bank branch code for valid value s. Specify this parameter when the issuing bank is in Brazil. More information: Maximum length: 32 characters + """ return self.__branch_code @branch_code.setter def branch_code(self, value): self.__branch_code = value - @property - def account_holder_tIN(self): - return self.__account_holder_tIN - - @account_holder_tIN.setter - def account_holder_tIN(self, value): - self.__account_holder_tIN = value - + def account_holder_tin(self): + """ + The tax identification number (TIN) of the account holder. For the account holder in Brazil: If the account holder is an individual, the value of this parameter is an eleven-character tax ID known as CPF. If the account holder is a legal entity, the value of this parameter is a fourteen-character tax ID known as CNPJ. Specify this parameter when the issuing bank is in Brazil. More information: Maximum length: 32 characters + """ + return self.__account_holder_tin + + @account_holder_tin.setter + def account_holder_tin(self, value): + self.__account_holder_tin = value @property def account_type(self): + """Gets the account_type of this SettlementBankAccount. + + """ return self.__account_type @account_type.setter def account_type(self, value): self.__account_type = value - @property def bank_name(self): + """ + The name of the bank. Specify this parameter when the card issuing country is the United States. More information: Maximum length: 256 characters + """ return self.__bank_name @bank_name.setter def bank_name(self, value): self.__bank_name = value - @property def account_holder_address(self): + """Gets the account_holder_address of this SettlementBankAccount. + + """ return self.__account_holder_address @account_holder_address.setter def account_holder_address(self, value): self.__account_holder_address = value - @property def iban(self): + """ + The International Bank Account Number (IBAN) used to identify a bank account. Specify this parameter when the card issuing country is the United Kingdom or belongs to the European Union. More information: Maximum length: 34 characters + """ return self.__iban @iban.setter def iban(self, value): self.__iban = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "bank_account_no") and self.bank_account_no: + if hasattr(self, "bank_account_no") and self.bank_account_no is not None: params['bankAccountNo'] = self.bank_account_no - if hasattr(self, "account_holder_name") and self.account_holder_name: + if hasattr(self, "account_holder_name") and self.account_holder_name is not None: params['accountHolderName'] = self.account_holder_name - if hasattr(self, "swift_code") and self.swift_code: + if hasattr(self, "swift_code") and self.swift_code is not None: params['swiftCode'] = self.swift_code - if hasattr(self, "bank_region") and self.bank_region: + if hasattr(self, "bank_region") and self.bank_region is not None: params['bankRegion'] = self.bank_region - if hasattr(self, "account_holder_type") and self.account_holder_type: - params['accountHolderType'] = self.account_holder_type.value - if hasattr(self, "routing_number") and self.routing_number: + if hasattr(self, "account_holder_type") and self.account_holder_type is not None: + params['accountHolderType'] = self.account_holder_type + if hasattr(self, "routing_number") and self.routing_number is not None: params['routingNumber'] = self.routing_number - if hasattr(self, "branch_code") and self.branch_code: + if hasattr(self, "branch_code") and self.branch_code is not None: params['branchCode'] = self.branch_code - if hasattr(self, "account_holder_tIN") and self.account_holder_tIN: - params['accountHolderTIN'] = self.account_holder_tIN - if hasattr(self, "account_type") and self.account_type: - params['accountType'] = self.account_type.value - if hasattr(self, "bank_name") and self.bank_name: + if hasattr(self, "account_holder_tin") and self.account_holder_tin is not None: + params['accountHolderTIN'] = self.account_holder_tin + if hasattr(self, "account_type") and self.account_type is not None: + params['accountType'] = self.account_type + if hasattr(self, "bank_name") and self.bank_name is not None: params['bankName'] = self.bank_name - if hasattr(self, "account_holder_address") and self.account_holder_address: - params['accountHolderAddress'] = self.account_holder_address.to_ams_dict() - if hasattr(self, "iban") and self.iban: + if hasattr(self, "account_holder_address") and self.account_holder_address is not None: + params['accountHolderAddress'] = self.account_holder_address + if hasattr(self, "iban") and self.iban is not None: params['iban'] = self.iban return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'bankAccountNo' in response_body: + self.__bank_account_no = response_body['bankAccountNo'] + if 'accountHolderName' in response_body: + self.__account_holder_name = response_body['accountHolderName'] + if 'swiftCode' in response_body: + self.__swift_code = response_body['swiftCode'] + if 'bankRegion' in response_body: + self.__bank_region = response_body['bankRegion'] + if 'accountHolderType' in response_body: + account_holder_type_temp = AccountHolderType.value_of(response_body['accountHolderType']) + self.__account_holder_type = account_holder_type_temp + if 'routingNumber' in response_body: + self.__routing_number = response_body['routingNumber'] + if 'branchCode' in response_body: + self.__branch_code = response_body['branchCode'] + if 'accountHolderTIN' in response_body: + self.__account_holder_tin = response_body['accountHolderTIN'] + if 'accountType' in response_body: + account_type_temp = AccountType.value_of(response_body['accountType']) + self.__account_type = account_type_temp + if 'bankName' in response_body: + self.__bank_name = response_body['bankName'] + if 'accountHolderAddress' in response_body: + self.__account_holder_address = Address() + self.__account_holder_address.parse_rsp_body(response_body['accountHolderAddress']) + if 'iban' in response_body: + self.__iban = response_body['iban'] diff --git a/com/alipay/ams/api/model/settlement_detail.py b/com/alipay/ams/api/model/settlement_detail.py index 42c8ec6..37147db 100644 --- a/com/alipay/ams/api/model/settlement_detail.py +++ b/com/alipay/ams/api/model/settlement_detail.py @@ -1,32 +1,56 @@ -from com.alipay.ams.api.model.amount import Amount +import json from com.alipay.ams.api.model.settle_to_type import SettleToType +from com.alipay.ams.api.model.amount import Amount + + class SettlementDetail: def __init__(self): - self.__settle_to = None #type: SettleToType - self.__settlement_amount = None #type: Amount + + self.__settle_to = None # type: SettleToType + self.__settlement_amount = None # type: Amount + @property def settle_to(self): + """Gets the settle_to of this SettlementDetail. + + """ return self.__settle_to @settle_to.setter def settle_to(self, value): self.__settle_to = value - @property def settlement_amount(self): + """Gets the settlement_amount of this SettlementDetail. + + """ return self.__settlement_amount @settlement_amount.setter def settlement_amount(self, value): self.__settlement_amount = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, 'settle_to') and self.settle_to: - params['settleTo'] = self.settle_to.value - if hasattr(self, 'settlement_amount') and self.settlement_amount: - params['settlementAmount'] = self.settlement_amount.to_ams_dict() - return params \ No newline at end of file + if hasattr(self, "settle_to") and self.settle_to is not None: + params['settleTo'] = self.settle_to + if hasattr(self, "settlement_amount") and self.settlement_amount is not None: + params['settlementAmount'] = self.settlement_amount + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'settleTo' in response_body: + settle_to_temp = SettleToType.value_of(response_body['settleTo']) + self.__settle_to = settle_to_temp + if 'settlementAmount' in response_body: + self.__settlement_amount = Amount() + self.__settlement_amount.parse_rsp_body(response_body['settlementAmount']) diff --git a/com/alipay/ams/api/model/settlement_info.py b/com/alipay/ams/api/model/settlement_info.py index cdfdfc5..0f97b74 100644 --- a/com/alipay/ams/api/model/settlement_info.py +++ b/com/alipay/ams/api/model/settlement_info.py @@ -1,31 +1,54 @@ +import json from com.alipay.ams.api.model.settlement_bank_account import SettlementBankAccount + + class SettlementInfo: def __init__(self): - self.__settlement_currency = None - self.__settlement_bank_account = None #type: SettlementBankAccount + + self.__settlement_currency = None # type: str + self.__settlement_bank_account = None # type: SettlementBankAccount + @property def settlement_currency(self): + """ + The sub-merchant's settlement currency that is specified in the settlement contract. The value of this parameter is a 3-letter currency code that follows the ISO 4217 standard. More information: Maximum length: 3 characters + """ return self.__settlement_currency @settlement_currency.setter def settlement_currency(self, value): self.__settlement_currency = value - @property def settlement_bank_account(self): + """Gets the settlement_bank_account of this SettlementInfo. + + """ return self.__settlement_bank_account @settlement_bank_account.setter def settlement_bank_account(self, value): self.__settlement_bank_account = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, 'settlement_currency') and self.settlement_currency: + if hasattr(self, "settlement_currency") and self.settlement_currency is not None: params['settlementCurrency'] = self.settlement_currency - if hasattr(self, 'settlement_bank_account') and self.settlement_bank_account: - params['settlementBankAccount'] = self.settlement_bank_account.to_ams_dict() - return params \ No newline at end of file + if hasattr(self, "settlement_bank_account") and self.settlement_bank_account is not None: + params['settlementBankAccount'] = self.settlement_bank_account + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'settlementCurrency' in response_body: + self.__settlement_currency = response_body['settlementCurrency'] + if 'settlementBankAccount' in response_body: + self.__settlement_bank_account = SettlementBankAccount() + self.__settlement_bank_account.parse_rsp_body(response_body['settlementBankAccount']) diff --git a/com/alipay/ams/api/model/settlement_strategy.py b/com/alipay/ams/api/model/settlement_strategy.py index 9ed33ff..e58cfdf 100644 --- a/com/alipay/ams/api/model/settlement_strategy.py +++ b/com/alipay/ams/api/model/settlement_strategy.py @@ -1,22 +1,37 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json -class SettlementStrategy(object): + + +class SettlementStrategy: def __init__(self): - self.__settlement_currency = None + + self.__settlement_currency = None # type: str + @property def settlement_currency(self): + """ + The ISO currency code of the currency that the merchant wants to be settled against. The field is required if the merchant signed up for multiple currencies to settle. More information: Maximum length: 3 characters + """ return self.__settlement_currency @settlement_currency.setter def settlement_currency(self, value): self.__settlement_currency = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "settlement_currency") and self.settlement_currency: + if hasattr(self, "settlement_currency") and self.settlement_currency is not None: params['settlementCurrency'] = self.settlement_currency - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'settlementCurrency' in response_body: + self.__settlement_currency = response_body['settlementCurrency'] diff --git a/com/alipay/ams/api/model/shipping.py b/com/alipay/ams/api/model/shipping.py index a2d9484..e7584b8 100644 --- a/com/alipay/ams/api/model/shipping.py +++ b/com/alipay/ams/api/model/shipping.py @@ -1,115 +1,111 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json +from com.alipay.ams.api.model.user_name import UserName from com.alipay.ams.api.model.address import Address from com.alipay.ams.api.model.amount import Amount from com.alipay.ams.api.model.delivery_estimate import DeliveryEstimate -from com.alipay.ams.api.model.user_name import UserName -class Shipping(object): - def __init__(self): - self.__shipping_name = None # type:UserName - self.__shipping_address = None # type:Address - self.__shipping_carrier = None - self.__shipping_phone_no = None - self.__shipping_number = None - self.__ship_to_email = None - self.__notes = None - self.__shipping_fee_id = None - self.__shipping_fee = None # type: Amount - self.__shipping_description = None - self.__delivery_estimate = None # type: DeliveryEstimate +class Shipping: + def __init__(self): + + self.__shipping_name = None # type: UserName + self.__shipping_address = None # type: Address + self.__shipping_carrier = None # type: str + self.__shipping_phone_no = None # type: str + self.__ship_to_email = None # type: str + self.__shipping_fee_id = None # type: str + self.__shipping_fee = None # type: Amount + self.__shipping_description = None # type: str + self.__delivery_estimate = None # type: DeliveryEstimate + @property def shipping_name(self): + """Gets the shipping_name of this Shipping. + + """ return self.__shipping_name @shipping_name.setter def shipping_name(self, value): self.__shipping_name = value - @property def shipping_address(self): + """Gets the shipping_address of this Shipping. + + """ return self.__shipping_address @shipping_address.setter def shipping_address(self, value): self.__shipping_address = value - @property def shipping_carrier(self): + """ + The delivery service provider for shipping a physical product, such as FedEx, UPS, or USPS. Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 128 characters + """ return self.__shipping_carrier @shipping_carrier.setter def shipping_carrier(self, value): self.__shipping_carrier = value - @property def shipping_phone_no(self): + """ + The phone number of a recipient (including extension). Specify this parameter when you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 16 characters + """ return self.__shipping_phone_no @shipping_phone_no.setter def shipping_phone_no(self, value): self.__shipping_phone_no = value - - - @property - def shipping_number(self): - return self.__shipping_number - - @shipping_number.setter - def shipping_number(self, value): - self.__shipping_number = value - - @property def ship_to_email(self): + """ + The email address where virtual goods are sent. Specify this parameter when one of the following conditions is met: if you require risk control. if you are a digital and entertainment merchant. Providing this information helps to increase fraud and identity theft detection. More information: Maximum length: 64 characters + """ return self.__ship_to_email @ship_to_email.setter def ship_to_email(self, value): self.__ship_to_email = value - - - @property - def notes(self): - return self.__notes - - @notes.setter - def notes(self, value): - self.__notes = value - - - @property def shipping_fee_id(self): + """ + The ID of the shipping fee used for identifying the shipping option. More information: Maximum length: 64 characters + """ return self.__shipping_fee_id @shipping_fee_id.setter def shipping_fee_id(self, value): self.__shipping_fee_id = value - @property def shipping_fee(self): + """Gets the shipping_fee of this Shipping. + + """ return self.__shipping_fee @shipping_fee.setter def shipping_fee(self, value): self.__shipping_fee = value - @property def shipping_description(self): + """ + Extended information about logistics-related services, including shipping time, logistics companies, etc. More information: Maximum length: 64 characters + """ return self.__shipping_description @shipping_description.setter def shipping_description(self, value): self.__shipping_description = value - - @property def delivery_estimate(self): + """Gets the delivery_estimate of this Shipping. + + """ return self.__delivery_estimate @delivery_estimate.setter @@ -117,34 +113,53 @@ def delivery_estimate(self, value): self.__delivery_estimate = value + def to_ams_dict(self): params = dict() - if hasattr(self, "shipping_name") and self.shipping_name: + if hasattr(self, "shipping_name") and self.shipping_name is not None: params['shippingName'] = self.shipping_name - - if hasattr(self, "shipping_address") and self.shipping_address: + if hasattr(self, "shipping_address") and self.shipping_address is not None: params['shippingAddress'] = self.shipping_address - - if hasattr(self, "shipping_carrier") and self.shipping_carrier: + if hasattr(self, "shipping_carrier") and self.shipping_carrier is not None: params['shippingCarrier'] = self.shipping_carrier - - if hasattr(self, "shipping_phone_no") and self.shipping_phone_no: + if hasattr(self, "shipping_phone_no") and self.shipping_phone_no is not None: params['shippingPhoneNo'] = self.shipping_phone_no - - if hasattr(self, "shipping_number") and self.shipping_number: - params['shippingNumber'] = self.shipping_number - if hasattr(self, "ship_to_email") and self.ship_to_email: + if hasattr(self, "ship_to_email") and self.ship_to_email is not None: params['shipToEmail'] = self.ship_to_email - if hasattr(self, "notes") and self.notes: - params['notes'] = self.notes - if hasattr(self, "shipping_fee_id") and self.shipping_fee_id: + if hasattr(self, "shipping_fee_id") and self.shipping_fee_id is not None: params['shippingFeeId'] = self.shipping_fee_id - if hasattr(self, "shipping_fee") and self.shipping_fee: + if hasattr(self, "shipping_fee") and self.shipping_fee is not None: params['shippingFee'] = self.shipping_fee - if hasattr(self, "shipping_description") and self.shipping_description: + if hasattr(self, "shipping_description") and self.shipping_description is not None: params['shippingDescription'] = self.shipping_description - if hasattr(self, "delivery_estimate") and self.delivery_estimate: + if hasattr(self, "delivery_estimate") and self.delivery_estimate is not None: params['deliveryEstimate'] = self.delivery_estimate - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'shippingName' in response_body: + self.__shipping_name = UserName() + self.__shipping_name.parse_rsp_body(response_body['shippingName']) + if 'shippingAddress' in response_body: + self.__shipping_address = Address() + self.__shipping_address.parse_rsp_body(response_body['shippingAddress']) + if 'shippingCarrier' in response_body: + self.__shipping_carrier = response_body['shippingCarrier'] + if 'shippingPhoneNo' in response_body: + self.__shipping_phone_no = response_body['shippingPhoneNo'] + if 'shipToEmail' in response_body: + self.__ship_to_email = response_body['shipToEmail'] + if 'shippingFeeId' in response_body: + self.__shipping_fee_id = response_body['shippingFeeId'] + if 'shippingFee' in response_body: + self.__shipping_fee = Amount() + self.__shipping_fee.parse_rsp_body(response_body['shippingFee']) + if 'shippingDescription' in response_body: + self.__shipping_description = response_body['shippingDescription'] + if 'deliveryEstimate' in response_body: + self.__delivery_estimate = DeliveryEstimate() + self.__delivery_estimate.parse_rsp_body(response_body['deliveryEstimate']) diff --git a/com/alipay/ams/api/model/stock_info.py b/com/alipay/ams/api/model/stock_info.py index 9bbe4da..518b6e1 100644 --- a/com/alipay/ams/api/model/stock_info.py +++ b/com/alipay/ams/api/model/stock_info.py @@ -1,26 +1,52 @@ +import json + + + class StockInfo: def __init__(self): - self.__listed_region = None - self.__ticker_symbol = None + + self.__listed_region = None # type: str + self.__ticker_symbol = None # type: str + - def get_listed_region(self): + @property + def listed_region(self): + """ + The region or country where the company is listed. More information: Maximum length: 2 characters + """ return self.__listed_region - def set_listed_region(self, listed_region): - self.__listed_region = listed_region - - def get_ticker_symbol(self): + @listed_region.setter + def listed_region(self, value): + self.__listed_region = value + @property + def ticker_symbol(self): + """ + The ticker symbol of the stock. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is US. More information: Maximum length: 32 characters + """ return self.__ticker_symbol - def set_ticker_symbol(self, ticker_symbol): - self.__ticker_symbol = ticker_symbol + @ticker_symbol.setter + def ticker_symbol(self, value): + self.__ticker_symbol = value + + def to_ams_dict(self): params = dict() - if hasattr(self, 'listed_region') and self.listed_region: + if hasattr(self, "listed_region") and self.listed_region is not None: params['listedRegion'] = self.listed_region - if hasattr(self, 'ticker_symbol') and self.ticker_symbol: + if hasattr(self, "ticker_symbol") and self.ticker_symbol is not None: params['tickerSymbol'] = self.ticker_symbol - return params \ No newline at end of file + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'listedRegion' in response_body: + self.__listed_region = response_body['listedRegion'] + if 'tickerSymbol' in response_body: + self.__ticker_symbol = response_body['tickerSymbol'] diff --git a/com/alipay/ams/api/model/store.py b/com/alipay/ams/api/model/store.py index 23e3121..7a3b54d 100644 --- a/com/alipay/ams/api/model/store.py +++ b/com/alipay/ams/api/model/store.py @@ -1,107 +1,144 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json from com.alipay.ams.api.model.address import Address -class Store(object): + + +class Store: def __init__(self): - self.__reference_store_id = None - self.__store_name = None - self.__store_mcc = None - self.__store_display_name = None - self.__store_terminal_id = None - self.__store_operator_id = None + + self.__reference_store_id = None # type: str + self.__store_name = None # type: str + self.__store_mcc = None # type: str + self.__store_display_name = None # type: str + self.__store_terminal_id = None # type: str + self.__store_operator_id = None # type: str self.__store_address = None # type: Address - self.__store_phone_no = None + self.__store_phone_no = None # type: str + @property def reference_store_id(self): + """Gets the reference_store_id of this Store. + + """ return self.__reference_store_id @reference_store_id.setter def reference_store_id(self, value): self.__reference_store_id = value - @property def store_name(self): + """Gets the store_name of this Store. + + """ return self.__store_name @store_name.setter def store_name(self, value): self.__store_name = value - @property def store_mcc(self): + """Gets the store_mcc of this Store. + + """ return self.__store_mcc @store_mcc.setter def store_mcc(self, value): self.__store_mcc = value - @property def store_display_name(self): + """Gets the store_display_name of this Store. + + """ return self.__store_display_name @store_display_name.setter def store_display_name(self, value): self.__store_display_name = value - @property def store_terminal_id(self): + """Gets the store_terminal_id of this Store. + + """ return self.__store_terminal_id @store_terminal_id.setter def store_terminal_id(self, value): self.__store_terminal_id = value - @property def store_operator_id(self): + """Gets the store_operator_id of this Store. + + """ return self.__store_operator_id @store_operator_id.setter def store_operator_id(self, value): self.__store_operator_id = value - @property def store_address(self): + """Gets the store_address of this Store. + + """ return self.__store_address @store_address.setter def store_address(self, value): self.__store_address = value - @property def store_phone_no(self): + """Gets the store_phone_no of this Store. + + """ return self.__store_phone_no @store_phone_no.setter def store_phone_no(self, value): self.__store_phone_no = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "reference_store_id") and self.reference_store_id: + if hasattr(self, "reference_store_id") and self.reference_store_id is not None: params['referenceStoreId'] = self.reference_store_id - - if hasattr(self, "store_name") and self.store_name: + if hasattr(self, "store_name") and self.store_name is not None: params['storeName'] = self.store_name - - if hasattr(self, "store_mcc") and self.store_mcc: + if hasattr(self, "store_mcc") and self.store_mcc is not None: params['storeMCC'] = self.store_mcc - - if hasattr(self, "store_display_name") and self.store_display_name: + if hasattr(self, "store_display_name") and self.store_display_name is not None: params['storeDisplayName'] = self.store_display_name - - if hasattr(self, "store_terminal_id") and self.store_terminal_id: + if hasattr(self, "store_terminal_id") and self.store_terminal_id is not None: params['storeTerminalId'] = self.store_terminal_id - - if hasattr(self, "store_operator_id") and self.store_operator_id: + if hasattr(self, "store_operator_id") and self.store_operator_id is not None: params['storeOperatorId'] = self.store_operator_id - - if hasattr(self, "store_address") and self.store_address: + if hasattr(self, "store_address") and self.store_address is not None: params['storeAddress'] = self.store_address - - if hasattr(self, "store_phone_no") and self.store_phone_no: + if hasattr(self, "store_phone_no") and self.store_phone_no is not None: params['storePhoneNo'] = self.store_phone_no - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'referenceStoreId' in response_body: + self.__reference_store_id = response_body['referenceStoreId'] + if 'storeName' in response_body: + self.__store_name = response_body['storeName'] + if 'storeMCC' in response_body: + self.__store_mcc = response_body['storeMCC'] + if 'storeDisplayName' in response_body: + self.__store_display_name = response_body['storeDisplayName'] + if 'storeTerminalId' in response_body: + self.__store_terminal_id = response_body['storeTerminalId'] + if 'storeOperatorId' in response_body: + self.__store_operator_id = response_body['storeOperatorId'] + if 'storeAddress' in response_body: + self.__store_address = Address() + self.__store_address.parse_rsp_body(response_body['storeAddress']) + if 'storePhoneNo' in response_body: + self.__store_phone_no = response_body['storePhoneNo'] diff --git a/com/alipay/ams/api/model/support_bank.py b/com/alipay/ams/api/model/support_bank.py index aeb01fa..e8ffa50 100644 --- a/com/alipay/ams/api/model/support_bank.py +++ b/com/alipay/ams/api/model/support_bank.py @@ -1,49 +1,69 @@ -class SupportBank(object): +import json +from com.alipay.ams.api.model.logo import Logo + + + + +class SupportBank: def __init__(self): - self.__bank_identifier_code = None - self.__bank_short_name = None - self.__bank_logo = None + + self.__bank_identifier_code = None # type: str + self.__bank_short_name = None # type: str + self.__bank_logo = None # type: Logo + @property def bank_identifier_code(self): + """ + The unique code of the bank. See the Bank list to check the valid values. + """ return self.__bank_identifier_code @bank_identifier_code.setter def bank_identifier_code(self, value): self.__bank_identifier_code = value - @property def bank_short_name(self): + """ + The short name of the bank. The unique code of the bank. See the Bank list to check the valid values. + """ return self.__bank_short_name @bank_short_name.setter def bank_short_name(self, value): self.__bank_short_name = value - @property def bank_logo(self): + """Gets the bank_logo of this SupportBank. + + """ return self.__bank_logo @bank_logo.setter def bank_logo(self, value): self.__bank_logo = value + + + def to_ams_dict(self): params = dict() - if self.__bank_identifier_code is not None: - params['bankIdentifierCode'] = self.__bank_identifier_code - if self.__bank_short_name is not None: - params['bankShortName'] = self.__bank_short_name - if self.__bank_logo is not None: - params['bankLogo'] = self.__bank_logo + if hasattr(self, "bank_identifier_code") and self.bank_identifier_code is not None: + params['bankIdentifierCode'] = self.bank_identifier_code + if hasattr(self, "bank_short_name") and self.bank_short_name is not None: + params['bankShortName'] = self.bank_short_name + if hasattr(self, "bank_logo") and self.bank_logo is not None: + params['bankLogo'] = self.bank_logo return params - def parse_rsp_body(self, support_bank_body): - if support_bank_body is None: - return - if 'bankIdentifierCode' in support_bank_body: - self.bank_identifier_code = support_bank_body['bankIdentifierCode'] - if 'bankShortName' in support_bank_body: - self.bank_short_name = support_bank_body['bankShortName'] - if 'bankLogo' in support_bank_body: - self.bank_logo = support_bank_body['bankLogo'] + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'bankIdentifierCode' in response_body: + self.__bank_identifier_code = response_body['bankIdentifierCode'] + if 'bankShortName' in response_body: + self.__bank_short_name = response_body['bankShortName'] + if 'bankLogo' in response_body: + self.__bank_logo = Logo() + self.__bank_logo.parse_rsp_body(response_body['bankLogo']) diff --git a/com/alipay/ams/api/model/support_card_brand.py b/com/alipay/ams/api/model/support_card_brand.py index 373b471..64dd953 100644 --- a/com/alipay/ams/api/model/support_card_brand.py +++ b/com/alipay/ams/api/model/support_card_brand.py @@ -1,39 +1,54 @@ -from com.alipay.ams.api.model.card_brand_type import CardBrandType +import json from com.alipay.ams.api.model.logo import Logo -class SupportCardBrand(object): + + +class SupportCardBrand: def __init__(self): - self.__card_brand = None # type: CardBrandType + + self.__card_brand = None # type: str self.__logo = None # type: Logo + @property def card_brand(self): + """ + The name of the card brand. Valid values are: VISA: indicates Visa. MASTERCARD: indicates Mastercard. AMEX: indicates American Express (Amex). HIPERCARD: indicates Hipercard. ELO: indicates Elo. + """ return self.__card_brand @card_brand.setter def card_brand(self, value): self.__card_brand = value - @property def logo(self): + """Gets the logo of this SupportCardBrand. + + """ return self.__logo @logo.setter def logo(self, value): self.__logo = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "card_brand") and self.card_brand: - params['cardBrandType'] = self.card_brand.value - if hasattr(self, "logo") and self.logo: - params['logo'] = self.logo.to_ams_dict() + if hasattr(self, "card_brand") and self.card_brand is not None: + params['cardBrand'] = self.card_brand + if hasattr(self, "logo") and self.logo is not None: + params['logo'] = self.logo return params - def parse_rsp_body(self, support_card_brand_body): - if support_card_brand_body.get('cardBrandType'): - self.card_brand = CardBrandType(support_card_brand_body.get('cardBrandType')) - if support_card_brand_body.get('logo'): - self.logo = Logo() - self.logo.to_ams_dict() + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'cardBrand' in response_body: + self.__card_brand = response_body['cardBrand'] + if 'logo' in response_body: + self.__logo = Logo() + self.__logo.parse_rsp_body(response_body['logo']) diff --git a/com/alipay/ams/api/model/terminal_type.py b/com/alipay/ams/api/model/terminal_type.py index 23ba04b..2935115 100644 --- a/com/alipay/ams/api/model/terminal_type.py +++ b/com/alipay/ams/api/model/terminal_type.py @@ -1,13 +1,27 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class TerminalType(Enum): + """TerminalType枚举类""" + WEB = "WEB" WAP = "WAP" APP = "APP" + MINI_APP = "MINI_APP" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if TerminalType.WEB.value == value: + return TerminalType.WEB + if TerminalType.WAP.value == value: + return TerminalType.WAP + if TerminalType.APP.value == value: + return TerminalType.APP + if TerminalType.MINI_APP.value == value: + return TerminalType.MINI_APP + return None diff --git a/com/alipay/ams/api/model/three_ds_result.py b/com/alipay/ams/api/model/three_ds_result.py index e02941e..32f1f3b 100644 --- a/com/alipay/ams/api/model/three_ds_result.py +++ b/com/alipay/ams/api/model/three_ds_result.py @@ -1,78 +1,97 @@ import json -class ThreeDSResult(object): + + +class ThreeDSResult: def __init__(self): - self.__three_ds_version = None - self.__eci = None - self.__cavv = None - self.__ds_transaction_id = None - self.__xid = None + + self.__three_ds_version = None # type: str + self.__eci = None # type: str + self.__cavv = None # type: str + self.__ds_transaction_id = None # type: str + self.__xid = None # type: str + @property def three_ds_version(self): + """ + The version of 3D Secure protocol + """ return self.__three_ds_version @three_ds_version.setter def three_ds_version(self, value): self.__three_ds_version = value - @property def eci(self): + """ + Electronic Commerce Indicator (ECI) that is returned by the card scheme + """ return self.__eci @eci.setter def eci(self, value): self.__eci = value - @property def cavv(self): + """ + The cardholder authentication value + """ return self.__cavv @cavv.setter def cavv(self, value): self.__cavv = value - @property def ds_transaction_id(self): + """ + dsTransactionId + """ return self.__ds_transaction_id @ds_transaction_id.setter def ds_transaction_id(self, value): self.__ds_transaction_id = value - @property def xid(self): + """ + The unique transaction identifier assigned by the Directory Server (DS) for 3D Secure authentication + """ return self.__xid @xid.setter def xid(self, value): self.__xid = value + + + def to_ams_dict(self): - param = dict() - if hasattr(self, 'three_ds_version') and self.three_ds_version: - param['threeDSVersion'] = self.three_ds_version - if hasattr(self, 'eci') and self.eci: - param['eci'] = self.eci - if hasattr(self, 'cavv') and self.cavv: - param['cavv'] = self.cavv - if hasattr(self, 'ds_transaction_id') and self.ds_transaction_id: - param['dsTransactionId'] = self.ds_transaction_id - if hasattr(self, 'xid') and self.xid: - param['xid'] = self.xid - return param + params = dict() + if hasattr(self, "three_ds_version") and self.three_ds_version is not None: + params['threeDSVersion'] = self.three_ds_version + if hasattr(self, "eci") and self.eci is not None: + params['eci'] = self.eci + if hasattr(self, "cavv") and self.cavv is not None: + params['cavv'] = self.cavv + if hasattr(self, "ds_transaction_id") and self.ds_transaction_id is not None: + params['dsTransactionId'] = self.ds_transaction_id + if hasattr(self, "xid") and self.xid is not None: + params['xid'] = self.xid + return params + - def parse_rsp_body(self, three_dS_result_body): - if type(three_dS_result_body) == str: - three_dS_result_body = json.loads(three_dS_result_body) - if 'threeDSVersion' in three_dS_result_body: - self.three_ds_version = three_dS_result_body['threeDSVersion'] - if 'eci' in three_dS_result_body: - self.eci = three_dS_result_body['eci'] - if 'cavv' in three_dS_result_body: - self.cavv = three_dS_result_body['cavv'] - if 'dsTransactionId' in three_dS_result_body: - self.ds_transaction_id = three_dS_result_body['dsTransactionId'] - if 'xid' in three_dS_result_body: - self.xid = three_dS_result_body['xid'] + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'threeDSVersion' in response_body: + self.__three_ds_version = response_body['threeDSVersion'] + if 'eci' in response_body: + self.__eci = response_body['eci'] + if 'cavv' in response_body: + self.__cavv = response_body['cavv'] + if 'dsTransactionId' in response_body: + self.__ds_transaction_id = response_body['dsTransactionId'] + if 'xid' in response_body: + self.__xid = response_body['xid'] diff --git a/com/alipay/ams/api/model/transaction.py b/com/alipay/ams/api/model/transaction.py index 922b0d9..db00473 100644 --- a/com/alipay/ams/api/model/transaction.py +++ b/com/alipay/ams/api/model/transaction.py @@ -1,80 +1,152 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - -from com.alipay.ams.api.model.amount import Amount from com.alipay.ams.api.model.result import Result -from com.alipay.ams.api.model.transaction_status_type import TransactionStatusType from com.alipay.ams.api.model.transaction_type import TransactionType +from com.alipay.ams.api.model.transaction_status_type import TransactionStatusType +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.acquirer_info import AcquirerInfo -class Transaction(object): + +class Transaction: def __init__(self): - self.__transaction_result = None - self.__transaction_id = None - self.__transaction_type = None # type:TransactionType - self.__transaction_status = None # type:TransactionStatusType - self.__transaction_amount = None # type:Amount - self.__transaction_request_id = None - self.__transaction_time = None + + self.__transaction_result = None # type: Result + self.__transaction_id = None # type: str + self.__transaction_type = None # type: TransactionType + self.__transaction_status = None # type: TransactionStatusType + self.__transaction_amount = None # type: Amount + self.__transaction_request_id = None # type: str + self.__transaction_time = None # type: str + self.__acquirer_info = None # type: AcquirerInfo + @property def transaction_result(self): + """Gets the transaction_result of this Transaction. + + """ return self.__transaction_result + @transaction_result.setter + def transaction_result(self, value): + self.__transaction_result = value @property def transaction_id(self): + """ + The unique ID that is assigned by Antom to identify a transaction. When the transaction type is REFUND, the value of this parameter is identical to refundId. When the transaction type is CAPTURE, the value of this parameter is identical to captureId. More information: Maximum length: 64 characters + """ return self.__transaction_id + @transaction_id.setter + def transaction_id(self, value): + self.__transaction_id = value @property def transaction_type(self): + """Gets the transaction_type of this Transaction. + + """ return self.__transaction_type + @transaction_type.setter + def transaction_type(self, value): + self.__transaction_type = value @property def transaction_status(self): + """Gets the transaction_status of this Transaction. + + """ return self.__transaction_status + @transaction_status.setter + def transaction_status(self, value): + self.__transaction_status = value @property def transaction_amount(self): + """Gets the transaction_amount of this Transaction. + + """ return self.__transaction_amount + @transaction_amount.setter + def transaction_amount(self, value): + self.__transaction_amount = value @property def transaction_request_id(self): + """ + The unique ID that is assigned by the merchant to identify the transaction request. When the transaction type is REFUND, the value of this parameter is identical to refundRequestId. When the transaction type is CAPTURE, the value of this parameter is identical to captureRequestId. More information: Maximum length: 64 characters + """ return self.__transaction_request_id + @transaction_request_id.setter + def transaction_request_id(self, value): + self.__transaction_request_id = value @property def transaction_time(self): + """Gets the transaction_time of this Transaction. + + """ return self.__transaction_time - def parse_rsp_body(self, transaction_body): - if type(transaction_body) == str: - transaction_body = json.loads(transaction_body) - - if 'transactionResult' in transaction_body: - transaction_result = Result() - transaction_result.parse_rsp_body(transaction_body['transactionResult']) - self.__transaction_result = transaction_result - - if 'transactionId' in transaction_body: - self.__transaction_id = transaction_body['transactionId'] - - if 'transactionType' in transaction_body: - transaction_type = TransactionType.value_of(transaction_body['transactionType']) - self.__transaction_type = transaction_type - - if 'transactionStatus' in transaction_body: - transaction_status = TransactionStatusType.value_of(transaction_body['transactionStatus']) - self.__transaction_status = transaction_status - - if 'transactionAmount' in transaction_body: - transaction_amount = Amount() - transaction_amount.parse_rsp_body(transaction_body['transactionAmount']) - self.__transaction_amount = transaction_amount - - if 'transactionRequestId' in transaction_body: - self.__transaction_request_id = transaction_body['transactionRequestId'] - - if 'transactionTime' in transaction_body: - self.__transaction_time = transaction_body['transactionTime'] + @transaction_time.setter + def transaction_time(self, value): + self.__transaction_time = value + @property + def acquirer_info(self): + """Gets the acquirer_info of this Transaction. + + """ + return self.__acquirer_info + + @acquirer_info.setter + def acquirer_info(self, value): + self.__acquirer_info = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "transaction_result") and self.transaction_result is not None: + params['transactionResult'] = self.transaction_result + if hasattr(self, "transaction_id") and self.transaction_id is not None: + params['transactionId'] = self.transaction_id + if hasattr(self, "transaction_type") and self.transaction_type is not None: + params['transactionType'] = self.transaction_type + if hasattr(self, "transaction_status") and self.transaction_status is not None: + params['transactionStatus'] = self.transaction_status + if hasattr(self, "transaction_amount") and self.transaction_amount is not None: + params['transactionAmount'] = self.transaction_amount + if hasattr(self, "transaction_request_id") and self.transaction_request_id is not None: + params['transactionRequestId'] = self.transaction_request_id + if hasattr(self, "transaction_time") and self.transaction_time is not None: + params['transactionTime'] = self.transaction_time + if hasattr(self, "acquirer_info") and self.acquirer_info is not None: + params['acquirerInfo'] = self.acquirer_info + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'transactionResult' in response_body: + self.__transaction_result = Result() + self.__transaction_result.parse_rsp_body(response_body['transactionResult']) + if 'transactionId' in response_body: + self.__transaction_id = response_body['transactionId'] + if 'transactionType' in response_body: + transaction_type_temp = TransactionType.value_of(response_body['transactionType']) + self.__transaction_type = transaction_type_temp + if 'transactionStatus' in response_body: + transaction_status_temp = TransactionStatusType.value_of(response_body['transactionStatus']) + self.__transaction_status = transaction_status_temp + if 'transactionAmount' in response_body: + self.__transaction_amount = Amount() + self.__transaction_amount.parse_rsp_body(response_body['transactionAmount']) + if 'transactionRequestId' in response_body: + self.__transaction_request_id = response_body['transactionRequestId'] + if 'transactionTime' in response_body: + self.__transaction_time = response_body['transactionTime'] + if 'acquirerInfo' in response_body: + self.__acquirer_info = AcquirerInfo() + self.__acquirer_info.parse_rsp_body(response_body['acquirerInfo']) diff --git a/com/alipay/ams/api/model/transaction_status_type.py b/com/alipay/ams/api/model/transaction_status_type.py index fc2e7bb..b4f7d70 100644 --- a/com/alipay/ams/api/model/transaction_status_type.py +++ b/com/alipay/ams/api/model/transaction_status_type.py @@ -1,17 +1,15 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class TransactionStatusType(Enum): + """TransactionStatusType枚举类""" + SUCCESS = "SUCCESS" FAIL = "FAIL" PROCESSING = "PROCESSING" CANCELLED = "CANCELLED" PENDING = "PENDING" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name @staticmethod @@ -21,13 +19,12 @@ def value_of(value): if TransactionStatusType.SUCCESS.value == value: return TransactionStatusType.SUCCESS - elif TransactionStatusType.FAIL.value == value: + if TransactionStatusType.FAIL.value == value: return TransactionStatusType.FAIL - elif TransactionStatusType.PROCESSING.value == value: + if TransactionStatusType.PROCESSING.value == value: return TransactionStatusType.PROCESSING - elif TransactionStatusType.CANCELLED.value == value: + if TransactionStatusType.CANCELLED.value == value: return TransactionStatusType.CANCELLED - elif TransactionStatusType.PENDING.value == value: + if TransactionStatusType.PENDING.value == value: return TransactionStatusType.PENDING - else: - return None + return None diff --git a/com/alipay/ams/api/model/transaction_type.py b/com/alipay/ams/api/model/transaction_type.py index 5581d79..f8d1dd1 100644 --- a/com/alipay/ams/api/model/transaction_type.py +++ b/com/alipay/ams/api/model/transaction_type.py @@ -1,10 +1,8 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- from enum import Enum, unique - - @unique class TransactionType(Enum): + """TransactionType枚举类""" + PAYMENT = "PAYMENT" REFUND = "REFUND" CAPTURE = "CAPTURE" @@ -12,7 +10,7 @@ class TransactionType(Enum): AUTHORIZATION = "AUTHORIZATION" VOID = "VOID" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name @staticmethod @@ -22,15 +20,14 @@ def value_of(value): if TransactionType.PAYMENT.value == value: return TransactionType.PAYMENT - elif TransactionType.REFUND.value == value: + if TransactionType.REFUND.value == value: return TransactionType.REFUND - elif TransactionType.CAPTURE.value == value: + if TransactionType.CAPTURE.value == value: return TransactionType.CAPTURE - elif TransactionType.CANCEL.value == value: + if TransactionType.CANCEL.value == value: return TransactionType.CANCEL - elif TransactionType.AUTHORIZATION.value == value: + if TransactionType.AUTHORIZATION.value == value: return TransactionType.AUTHORIZATION - elif TransactionType.VOID.value == value: + if TransactionType.VOID.value == value: return TransactionType.VOID - else: - return None + return None diff --git a/com/alipay/ams/api/model/transfer_from_detail.py b/com/alipay/ams/api/model/transfer_from_detail.py index b666ec2..0af752d 100644 --- a/com/alipay/ams/api/model/transfer_from_detail.py +++ b/com/alipay/ams/api/model/transfer_from_detail.py @@ -1,44 +1,56 @@ import json - -from com.alipay.ams.api.model.amount import Amount from com.alipay.ams.api.model.payment_method import PaymentMethod +from com.alipay.ams.api.model.amount import Amount + + class TransferFromDetail: def __init__(self): - self.__transfer_from_method = None #type: PaymentMethod - self.__transfer_from_amount = None #type: Amount - + + self.__transfer_from_method = None # type: PaymentMethod + self.__transfer_from_amount = None # type: Amount + @property def transfer_from_method(self): + """Gets the transfer_from_method of this TransferFromDetail. + + """ return self.__transfer_from_method - @property - def transfer_from_amount(self): - return self.__transfer_from_amount - @transfer_from_method.setter def transfer_from_method(self, value): self.__transfer_from_method = value + @property + def transfer_from_amount(self): + """Gets the transfer_from_amount of this TransferFromDetail. + + """ + return self.__transfer_from_amount @transfer_from_amount.setter def transfer_from_amount(self, value): self.__transfer_from_amount = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "transfer_from_method") and self.transfer_from_method: - params['transferFromMethod'] = self.transfer_from_method.to_ams_dict() - if hasattr(self, "transfer_from_amount") and self.transfer_from_amount: - params['transferFromAmount'] = self.transfer_from_amount.to_ams_dict() + if hasattr(self, "transfer_from_method") and self.transfer_from_method is not None: + params['transferFromMethod'] = self.transfer_from_method + if hasattr(self, "transfer_from_amount") and self.transfer_from_amount is not None: + params['transferFromAmount'] = self.transfer_from_amount return params + def parse_rsp_body(self, response_body): - if type(response_body) == str: + if isinstance(response_body, str): response_body = json.loads(response_body) - if 'transferFromMethod' in response_body: - self.transfer_from_method.parse_rsp_body(response_body['transferFromMethod']) + self.__transfer_from_method = PaymentMethod() + self.__transfer_from_method.parse_rsp_body(response_body['transferFromMethod']) if 'transferFromAmount' in response_body: - self.transfer_from_amount.parse_rsp_body(response_body['transferFromAmount']) + self.__transfer_from_amount = Amount() + self.__transfer_from_amount.parse_rsp_body(response_body['transferFromAmount']) diff --git a/com/alipay/ams/api/model/transfer_to_detail.py b/com/alipay/ams/api/model/transfer_to_detail.py index 2a9fb22..4391514 100644 --- a/com/alipay/ams/api/model/transfer_to_detail.py +++ b/com/alipay/ams/api/model/transfer_to_detail.py @@ -1,108 +1,133 @@ import json - -from com.alipay.ams.api.model.amount import Amount from com.alipay.ams.api.model.payment_method import PaymentMethod +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.amount import Amount + + class TransferToDetail: def __init__(self): + self.__transfer_to_method = None # type: PaymentMethod - self.__transfer_to_currency = None - self.__fee_Amount = None # type: Amount + self.__transfer_to_currency = None # type: str + self.__fee_amount = None # type: Amount self.__actual_transfer_to_amount = None # type: Amount - self.__purpose_code = None - self.__transfer_notify_url = None - self.__transfer_remark = None + self.__purpose_code = None # type: str + self.__transfer_notify_url = None # type: str + self.__transfer_remark = None # type: str + @property def transfer_to_method(self): + """Gets the transfer_to_method of this TransferToDetail. + + """ return self.__transfer_to_method @transfer_to_method.setter def transfer_to_method(self, value): self.__transfer_to_method = value - @property def transfer_to_currency(self): + """ + A 3-character ISO-4217 currency code representing the currency that the beneficiary collects. More information: Maximum length: 3 characters + """ return self.__transfer_to_currency @transfer_to_currency.setter def transfer_to_currency(self, value): self.__transfer_to_currency = value - @property - def fee_Amount(self): - return self.__fee_Amount - - @fee_Amount.setter - def fee_Amount(self, value): - self.__fee_Amount = value - + def fee_amount(self): + """Gets the fee_amount of this TransferToDetail. + + """ + return self.__fee_amount + + @fee_amount.setter + def fee_amount(self, value): + self.__fee_amount = value @property def actual_transfer_to_amount(self): + """Gets the actual_transfer_to_amount of this TransferToDetail. + + """ return self.__actual_transfer_to_amount @actual_transfer_to_amount.setter def actual_transfer_to_amount(self, value): self.__actual_transfer_to_amount = value - @property def purpose_code(self): + """ + Defines the purpose of the transfer. The value of this parameter is fixed to GSD, which means goods bought or sold. More information: Maximum length: 3 characters + """ return self.__purpose_code @purpose_code.setter def purpose_code(self, value): self.__purpose_code = value - @property def transfer_notify_url(self): + """ + If you specify this parameter, Antom will send the transfer result notification to this URL. The URL must be either specified in the request or set in Antom Dashboard. Specify this parameter if you want to receive an asynchronous notification of the transfer result. If this URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence. More information: Maximum length: 2048 characters + """ return self.__transfer_notify_url @transfer_notify_url.setter def transfer_notify_url(self, value): self.__transfer_notify_url = value - @property def transfer_remark(self): + """ + Remark information for the transfer. Specify this parameter if you want to provide additional remarks or relevant information regarding the payout. More information: Maximum length: 1024 characters + """ return self.__transfer_remark @transfer_remark.setter def transfer_remark(self, value): self.__transfer_remark = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "transfer_to_method") and self.transfer_to_method: - params['transferToMethod'] = self.transfer_to_method.to_ams_dict() - if hasattr(self, "transfer_to_currency") and self.transfer_to_currency: + if hasattr(self, "transfer_to_method") and self.transfer_to_method is not None: + params['transferToMethod'] = self.transfer_to_method + if hasattr(self, "transfer_to_currency") and self.transfer_to_currency is not None: params['transferToCurrency'] = self.transfer_to_currency - if hasattr(self, "fee_Amount") and self.fee_Amount: - params['feeAmount'] = self.fee_Amount.to_ams_dict() - if hasattr(self, "actual_transfer_to_amount") and self.actual_transfer_to_amount: - params['actualTransferToAmount'] = self.actual_transfer_to_amount.to_ams_dict() - if hasattr(self, "purpose_code") and self.purpose_code: + if hasattr(self, "fee_amount") and self.fee_amount is not None: + params['feeAmount'] = self.fee_amount + if hasattr(self, "actual_transfer_to_amount") and self.actual_transfer_to_amount is not None: + params['actualTransferToAmount'] = self.actual_transfer_to_amount + if hasattr(self, "purpose_code") and self.purpose_code is not None: params['purposeCode'] = self.purpose_code - if hasattr(self, "transfer_notify_url") and self.transfer_notify_url: + if hasattr(self, "transfer_notify_url") and self.transfer_notify_url is not None: params['transferNotifyUrl'] = self.transfer_notify_url - if hasattr(self, "transfer_remark") and self.transfer_remark: + if hasattr(self, "transfer_remark") and self.transfer_remark is not None: params['transferRemark'] = self.transfer_remark return params + def parse_rsp_body(self, response_body): - if type(response_body) == str: + if isinstance(response_body, str): response_body = json.loads(response_body) - if 'transferToMethod' in response_body: - self.transfer_to_method.parse_rsp_body(response_body['transferToMethod']) + self.__transfer_to_method = PaymentMethod() + self.__transfer_to_method.parse_rsp_body(response_body['transferToMethod']) if 'transferToCurrency' in response_body: - self.transfer_to_currency = response_body['transferToCurrency'] + self.__transfer_to_currency = response_body['transferToCurrency'] if 'feeAmount' in response_body: - self.fee_Amount.parse_rsp_body(response_body['feeAmount']) + self.__fee_amount = Amount() + self.__fee_amount.parse_rsp_body(response_body['feeAmount']) if 'actualTransferToAmount' in response_body: - self.actual_transfer_to_amount.parse_rsp_body(response_body['actualTransferToAmount']) + self.__actual_transfer_to_amount = Amount() + self.__actual_transfer_to_amount.parse_rsp_body(response_body['actualTransferToAmount']) if 'purposeCode' in response_body: - self.purpose_code = response_body['purposeCode'] + self.__purpose_code = response_body['purposeCode'] if 'transferNotifyUrl' in response_body: - self.transfer_notify_url = response_body['transferNotifyUrl'] + self.__transfer_notify_url = response_body['transferNotifyUrl'] if 'transferRemark' in response_body: - self.transfer_remark = response_body['transferRemark'] \ No newline at end of file + self.__transfer_remark = response_body['transferRemark'] diff --git a/com/alipay/ams/api/model/transit.py b/com/alipay/ams/api/model/transit.py index 7dc1acf..07192d3 100644 --- a/com/alipay/ams/api/model/transit.py +++ b/com/alipay/ams/api/model/transit.py @@ -1,46 +1,79 @@ +import json from com.alipay.ams.api.model.transit_type import TransitType +from com.alipay.ams.api.model.leg import Leg +from com.alipay.ams.api.model.passenger import Passenger + -class Transit: +class Transit: def __init__(self): + self.__transit_type = None # type: TransitType - self.__legs = None - self.__passengers = None + self.__legs = None # type: [Leg] + self.__passengers = None # type: [Passenger] + @property def transit_type(self): + """Gets the transit_type of this Transit. + + """ return self.__transit_type @transit_type.setter def transit_type(self, value): self.__transit_type = value - @property def legs(self): + """ + Information about sections of the trip, including departure time, arrival time, departure address, arrival address, transportation company name, carrier code and service type. More information: Maximum size: 10 elements + """ return self.__legs @legs.setter def legs(self, value): self.__legs = value - @property def passengers(self): + """ + Information about the passenger of the trip, including the passenger names, passenger email and phone number. More information: Maximum size: 100 elements + """ return self.__passengers @passengers.setter def passengers(self, value): self.__passengers = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "transit_type") and self.transit_type: + if hasattr(self, "transit_type") and self.transit_type is not None: params['transitType'] = self.transit_type - - if hasattr(self, "legs") and self.legs: + if hasattr(self, "legs") and self.legs is not None: params['legs'] = self.legs - - if hasattr(self, "passengers") and self.passengers: + if hasattr(self, "passengers") and self.passengers is not None: params['passengers'] = self.passengers - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'transitType' in response_body: + transit_type_temp = TransitType.value_of(response_body['transitType']) + self.__transit_type = transit_type_temp + if 'legs' in response_body: + self.__legs = [] + for item in response_body['legs']: + obj = Leg() + obj.parse_rsp_body(item) + self.__legs.append(obj) + if 'passengers' in response_body: + self.__passengers = [] + for item in response_body['passengers']: + obj = Passenger() + obj.parse_rsp_body(item) + self.__passengers.append(obj) diff --git a/com/alipay/ams/api/model/transit_type.py b/com/alipay/ams/api/model/transit_type.py index e110bb7..107a701 100644 --- a/com/alipay/ams/api/model/transit_type.py +++ b/com/alipay/ams/api/model/transit_type.py @@ -1,12 +1,27 @@ from enum import Enum, unique - - @unique class TransitType(Enum): + """TransitType枚举类""" + FLIGHT = "FLIGHT" TRAIN = "TRAIN" CRUISE = "CRUISE" COACH = "COACH" - def to_ams_dict(self): + def to_ams_dict(self) -> str: return self.name + + @staticmethod + def value_of(value): + if not value: + return None + + if TransitType.FLIGHT.value == value: + return TransitType.FLIGHT + if TransitType.TRAIN.value == value: + return TransitType.TRAIN + if TransitType.CRUISE.value == value: + return TransitType.CRUISE + if TransitType.COACH.value == value: + return TransitType.COACH + return None diff --git a/com/alipay/ams/api/model/trial.py b/com/alipay/ams/api/model/trial.py index 8ccb01f..f511a49 100644 --- a/com/alipay/ams/api/model/trial.py +++ b/com/alipay/ams/api/model/trial.py @@ -1,47 +1,69 @@ import json +from com.alipay.ams.api.model.amount import Amount -class Trial(object): + + +class Trial: def __init__(self): - self.__trial_start_period = None - self.__trial_amount = None - self.__trial_end_period = None + + self.__trial_start_period = None # type: int + self.__trial_amount = None # type: Amount + self.__trial_end_period = None # type: int + @property def trial_start_period(self): + """ + The start subscription period of the trial. For example, if the trial starts from the first subscription period, specify this parameter as 1. More information: Value range: 1 - unlimited + """ return self.__trial_start_period @trial_start_period.setter def trial_start_period(self, value): self.__trial_start_period = value - @property def trial_amount(self): + """Gets the trial_amount of this Trial. + + """ return self.__trial_amount @trial_amount.setter def trial_amount(self, value): self.__trial_amount = value - @property def trial_end_period(self): + """ + The end subscription period of the trial. For example, if the trial ends at the third subscription period, specify this parameter as 3. Note: Specify this parameter if the end subscription period is different from the start subscription period. If you leave this parameter empty, the default value of this parameter is the same as the value of trialStartPeriod. More information: Value range: 1 - unlimited + """ return self.__trial_end_period @trial_end_period.setter def trial_end_period(self, value): self.__trial_end_period = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) - return json_str - def __to_ams_dict(self): - params = dict() - if self.__trial_start_period is not None: - params['trialStartPeriod'] = self.__trial_start_period - if self.__trial_amount is not None: - params['trialAmount'] = self.__trial_amount - if self.__trial_end_period is not None: - params['trialEndPeriod'] = self.__trial_end_period + + def to_ams_dict(self): + params = dict() + if hasattr(self, "trial_start_period") and self.trial_start_period is not None: + params['trialStartPeriod'] = self.trial_start_period + if hasattr(self, "trial_amount") and self.trial_amount is not None: + params['trialAmount'] = self.trial_amount + if hasattr(self, "trial_end_period") and self.trial_end_period is not None: + params['trialEndPeriod'] = self.trial_end_period return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'trialStartPeriod' in response_body: + self.__trial_start_period = response_body['trialStartPeriod'] + if 'trialAmount' in response_body: + self.__trial_amount = Amount() + self.__trial_amount.parse_rsp_body(response_body['trialAmount']) + if 'trialEndPeriod' in response_body: + self.__trial_end_period = response_body['trialEndPeriod'] diff --git a/com/alipay/ams/api/model/user_name.py b/com/alipay/ams/api/model/user_name.py index 38fd375..1346b81 100644 --- a/com/alipay/ams/api/model/user_name.py +++ b/com/alipay/ams/api/model/user_name.py @@ -1,77 +1,82 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -class UserName(object): + +class UserName: def __init__(self): - self.__first_name = None - self.__middle_name = None - self.__last_name = None - self.__full_name = None + + self.__first_name = None # type: str + self.__middle_name = None # type: str + self.__last_name = None # type: str + self.__full_name = None # type: str + @property def first_name(self): + """Gets the first_name of this UserName. + + """ return self.__first_name @first_name.setter def first_name(self, value): self.__first_name = value - @property def middle_name(self): + """Gets the middle_name of this UserName. + + """ return self.__middle_name @middle_name.setter def middle_name(self, value): self.__middle_name = value - @property def last_name(self): + """Gets the last_name of this UserName. + + """ return self.__last_name @last_name.setter def last_name(self, value): self.__last_name = value - @property def full_name(self): + """Gets the full_name of this UserName. + + """ return self.__full_name @full_name.setter def full_name(self, value): self.__full_name = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "first_name") and self.first_name: + if hasattr(self, "first_name") and self.first_name is not None: params['firstName'] = self.first_name - - if hasattr(self, "middle_name") and self.middle_name: + if hasattr(self, "middle_name") and self.middle_name is not None: params['middleName'] = self.middle_name - - if hasattr(self, "last_name") and self.last_name: + if hasattr(self, "last_name") and self.last_name is not None: params['lastName'] = self.last_name - - if hasattr(self, "full_name") and self.full_name: + if hasattr(self, "full_name") and self.full_name is not None: params['fullName'] = self.full_name - return params - def parse_rsp_body(self, user_name_body): - if type(user_name_body) == str: - user_name_body = json.loads(user_name_body) - - if 'firstName' in user_name_body: - self.__first_name = user_name_body['firstName'] - - if 'middleName' in user_name_body: - self.__middle_name = user_name_body['middleName'] - - if 'lastName' in user_name_body: - self.__last_name = user_name_body['lastName'] - if 'fullName' in user_name_body: - self.__full_name = user_name_body['fullName'] + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'firstName' in response_body: + self.__first_name = response_body['firstName'] + if 'middleName' in response_body: + self.__middle_name = response_body['middleName'] + if 'lastName' in response_body: + self.__last_name = response_body['lastName'] + if 'fullName' in response_body: + self.__full_name = response_body['fullName'] diff --git a/com/alipay/ams/api/model/wallet.py b/com/alipay/ams/api/model/wallet.py new file mode 100644 index 0000000..f807710 --- /dev/null +++ b/com/alipay/ams/api/model/wallet.py @@ -0,0 +1,101 @@ +import json +from com.alipay.ams.api.model.user_name import UserName +from com.alipay.ams.api.model.address import Address + + + + +class Wallet: + def __init__(self): + + self.__account_no = None # type: str + self.__account_holder_name = None # type: UserName + self.__phone_no = None # type: str + self.__email = None # type: str + self.__billing_address = None # type: Address + + + @property + def account_no(self): + """Gets the account_no of this Wallet. + + """ + return self.__account_no + + @account_no.setter + def account_no(self, value): + self.__account_no = value + @property + def account_holder_name(self): + """Gets the account_holder_name of this Wallet. + + """ + return self.__account_holder_name + + @account_holder_name.setter + def account_holder_name(self, value): + self.__account_holder_name = value + @property + def phone_no(self): + """Gets the phone_no of this Wallet. + + """ + return self.__phone_no + + @phone_no.setter + def phone_no(self, value): + self.__phone_no = value + @property + def email(self): + """Gets the email of this Wallet. + + """ + return self.__email + + @email.setter + def email(self, value): + self.__email = value + @property + def billing_address(self): + """Gets the billing_address of this Wallet. + + """ + return self.__billing_address + + @billing_address.setter + def billing_address(self, value): + self.__billing_address = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "account_no") and self.account_no is not None: + params['accountNo'] = self.account_no + if hasattr(self, "account_holder_name") and self.account_holder_name is not None: + params['accountHolderName'] = self.account_holder_name + if hasattr(self, "phone_no") and self.phone_no is not None: + params['phoneNo'] = self.phone_no + if hasattr(self, "email") and self.email is not None: + params['email'] = self.email + if hasattr(self, "billing_address") and self.billing_address is not None: + params['billingAddress'] = self.billing_address + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'accountNo' in response_body: + self.__account_no = response_body['accountNo'] + if 'accountHolderName' in response_body: + self.__account_holder_name = UserName() + self.__account_holder_name.parse_rsp_body(response_body['accountHolderName']) + if 'phoneNo' in response_body: + self.__phone_no = response_body['phoneNo'] + if 'email' in response_body: + self.__email = response_body['email'] + if 'billingAddress' in response_body: + self.__billing_address = Address() + self.__billing_address.parse_rsp_body(response_body['billingAddress']) diff --git a/com/alipay/ams/api/model/web_site.py b/com/alipay/ams/api/model/web_site.py index 078b3d4..3aad424 100644 --- a/com/alipay/ams/api/model/web_site.py +++ b/com/alipay/ams/api/model/web_site.py @@ -1,54 +1,82 @@ -class WebSite(object): +import json + + + + +class WebSite: def __init__(self): - self.__name = None - self.__url = None - self.__desc = None - self.__type = None + + self.__name = None # type: str + self.__url = None # type: str + self.__desc = None # type: str + self.__type = None # type: str + @property def name(self): + """Gets the name of this WebSite. + + """ return self.__name @name.setter def name(self, value): self.__name = value - @property def url(self): + """ + The URL of the merchant website. More information: Maximum length: 2048 characters + """ return self.__url @url.setter def url(self, value): self.__url = value - @property def desc(self): + """Gets the desc of this WebSite. + + """ return self.__desc @desc.setter def desc(self, value): self.__desc = value - @property def type(self): + """ + Website type. Valid values are: COMPANY_INTRODUCE: the website that introduces company information. Specify websites.type as COMPANY_INTRODUCE when the value of paymentMethodType is TRUEMONEY. TRADING: the trading website. The same applies when the value is empty or you do not specify this parameter. More information: Maximum length: 32 characters + """ return self.__type @type.setter def type(self, value): self.__type = value + + + def to_ams_dict(self): params = dict() - if hasattr(self, "name") and self.name: + if hasattr(self, "name") and self.name is not None: params['name'] = self.name - - if hasattr(self, "url") and self.url: + if hasattr(self, "url") and self.url is not None: params['url'] = self.url - - if hasattr(self, "desc") and self.desc: + if hasattr(self, "desc") and self.desc is not None: params['desc'] = self.desc - - if hasattr(self, "type") and self.type: + if hasattr(self, "type") and self.type is not None: params['type'] = self.type - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'name' in response_body: + self.__name = response_body['name'] + if 'url' in response_body: + self.__url = response_body['url'] + if 'desc' in response_body: + self.__desc = response_body['desc'] + if 'type' in response_body: + self.__type = response_body['type'] diff --git a/com/alipay/ams/api/request/auth/alipay_auth_apply_token_request.py b/com/alipay/ams/api/request/auth/alipay_auth_apply_token_request.py index 0a4a93c..5a22947 100644 --- a/com/alipay/ams/api/request/auth/alipay_auth_apply_token_request.py +++ b/com/alipay/ams/api/request/auth/alipay_auth_apply_token_request.py @@ -1,88 +1,121 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import json - -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.model.customer_belongs_to import CustomerBelongsTo from com.alipay.ams.api.model.grant_type import GrantType -from com.alipay.ams.api.request.alipay_request import AlipayRequest +from com.alipay.ams.api.model.customer_belongs_to import CustomerBelongsTo -class AlipayAuthApplyTokenRequest(AlipayRequest): - def __init__(self): - super(AlipayAuthApplyTokenRequest, self).__init__(AntomPathConstants.AUTH_APPLY_TOKEN_PATH) - self.__grant_type = None # type:GrantType - self.__customer_belongs_to = None # type:CustomerBelongsTo - self.__auth_code = None - self.__refresh_token = None - self.__extend_info = None - self.__merchant_region = None +from com.alipay.ams.api.request.alipay_request import AlipayRequest - @property - def merchant_region(self): - return self.__merchant_region +class AlipayAuthApplyTokenRequest(AlipayRequest): + def __init__(self): + super(AlipayAuthApplyTokenRequest, self).__init__("/ams/api/v1/authorizations/applyToken") - @merchant_region.setter - def merchant_region(self, value): - self.__merchant_region = value + self.__grant_type = None # type: GrantType + self.__customer_belongs_to = None # type: CustomerBelongsTo + self.__auth_code = None # type: str + self.__refresh_token = None # type: str + self.__extend_info = None # type: str + self.__merchant_region = None # type: str + @property def grant_type(self): + """Gets the grant_type of this AlipayAuthApplyTokenRequest. + + """ return self.__grant_type @grant_type.setter def grant_type(self, value): self.__grant_type = value - @property def customer_belongs_to(self): + """Gets the customer_belongs_to of this AlipayAuthApplyTokenRequest. + + """ return self.__customer_belongs_to @customer_belongs_to.setter def customer_belongs_to(self, value): self.__customer_belongs_to = value - @property def auth_code(self): + """ + The authorization code, used for getting an access token. The value of this field is obtained from the reconstructed redirection URL returned by the wallet. Note: Specify this field when the value of grantType is AUTHORIZATION_CODE. More information: Maximum length: 128 characters + """ return self.__auth_code @auth_code.setter def auth_code(self, value): self.__auth_code = value - @property def refresh_token(self): + """ + The refresh token, used for getting a new access token when the access token is about to expire. The refresh token is obtained from the response of the successfully called applyToken API. Note: Specify this field when the value of grantType is REFRESH_TOKEN. More information: Maximum length: 128 characters + """ return self.__refresh_token @refresh_token.setter def refresh_token(self, value): self.__refresh_token = value - @property def extend_info(self): + """Gets the extend_info of this AlipayAuthApplyTokenRequest. + + """ return self.__extend_info @extend_info.setter def extend_info(self, value): self.__extend_info = value + @property + def merchant_region(self): + """ + The country or region where the merchant or secondary merchant operates the business. The parameter is a 2-letter country/region code that follows ISO 3166 Country Codes standard. Only US, JP, PK, SG are supported now. Note: This field is required when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + """ + return self.__merchant_region - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + @merchant_region.setter + def merchant_region(self, value): + self.__merchant_region = value + + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, "grant_type") and self.grant_type: + if hasattr(self, "grant_type") and self.grant_type is not None: params['grantType'] = self.grant_type - if hasattr(self, "customer_belongs_to") and self.customer_belongs_to: + if hasattr(self, "customer_belongs_to") and self.customer_belongs_to is not None: params['customerBelongsTo'] = self.customer_belongs_to - if hasattr(self, "auth_code") and self.auth_code: + if hasattr(self, "auth_code") and self.auth_code is not None: params['authCode'] = self.auth_code - if hasattr(self, "refresh_token") and self.refresh_token: + if hasattr(self, "refresh_token") and self.refresh_token is not None: params['refreshToken'] = self.refresh_token - if hasattr(self, "extend_info") and self.extend_info: + if hasattr(self, "extend_info") and self.extend_info is not None: params['extendInfo'] = self.extend_info - if hasattr(self, "merchant_region") and self.merchant_region: + if hasattr(self, "merchant_region") and self.merchant_region is not None: params['merchantRegion'] = self.merchant_region return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'grantType' in response_body: + grant_type_temp = GrantType.value_of(response_body['grantType']) + self.__grant_type = grant_type_temp + if 'customerBelongsTo' in response_body: + customer_belongs_to_temp = CustomerBelongsTo.value_of(response_body['customerBelongsTo']) + self.__customer_belongs_to = customer_belongs_to_temp + if 'authCode' in response_body: + self.__auth_code = response_body['authCode'] + if 'refreshToken' in response_body: + self.__refresh_token = response_body['refreshToken'] + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'merchantRegion' in response_body: + self.__merchant_region = response_body['merchantRegion'] diff --git a/com/alipay/ams/api/request/auth/alipay_auth_consult_request.py b/com/alipay/ams/api/request/auth/alipay_auth_consult_request.py index ba5522e..c4cc39c 100644 --- a/com/alipay/ams/api/request/auth/alipay_auth_consult_request.py +++ b/com/alipay/ams/api/request/auth/alipay_auth_consult_request.py @@ -1,160 +1,218 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - -from com.alipay.ams.api.model.auth_meta_data import AuthMetaData -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants from com.alipay.ams.api.model.customer_belongs_to import CustomerBelongsTo from com.alipay.ams.api.model.scope_type import ScopeType from com.alipay.ams.api.model.terminal_type import TerminalType -from com.alipay.ams.api.request.alipay_request import AlipayRequest - +from com.alipay.ams.api.model.os_type import OsType +from com.alipay.ams.api.model.auth_meta_data import AuthMetaData -class AlipayAuthConsultRequest(AlipayRequest): - def __init__(self): - super(AlipayAuthConsultRequest, self).__init__(AntomPathConstants.AUTH_CONSULT_PATH) - self.__customer_belongs_to = None # type:CustomerBelongsTo - self.__auth_client_id = None - self.__auth_redirect_url = None - self.__scopes = None # type:list[ScopeType] - self.__auth_state = None - self.__terminal_type = None # type:TerminalType - self.__os_type = None - self.__os_version = None - self.__extend_info = None - self.__merchant_region = None - self.__recurring_payment = None - self.__auth_meta_data = None #type: AuthMetaData - @property - def merchant_region(self): - return self.__merchant_region +from com.alipay.ams.api.request.alipay_request import AlipayRequest - @merchant_region.setter - def merchant_region(self, value): - self.__merchant_region = value +class AlipayAuthConsultRequest(AlipayRequest): + def __init__(self): + super(AlipayAuthConsultRequest, self).__init__("/ams/api/v1/authorizations/consult") + + self.__customer_belongs_to = None # type: CustomerBelongsTo + self.__auth_client_id = None # type: str + self.__auth_redirect_url = None # type: str + self.__scopes = None # type: [ScopeType] + self.__auth_state = None # type: str + self.__terminal_type = None # type: TerminalType + self.__os_type = None # type: OsType + self.__os_version = None # type: str + self.__extend_info = None # type: str + self.__merchant_region = None # type: str + self.__recurring_payment = None # type: bool + self.__auth_meta_data = None # type: AuthMetaData + @property def customer_belongs_to(self): + """Gets the customer_belongs_to of this AlipayAuthConsultRequest. + + """ return self.__customer_belongs_to @customer_belongs_to.setter def customer_belongs_to(self, value): self.__customer_belongs_to = value - @property def auth_client_id(self): + """ + The unique ID of the secondary merchant to which the user grants resource access permission. The value is specified by the acquirer and needs to be registered in Antom. Notes: Specify this field if you are an acquirer with secondary merchants. For an Alipay+ payment methods, the value of this field is the same as the value of the referenceMerchantId field in the pay (Auto Debit) interface. More information: Maximum length: 64 characters + """ return self.__auth_client_id @auth_client_id.setter def auth_client_id(self, value): self.__auth_client_id = value - @property def auth_redirect_url(self): + """ + The redirection URL that the user is redirected to after the user agrees to authorize. This value is provided by the merchant. More information: Maximum length: 1024 characters + """ return self.__auth_redirect_url @auth_redirect_url.setter def auth_redirect_url(self, value): self.__auth_redirect_url = value - @property def scopes(self): + """ + The authorization scope. Valid values are: BASE_USER_INFO: Indicates that the unique user ID can be obtained. USER_INFO: Indicates that the complete user information can be obtained, for example, user name, avatar, and other user information. AGREEMENT_PAY: Indicates that the user agrees to authorize for auto debit so that the merchant can use the access token to automatically deduct money from the user's account. More information: Maximum size: 4 elements + """ return self.__scopes @scopes.setter def scopes(self, value): self.__scopes = value - @property def auth_state(self): + """ + The unique ID generated by the merchant to represent the consult request. The consistency of this field and that in the redirection URL when the user agrees to authorize needs to be guaranteed. More information: Maximum length: 256 characters + """ return self.__auth_state @auth_state.setter def auth_state(self, value): self.__auth_state = value - @property def terminal_type(self): + """Gets the terminal_type of this AlipayAuthConsultRequest. + + """ return self.__terminal_type @terminal_type.setter def terminal_type(self, value): self.__terminal_type = value - @property def os_type(self): + """Gets the os_type of this AlipayAuthConsultRequest. + + """ return self.__os_type @os_type.setter def os_type(self, value): self.__os_type = value - @property def os_version(self): + """ + The OS version. Note: Specify this parameter when the value of terminalType is APP or WAP and you have this information. Providing this information makes the user's payment experience better. More information: Maximum length: 16 characters + """ return self.__os_version @os_version.setter def os_version(self, value): self.__os_version = value - @property def extend_info(self): + """Gets the extend_info of this AlipayAuthConsultRequest. + + """ return self.__extend_info @extend_info.setter def extend_info(self, value): self.__extend_info = value + @property + def merchant_region(self): + """ + The country or region where the merchant or secondary merchant operates the business. The parameter is a 2-letter country/region code that follows ISO 3166 Country Codes standard. Only US, JP, PK, SG are supported now. Note: This field is required when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + """ + return self.__merchant_region + @merchant_region.setter + def merchant_region(self, value): + self.__merchant_region = value @property def recurring_payment(self): + """ + Indicates whether the auto debit is used for recurring payments. Valid values are: true: indicates the auto debit is for recurring payments. false: indicates the auto debit is not for recurring payments. Specify this parameter when the value of customerBelongsTo is PAYPAY. + """ return self.__recurring_payment @recurring_payment.setter def recurring_payment(self, value): self.__recurring_payment = value - @property def auth_meta_data(self): + """Gets the auth_meta_data of this AlipayAuthConsultRequest. + + """ return self.__auth_meta_data @auth_meta_data.setter def auth_meta_data(self, value): self.__auth_meta_data = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): - params = dict() - if hasattr(self, "customer_belongs_to") and self.customer_belongs_to: + def to_ams_dict(self): + params = dict() + if hasattr(self, "customer_belongs_to") and self.customer_belongs_to is not None: params['customerBelongsTo'] = self.customer_belongs_to - if hasattr(self, "auth_client_id") and self.auth_client_id: + if hasattr(self, "auth_client_id") and self.auth_client_id is not None: params['authClientId'] = self.auth_client_id - if hasattr(self, "auth_redirect_url") and self.auth_redirect_url: + if hasattr(self, "auth_redirect_url") and self.auth_redirect_url is not None: params['authRedirectUrl'] = self.auth_redirect_url - if hasattr(self, "scopes") and self.scopes: + if hasattr(self, "scopes") and self.scopes is not None: params['scopes'] = self.scopes - if hasattr(self, "auth_state") and self.auth_state: + if hasattr(self, "auth_state") and self.auth_state is not None: params['authState'] = self.auth_state - if hasattr(self, "terminal_type") and self.terminal_type: + if hasattr(self, "terminal_type") and self.terminal_type is not None: params['terminalType'] = self.terminal_type - if hasattr(self, "os_type") and self.os_type: + if hasattr(self, "os_type") and self.os_type is not None: params['osType'] = self.os_type - if hasattr(self, "os_version") and self.os_version: + if hasattr(self, "os_version") and self.os_version is not None: params['osVersion'] = self.os_version - if hasattr(self, "extendInfo") and self.extend_info: + if hasattr(self, "extend_info") and self.extend_info is not None: params['extendInfo'] = self.extend_info - if hasattr(self, "merchant_region") and self.merchant_region: + if hasattr(self, "merchant_region") and self.merchant_region is not None: params['merchantRegion'] = self.merchant_region - if hasattr(self, "recurring_payment") and self.recurring_payment: + if hasattr(self, "recurring_payment") and self.recurring_payment is not None: params['recurringPayment'] = self.recurring_payment - - if hasattr(self, "auth_meta_data") and self.auth_meta_data: + if hasattr(self, "auth_meta_data") and self.auth_meta_data is not None: params['authMetaData'] = self.auth_meta_data - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'customerBelongsTo' in response_body: + customer_belongs_to_temp = CustomerBelongsTo.value_of(response_body['customerBelongsTo']) + self.__customer_belongs_to = customer_belongs_to_temp + if 'authClientId' in response_body: + self.__auth_client_id = response_body['authClientId'] + if 'authRedirectUrl' in response_body: + self.__auth_redirect_url = response_body['authRedirectUrl'] + if 'scopes' in response_body: + self.__scopes = [] + for item in response_body['scopes']: + self.__scopes.append(item) + if 'authState' in response_body: + self.__auth_state = response_body['authState'] + if 'terminalType' in response_body: + terminal_type_temp = TerminalType.value_of(response_body['terminalType']) + self.__terminal_type = terminal_type_temp + if 'osType' in response_body: + os_type_temp = OsType.value_of(response_body['osType']) + self.__os_type = os_type_temp + if 'osVersion' in response_body: + self.__os_version = response_body['osVersion'] + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'merchantRegion' in response_body: + self.__merchant_region = response_body['merchantRegion'] + if 'recurringPayment' in response_body: + self.__recurring_payment = response_body['recurringPayment'] + if 'authMetaData' in response_body: + self.__auth_meta_data = AuthMetaData() + self.__auth_meta_data.parse_rsp_body(response_body['authMetaData']) diff --git a/com/alipay/ams/api/request/auth/alipay_auth_revoke_token_request.py b/com/alipay/ams/api/request/auth/alipay_auth_revoke_token_request.py index aa5dfb3..be1c7bd 100644 --- a/com/alipay/ams/api/request/auth/alipay_auth_revoke_token_request.py +++ b/com/alipay/ams/api/request/auth/alipay_auth_revoke_token_request.py @@ -1,43 +1,57 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.request.alipay_request import AlipayRequest -class AlipayAuthRevokeTokenRequest(AlipayRequest): +from com.alipay.ams.api.request.alipay_request import AlipayRequest +class AlipayAuthRevokeTokenRequest(AlipayRequest): def __init__(self): - super(AlipayAuthRevokeTokenRequest, self).__init__(AntomPathConstants.AUTH_REVOKE_PATH) - self.__access_token = None - self.__extend_info = None + super(AlipayAuthRevokeTokenRequest, self).__init__("/ams/api/v1/authorizations/revoke") + + self.__access_token = None # type: str + self.__extend_info = None # type: str + @property def access_token(self): + """ + The access token that is used to access the corresponding scope of the user resource. More information: Maximum length: 128 characters + """ return self.__access_token @access_token.setter def access_token(self, value): self.__access_token = value - @property def extend_info(self): + """Gets the extend_info of this AlipayAuthRevokeTokenRequest. + + """ return self.__extend_info @extend_info.setter def extend_info(self, value): self.__extend_info = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, "access_token") and self.access_token: + if hasattr(self, "access_token") and self.access_token is not None: params['accessToken'] = self.access_token - if hasattr(self, "extend_info") and self.extend_info: + if hasattr(self, "extend_info") and self.extend_info is not None: params['extendInfo'] = self.extend_info return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'accessToken' in response_body: + self.__access_token = response_body['accessToken'] + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] diff --git a/com/alipay/ams/api/request/dispute/alipay_accept_dispute_request.py b/com/alipay/ams/api/request/dispute/alipay_accept_dispute_request.py index 07ef26a..a2642e9 100644 --- a/com/alipay/ams/api/request/dispute/alipay_accept_dispute_request.py +++ b/com/alipay/ams/api/request/dispute/alipay_accept_dispute_request.py @@ -1,29 +1,42 @@ import json -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.request.alipay_request import AlipayRequest +from com.alipay.ams.api.request.alipay_request import AlipayRequest + class AlipayAcceptDisputeRequest(AlipayRequest): def __init__(self): - super(AlipayAcceptDisputeRequest, self).__init__(AntomPathConstants.ACCEPT_DISPUTE_PATH) - self.__dispute_id = None + super(AlipayAcceptDisputeRequest, self).__init__("/ams/api/v1/payments/acceptDispute") + + self.__dispute_id = None # type: str + @property def dispute_id(self): + """ + The unique ID assigned by Antom to identify a dispute. More information: Maximum length: 64 characters + """ return self.__dispute_id @dispute_id.setter def dispute_id(self, value): self.__dispute_id = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): - params = dict() - if self.__dispute_id is not None: - params['disputeId'] = self.__dispute_id + def to_ams_dict(self): + params = dict() + if hasattr(self, "dispute_id") and self.dispute_id is not None: + params['disputeId'] = self.dispute_id return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'disputeId' in response_body: + self.__dispute_id = response_body['disputeId'] diff --git a/com/alipay/ams/api/request/dispute/alipay_download_dispute_evidence_request.py b/com/alipay/ams/api/request/dispute/alipay_download_dispute_evidence_request.py index 7c59cc0..b179466 100644 --- a/com/alipay/ams/api/request/dispute/alipay_download_dispute_evidence_request.py +++ b/com/alipay/ams/api/request/dispute/alipay_download_dispute_evidence_request.py @@ -1,40 +1,59 @@ import json - -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants from com.alipay.ams.api.model.dispute_evidence_type import DisputeEvidenceType -from com.alipay.ams.api.request.alipay_request import AlipayRequest + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + class AlipayDownloadDisputeEvidenceRequest(AlipayRequest): def __init__(self): - super(AlipayDownloadDisputeEvidenceRequest, self).__init__(AntomPathConstants.DOWNLOAD_DISPUTE_EVIDENCE_PATH) - self.__dispute_id = None - self.__dispute_evidence_type = None # type:DisputeEvidenceType + super(AlipayDownloadDisputeEvidenceRequest, self).__init__("/ams/api/v1/payments/downloadDisputeEvidence") + + self.__dispute_id = None # type: str + self.__dispute_evidence_type = None # type: DisputeEvidenceType + @property def dispute_id(self): + """ + The unique ID that is assigned by Antom to identify a dispute. More information: Maximum length: 64 characters + """ return self.__dispute_id @dispute_id.setter def dispute_id(self, value): self.__dispute_id = value - @property def dispute_evidence_type(self): + """Gets the dispute_evidence_type of this AlipayDownloadDisputeEvidenceRequest. + + """ return self.__dispute_evidence_type @dispute_evidence_type.setter def dispute_evidence_type(self, value): self.__dispute_evidence_type = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if self.__dispute_id is not None: - params['disputeId'] = self.__dispute_id - if self.__dispute_evidence_type is not None: - params['disputeEvidenceType'] = self.__dispute_evidence_type + if hasattr(self, "dispute_id") and self.dispute_id is not None: + params['disputeId'] = self.dispute_id + if hasattr(self, "dispute_evidence_type") and self.dispute_evidence_type is not None: + params['disputeEvidenceType'] = self.dispute_evidence_type return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'disputeId' in response_body: + self.__dispute_id = response_body['disputeId'] + if 'disputeEvidenceType' in response_body: + dispute_evidence_type_temp = DisputeEvidenceType.value_of(response_body['disputeEvidenceType']) + self.__dispute_evidence_type = dispute_evidence_type_temp diff --git a/com/alipay/ams/api/request/dispute/alipay_supply_defense_document_request.py b/com/alipay/ams/api/request/dispute/alipay_supply_defense_document_request.py index 23160d8..4e18e8e 100644 --- a/com/alipay/ams/api/request/dispute/alipay_supply_defense_document_request.py +++ b/com/alipay/ams/api/request/dispute/alipay_supply_defense_document_request.py @@ -1,39 +1,57 @@ import json -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.request.alipay_request import AlipayRequest +from com.alipay.ams.api.request.alipay_request import AlipayRequest + class AlipaySupplyDefenseDocumentRequest(AlipayRequest): def __init__(self): - super(AlipaySupplyDefenseDocumentRequest, self).__init__(AntomPathConstants.SUPPLY_DEFENCE_DOC_PATH) - self.__dispute_id = None - self.__dispute_evidence = None + super(AlipaySupplyDefenseDocumentRequest, self).__init__("/ams/api/v1/payments/supplyDefenseDocument") + + self.__dispute_id = None # type: str + self.__dispute_evidence = None # type: str + @property def dispute_id(self): + """ + The unique ID assigned by Antom to identify a dispute. More information: Maximum length: 64 characters + """ return self.__dispute_id @dispute_id.setter def dispute_id(self, value): self.__dispute_id = value - @property def dispute_evidence(self): + """ + The dispute defense document that you prepare for defending the dispute, which is encoded in the Base64 format. More information: Maximum length: 1000000 characters + """ return self.__dispute_evidence @dispute_evidence.setter def dispute_evidence(self, value): self.__dispute_evidence = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if self.__dispute_id is not None: - params['disputeId'] = self.__dispute_id - if self.__dispute_evidence is not None: - params['disputeEvidence'] = self.__dispute_evidence + if hasattr(self, "dispute_id") and self.dispute_id is not None: + params['disputeId'] = self.dispute_id + if hasattr(self, "dispute_evidence") and self.dispute_evidence is not None: + params['disputeEvidence'] = self.dispute_evidence return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'disputeId' in response_body: + self.__dispute_id = response_body['disputeId'] + if 'disputeEvidence' in response_body: + self.__dispute_evidence = response_body['disputeEvidence'] diff --git a/com/alipay/ams/api/request/marketplace/alipay_create_payout_request.py b/com/alipay/ams/api/request/marketplace/alipay_create_payout_request.py index 03a9b16..6aed37b 100644 --- a/com/alipay/ams/api/request/marketplace/alipay_create_payout_request.py +++ b/com/alipay/ams/api/request/marketplace/alipay_create_payout_request.py @@ -1,53 +1,76 @@ import json - -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants from com.alipay.ams.api.model.transfer_from_detail import TransferFromDetail from com.alipay.ams.api.model.transfer_to_detail import TransferToDetail -from com.alipay.ams.api.request.alipay_request import AlipayRequest -class AlipayCreatePayoutRequest(AlipayRequest): +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AlipayCreatePayoutRequest(AlipayRequest): def __init__(self): - super(AlipayCreatePayoutRequest, self).__init__(AntomPathConstants.MARKETPLACE_CREATEPAYOUT_PATH) - self.__transfer_requestId = None + super(AlipayCreatePayoutRequest, self).__init__("/ams/api/v1/funds/createPayout") + + self.__transfer_request_id = None # type: str self.__transfer_from_detail = None # type: TransferFromDetail self.__transfer_to_detail = None # type: TransferToDetail + @property - def transfer_requestId(self): - return self.__transfer_requestId - - @transfer_requestId.setter - def transfer_requestId(self, value): - self.__transfer_requestId = value + def transfer_request_id(self): + """ + The unique ID assigned by the marketplace to identify a payout request. More information: This field is an API idempotency field.For requests that are initiated with the same value of transferRequestId and reach a final status (S or F), the same result is to be returned for the request. Maximum length: 64 characters + """ + return self.__transfer_request_id + @transfer_request_id.setter + def transfer_request_id(self, value): + self.__transfer_request_id = value @property def transfer_from_detail(self): + """Gets the transfer_from_detail of this AlipayCreatePayoutRequest. + + """ return self.__transfer_from_detail @transfer_from_detail.setter def transfer_from_detail(self, value): self.__transfer_from_detail = value - @property def transfer_to_detail(self): + """Gets the transfer_to_detail of this AlipayCreatePayoutRequest. + + """ return self.__transfer_to_detail @transfer_to_detail.setter def transfer_to_detail(self, value): self.__transfer_to_detail = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if self.__transfer_requestId is not None: - params['transferRequestId'] = self.__transfer_requestId - if self.__transfer_from_detail is not None: - params['transferFromDetail'] = self.__transfer_from_detail.to_ams_dict() - if self.__transfer_to_detail is not None: - params['transferToDetail'] = self.__transfer_to_detail.to_ams_dict() + if hasattr(self, "transfer_request_id") and self.transfer_request_id is not None: + params['transferRequestId'] = self.transfer_request_id + if hasattr(self, "transfer_from_detail") and self.transfer_from_detail is not None: + params['transferFromDetail'] = self.transfer_from_detail + if hasattr(self, "transfer_to_detail") and self.transfer_to_detail is not None: + params['transferToDetail'] = self.transfer_to_detail return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'transferRequestId' in response_body: + self.__transfer_request_id = response_body['transferRequestId'] + if 'transferFromDetail' in response_body: + self.__transfer_from_detail = TransferFromDetail() + self.__transfer_from_detail.parse_rsp_body(response_body['transferFromDetail']) + if 'transferToDetail' in response_body: + self.__transfer_to_detail = TransferToDetail() + self.__transfer_to_detail.parse_rsp_body(response_body['transferToDetail']) diff --git a/com/alipay/ams/api/request/marketplace/alipay_create_transfer_request.py b/com/alipay/ams/api/request/marketplace/alipay_create_transfer_request.py index 82b16a6..e91d070 100644 --- a/com/alipay/ams/api/request/marketplace/alipay_create_transfer_request.py +++ b/com/alipay/ams/api/request/marketplace/alipay_create_transfer_request.py @@ -1,53 +1,76 @@ import json - -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants from com.alipay.ams.api.model.transfer_from_detail import TransferFromDetail from com.alipay.ams.api.model.transfer_to_detail import TransferToDetail -from com.alipay.ams.api.request.alipay_request import AlipayRequest -class AlipayCreateTransferRequest(AlipayRequest): +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AlipayCreateTransferRequest(AlipayRequest): def __init__(self): - super(AlipayCreateTransferRequest, self).__init__(AntomPathConstants.MARKETPLACE_CREATETRANSFER_PATH) - self.__transfer_request_id = None + super(AlipayCreateTransferRequest, self).__init__("/ams/api/v1/funds/createTransfer") + + self.__transfer_request_id = None # type: str self.__transfer_from_detail = None # type: TransferFromDetail self.__transfer_to_detail = None # type: TransferToDetail + @property def transfer_request_id(self): + """ + The unique ID assigned by the marketplace to identify a transfer request. More information: This field is an API idempotency field.For requests that are initiated with the same value of transferRequestId and reach a final status (S or F), the same result is to be returned for the request. Maximum length: 64 characters + """ return self.__transfer_request_id @transfer_request_id.setter def transfer_request_id(self, value): self.__transfer_request_id = value - @property def transfer_from_detail(self): + """Gets the transfer_from_detail of this AlipayCreateTransferRequest. + + """ return self.__transfer_from_detail @transfer_from_detail.setter def transfer_from_detail(self, value): self.__transfer_from_detail = value - @property def transfer_to_detail(self): + """Gets the transfer_to_detail of this AlipayCreateTransferRequest. + + """ return self.__transfer_to_detail @transfer_to_detail.setter def transfer_to_detail(self, value): self.__transfer_to_detail = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, "transfer_request_id") and self.transfer_request_id: + if hasattr(self, "transfer_request_id") and self.transfer_request_id is not None: params['transferRequestId'] = self.transfer_request_id - if hasattr(self, "transfer_from_detail") and self.transfer_from_detail: - params['transferFromDetail'] = self.transfer_from_detail.to_ams_dict() - if hasattr(self, "transfer_to_detail") and self.transfer_to_detail: - params['transferToDetail'] = self.transfer_to_detail.to_ams_dict() + if hasattr(self, "transfer_from_detail") and self.transfer_from_detail is not None: + params['transferFromDetail'] = self.transfer_from_detail + if hasattr(self, "transfer_to_detail") and self.transfer_to_detail is not None: + params['transferToDetail'] = self.transfer_to_detail return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'transferRequestId' in response_body: + self.__transfer_request_id = response_body['transferRequestId'] + if 'transferFromDetail' in response_body: + self.__transfer_from_detail = TransferFromDetail() + self.__transfer_from_detail.parse_rsp_body(response_body['transferFromDetail']) + if 'transferToDetail' in response_body: + self.__transfer_to_detail = TransferToDetail() + self.__transfer_to_detail.parse_rsp_body(response_body['transferToDetail']) diff --git a/com/alipay/ams/api/request/marketplace/alipay_inquire_balance_request.py b/com/alipay/ams/api/request/marketplace/alipay_inquire_balance_request.py index 90d0545..9627bdd 100644 --- a/com/alipay/ams/api/request/marketplace/alipay_inquire_balance_request.py +++ b/com/alipay/ams/api/request/marketplace/alipay_inquire_balance_request.py @@ -1,29 +1,42 @@ import json -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.request.alipay_request import AlipayRequest +from com.alipay.ams.api.request.alipay_request import AlipayRequest + class AlipayInquireBalanceRequest(AlipayRequest): def __init__(self): - super(AlipayInquireBalanceRequest, self).__init__(AntomPathConstants.MARKETPLACE_INQUIREBALANCE_PATH) - self.__referenceMerchantId = None + super(AlipayInquireBalanceRequest, self).__init__("/ams/api/v1/accounts/inquireBalance") + + self.__reference_merchant_id = None # type: str + @property def reference_merchant_id(self): - return self.__referenceMerchantId + """ + The unique ID that is assigned by the marketplace to identify the sub-merchant. Specify this parameter if you inquire about the account balance of the sub-merchant. If you leave this parameter empty or do not specify this parameter, the default action is to inquire about the account balance of the marketplace. More information: Maximum length: 32 characters + """ + return self.__reference_merchant_id @reference_merchant_id.setter def reference_merchant_id(self, value): - self.__referenceMerchantId = value + self.__reference_merchant_id = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if self.__referenceMerchantId is not None: - params['referenceMerchantId'] = self.__referenceMerchantId - return params \ No newline at end of file + if hasattr(self, "reference_merchant_id") and self.reference_merchant_id is not None: + params['referenceMerchantId'] = self.reference_merchant_id + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'referenceMerchantId' in response_body: + self.__reference_merchant_id = response_body['referenceMerchantId'] diff --git a/com/alipay/ams/api/request/marketplace/alipay_register_request.py b/com/alipay/ams/api/request/marketplace/alipay_register_request.py index 4a628b7..6e6eb05 100644 --- a/com/alipay/ams/api/request/marketplace/alipay_register_request.py +++ b/com/alipay/ams/api/request/marketplace/alipay_register_request.py @@ -1,46 +1,57 @@ import json - -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants +from com.alipay.ams.api.model.settlement_info import SettlementInfo from com.alipay.ams.api.model.merchant_info import MerchantInfo from com.alipay.ams.api.model.payment_method import PaymentMethod -from com.alipay.ams.api.model.settlement_info import SettlementInfo -from com.alipay.ams.api.request.alipay_request import AlipayRequest + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + class AlipayRegisterRequest(AlipayRequest): def __init__(self): - super(AlipayRegisterRequest,self).__init__(AntomPathConstants.MARKETPLACE_REGISTER_PATH) - self.__registration_request_id = None - self.__settlement_infos = None #type: list[SettlementInfo] - self.__merchant_info = None #type: MerchantInfo - self.__payment_methods = None #type: list[PaymentMethod] + super(AlipayRegisterRequest, self).__init__("/ams/api/v1/merchants/register") + + self.__registration_request_id = None # type: str + self.__settlement_infos = None # type: [SettlementInfo] + self.__merchant_info = None # type: MerchantInfo + self.__payment_methods = None # type: [PaymentMethod] + @property def registration_request_id(self): + """ + The unique ID that is assigned by the marketplace to identify a registration request. Alipay uses this field for idempotence control. More information: This field is an API idempotency field.For registration requests that are initiated with the same value of registrationRequestId and reach a final status (resultStatus = S or F), the same result is to be returned for the request. Maximum length: 64 characters + """ return self.__registration_request_id @registration_request_id.setter def registration_request_id(self, value): self.__registration_request_id = value - @property def settlement_infos(self): + """ + The list of sub-merchants' settlement information. One settlement currency corresponds to one settlement bank account. More information: Maximum size: 10 elements + """ return self.__settlement_infos @settlement_infos.setter def settlement_infos(self, value): self.__settlement_infos = value - @property def merchant_info(self): + """Gets the merchant_info of this AlipayRegisterRequest. + + """ return self.__merchant_info @merchant_info.setter def merchant_info(self, value): self.__merchant_info = value - @property def payment_methods(self): + """ + The payment method that is used to collect the payment by the merchant or acquirer. The payment method must be already supportd by the platform merchant before they can be assigned for sub-merchants. More information: Maximum length: 100 characters + """ return self.__payment_methods @payment_methods.setter @@ -48,18 +59,41 @@ def payment_methods(self, value): self.__payment_methods = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, 'registration_request_id') and self.registration_request_id: + if hasattr(self, "registration_request_id") and self.registration_request_id is not None: params['registrationRequestId'] = self.registration_request_id - if hasattr(self, 'settlement_infos') and self.settlement_infos: + if hasattr(self, "settlement_infos") and self.settlement_infos is not None: params['settlementInfos'] = self.settlement_infos - if hasattr(self, 'merchant_info') and self.merchant_info: + if hasattr(self, "merchant_info") and self.merchant_info is not None: params['merchantInfo'] = self.merchant_info - if hasattr(self, 'payment_methods') and self.payment_methods: + if hasattr(self, "payment_methods") and self.payment_methods is not None: params['paymentMethods'] = self.payment_methods return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'registrationRequestId' in response_body: + self.__registration_request_id = response_body['registrationRequestId'] + if 'settlementInfos' in response_body: + self.__settlement_infos = [] + for item in response_body['settlementInfos']: + obj = SettlementInfo() + obj.parse_rsp_body(item) + self.__settlement_infos.append(obj) + if 'merchantInfo' in response_body: + self.__merchant_info = MerchantInfo() + self.__merchant_info.parse_rsp_body(response_body['merchantInfo']) + if 'paymentMethods' in response_body: + self.__payment_methods = [] + for item in response_body['paymentMethods']: + obj = PaymentMethod() + obj.parse_rsp_body(item) + self.__payment_methods.append(obj) diff --git a/com/alipay/ams/api/request/marketplace/alipay_settle_request.py b/com/alipay/ams/api/request/marketplace/alipay_settle_request.py index d23a4da..7a40be9 100644 --- a/com/alipay/ams/api/request/marketplace/alipay_settle_request.py +++ b/com/alipay/ams/api/request/marketplace/alipay_settle_request.py @@ -1,51 +1,77 @@ import json - -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants from com.alipay.ams.api.model.settlement_detail import SettlementDetail -from com.alipay.ams.api.request.alipay_request import AlipayRequest + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + class AlipaySettleRequest(AlipayRequest): def __init__(self): - super(AlipaySettleRequest, self).__init__(AntomPathConstants.MARKETPLACE_SETTLE_PATH) - self.__settlement_request_id = None - self.__payment_id = None - self.__settlement_details = None #type: list[SettlementDetail] + super(AlipaySettleRequest, self).__init__("/ams/api/v1/payments/settle") + + self.__settlement_request_id = None # type: str + self.__payment_id = None # type: str + self.__settlement_details = None # type: [SettlementDetail] + @property def settlement_request_id(self): + """ + The unique ID that is assigned by the marketplace to identify a settlement request. Antom uses this field for idempotence control. More information: This field is an API idempotency field.For registration requests that are initiated with the same value of settlementRequestId and reach a final status (resultStatus = S or F), the same result is to be returned for the request. Maximum length: 64 characters + """ return self.__settlement_request_id @settlement_request_id.setter def settlement_request_id(self, value): self.__settlement_request_id = value - @property def payment_id(self): + """ + The unique ID that is assigned by Antom to identify a payment. The value of this parameter is returned through the same parameter in the pay (Cashier Payment) API. More information: Maximum length: 64 characters + """ return self.__payment_id @payment_id.setter def payment_id(self, value): self.__payment_id = value - @property def settlement_details(self): + """ + The settlement details for a payment. More information: Maximum length: 20 characters + """ return self.__settlement_details @settlement_details.setter def settlement_details(self, value): self.__settlement_details = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, 'settlement_request_id') and self.__settlement_request_id: - params['settlementRequestId'] = self.__settlement_request_id - if hasattr(self, 'payment_id') and self.__payment_id: - params['paymentId'] = self.__payment_id - if hasattr(self, 'settlement_details') and self.__settlement_details: - params['settlementDetails'] = self.__settlement_details - return params \ No newline at end of file + if hasattr(self, "settlement_request_id") and self.settlement_request_id is not None: + params['settlementRequestId'] = self.settlement_request_id + if hasattr(self, "payment_id") and self.payment_id is not None: + params['paymentId'] = self.payment_id + if hasattr(self, "settlement_details") and self.settlement_details is not None: + params['settlementDetails'] = self.settlement_details + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'settlementRequestId' in response_body: + self.__settlement_request_id = response_body['settlementRequestId'] + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'settlementDetails' in response_body: + self.__settlement_details = [] + for item in response_body['settlementDetails']: + obj = SettlementDetail() + obj.parse_rsp_body(item) + self.__settlement_details.append(obj) diff --git a/com/alipay/ams/api/request/marketplace/alipay_settlement_info_update_request.py b/com/alipay/ams/api/request/marketplace/alipay_settlement_info_update_request.py index bb409d8..f6a4ff7 100644 --- a/com/alipay/ams/api/request/marketplace/alipay_settlement_info_update_request.py +++ b/com/alipay/ams/api/request/marketplace/alipay_settlement_info_update_request.py @@ -1,62 +1,89 @@ import json - -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants from com.alipay.ams.api.model.settlement_bank_account import SettlementBankAccount -from com.alipay.ams.api.request.alipay_request import AlipayRequest + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + class AlipaySettlementInfoUpdateRequest(AlipayRequest): def __init__(self): - super(AlipaySettlementInfoUpdateRequest, self).__init__(AntomPathConstants.MARKETPLACE_SETTLEMENTINFO_UPDATE_PATH) - self.__update_request_id = None - self.__reference_merchant_id = None - self.__settlement_currency = None - self.__settlement_bank_account = None #type: SettlementBankAccount + super(AlipaySettlementInfoUpdateRequest, self).__init__("/ams/api/v1/merchants/settlementInfo/update") + + self.__update_request_id = None # type: str + self.__reference_merchant_id = None # type: str + self.__settlement_currency = None # type: str + self.__settlement_bank_account = None # type: SettlementBankAccount + @property def update_request_id(self): + """ + The unique ID that is assigned by the marketplace to identify an update request for settlement information. Alipay uses this field for idempotence control. More information: This field is an API idempotency field.For registration requests that are initiated with the same value of registrationRequestId and reach a final status (resultStatus = S or F), the same result is to be returned for the request. Maximum length: 64 characters + """ return self.__update_request_id @update_request_id.setter def update_request_id(self, value): self.__update_request_id = value - @property def reference_merchant_id(self): + """ + The unique ID that is assigned by the marketplace to identify the seller. More information: Maximum length: 64 characters + """ return self.__reference_merchant_id @reference_merchant_id.setter def reference_merchant_id(self, value): self.__reference_merchant_id = value - @property def settlement_currency(self): + """ + The seller's settlement currency that is specified in the settlement contract. The value of this parameter is a 3-letter currency code that follows the ISO 4217 standard. More information: Maximum length: 3 characters + """ return self.__settlement_currency @settlement_currency.setter def settlement_currency(self, value): self.__settlement_currency = value - @property def settlement_bank_account(self): + """Gets the settlement_bank_account of this AlipaySettlementInfoUpdateRequest. + + """ return self.__settlement_bank_account @settlement_bank_account.setter def settlement_bank_account(self, value): self.__settlement_bank_account = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, 'update_request_id') and self.update_request_id: - params['updateRequestId'] = self.__update_request_id - if hasattr(self, 'reference_merchant_id') and self.reference_merchant_id: - params['referenceMerchantId'] = self.__reference_merchant_id - if hasattr(self, 'settlement_currency') and self.settlement_currency: - params['settlementCurrency'] = self.__settlement_currency - if hasattr(self, 'settlement_bank_account') and self.settlement_bank_account: - params['settlementBankAccount'] = self.__settlement_bank_account - return params \ No newline at end of file + if hasattr(self, "update_request_id") and self.update_request_id is not None: + params['updateRequestId'] = self.update_request_id + if hasattr(self, "reference_merchant_id") and self.reference_merchant_id is not None: + params['referenceMerchantId'] = self.reference_merchant_id + if hasattr(self, "settlement_currency") and self.settlement_currency is not None: + params['settlementCurrency'] = self.settlement_currency + if hasattr(self, "settlement_bank_account") and self.settlement_bank_account is not None: + params['settlementBankAccount'] = self.settlement_bank_account + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'updateRequestId' in response_body: + self.__update_request_id = response_body['updateRequestId'] + if 'referenceMerchantId' in response_body: + self.__reference_merchant_id = response_body['referenceMerchantId'] + if 'settlementCurrency' in response_body: + self.__settlement_currency = response_body['settlementCurrency'] + if 'settlementBankAccount' in response_body: + self.__settlement_bank_account = SettlementBankAccount() + self.__settlement_bank_account.parse_rsp_body(response_body['settlementBankAccount']) diff --git a/com/alipay/ams/api/request/marketplace/alipay_submit_attachment_request.py b/com/alipay/ams/api/request/marketplace/alipay_submit_attachment_request.py index 4196dab..14cd7da 100644 --- a/com/alipay/ams/api/request/marketplace/alipay_submit_attachment_request.py +++ b/com/alipay/ams/api/request/marketplace/alipay_submit_attachment_request.py @@ -1,51 +1,74 @@ import json - -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants from com.alipay.ams.api.model.attachment_type import AttachmentType -from com.alipay.ams.api.request.alipay_request import AlipayRequest + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + class AlipaySubmitAttachmentRequest(AlipayRequest): def __init__(self): - super(AlipaySubmitAttachmentRequest, self).__init__(AntomPathConstants.MARKETPLACE_SUBMITATTACHMENT_PATH) - self.__submit_attachment_request_id = None - self.__attachment_type = None #type: AttachmentType - self.__file_sha_256 = None + super(AlipaySubmitAttachmentRequest, self).__init__("/ams/api/open/openapiv2_file/v1/business/attachment/submitAttachment") + + self.__submit_attachment_request_id = None # type: str + self.__attachment_type = None # type: AttachmentType + self.__file_sha256 = None # type: str + @property def submit_attachment_request_id(self): + """ + The unique ID assigned by the marketplace to identify an attachment submission request. More information: This field is an API idempotency field. For attachment submission requests that are initiated with the same value of attachmentSubmissionRequestId and reach a final status of S or F, the same result is to be returned for the request. Maximum length: 32 characters + """ return self.__submit_attachment_request_id @submit_attachment_request_id.setter def submit_attachment_request_id(self, value): self.__submit_attachment_request_id = value - @property def attachment_type(self): + """Gets the attachment_type of this AlipaySubmitAttachmentRequest. + + """ return self.__attachment_type @attachment_type.setter def attachment_type(self, value): self.__attachment_type = value - @property - def file_sha_256(self): - return self.__file_sha_256 + def file_sha256(self): + """ + The SHA-256 hash value of the file, used to uniquely identify and verify its integrity and authenticity. For more information, see How to calculate the SHA256 digest of a file. More information: Maximum length: 64 characters + """ + return self.__file_sha256 + + @file_sha256.setter + def file_sha256(self, value): + self.__file_sha256 = value - @file_sha_256.setter - def file_sha_256(self, value): - self.__file_sha_256 = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, 'submit_attachment_request_id') and self.submit_attachment_request_id: - params['submitAttachmentRequestId'] = self.__submit_attachment_request_id - if hasattr(self, 'attachment_type') and self.attachment_type: - params['attachmentType'] = self.__attachment_type - if hasattr(self, 'file_sha_256') and self.file_sha_256: - params['fileSha256'] = self.__file_sha_256 - return params \ No newline at end of file + if hasattr(self, "submit_attachment_request_id") and self.submit_attachment_request_id is not None: + params['submitAttachmentRequestId'] = self.submit_attachment_request_id + if hasattr(self, "attachment_type") and self.attachment_type is not None: + params['attachmentType'] = self.attachment_type + if hasattr(self, "file_sha256") and self.file_sha256 is not None: + params['fileSha256'] = self.file_sha256 + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'submitAttachmentRequestId' in response_body: + self.__submit_attachment_request_id = response_body['submitAttachmentRequestId'] + if 'attachmentType' in response_body: + attachment_type_temp = AttachmentType.value_of(response_body['attachmentType']) + self.__attachment_type = attachment_type_temp + if 'fileSha256' in response_body: + self.__file_sha256 = response_body['fileSha256'] diff --git a/com/alipay/ams/api/request/pay/alipay_capture_request.py b/com/alipay/ams/api/request/pay/alipay_capture_request.py index 74851ff..82b9a91 100644 --- a/com/alipay/ams/api/request/pay/alipay_capture_request.py +++ b/com/alipay/ams/api/request/pay/alipay_capture_request.py @@ -1,70 +1,89 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - from com.alipay.ams.api.model.amount import Amount -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.request.alipay_request import AlipayRequest -class AlipayCaptureRequest(AlipayRequest): +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AlipayCaptureRequest(AlipayRequest): def __init__(self): - super(AlipayCaptureRequest, self).__init__(AntomPathConstants.CAPTURE_PATH) - self.__capture_request_id = None - self.__payment_id = None + super(AlipayCaptureRequest, self).__init__("/ams/api/v1/payments/capture") + + self.__capture_request_id = None # type: str + self.__payment_id = None # type: str self.__capture_amount = None # type: Amount - self.__is_last_capture = None + self.__is_last_capture = None # type: bool + @property def capture_request_id(self): + """ + The unique ID that is assigned by the merchant to identify a capture request. Antom uses this field for idempotence control. More information: This field is an API idempotency field.For capture requests that are initiated with the same value of captureRequestId and reach a final status (S or F), the same result is to be returned for the request. Maximum length: 64 characters + """ return self.__capture_request_id @capture_request_id.setter def capture_request_id(self, value): self.__capture_request_id = value - @property def payment_id(self): + """ + The unique ID that is assigned by Antom to identify a payment. More information: Maximum length: 64 characters + """ return self.__payment_id @payment_id.setter def payment_id(self, value): self.__payment_id = value - @property def capture_amount(self): + """Gets the capture_amount of this AlipayCaptureRequest. + + """ return self.__capture_amount @capture_amount.setter def capture_amount(self, value): self.__capture_amount = value - @property def is_last_capture(self): + """Gets the is_last_capture of this AlipayCaptureRequest. + + """ return self.__is_last_capture @is_last_capture.setter def is_last_capture(self, value): self.__is_last_capture = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): - params = dict() - if hasattr(self, "payment_id") and self.payment_id: - params['paymentId'] = self.payment_id - if hasattr(self, "capture_request_id") and self.capture_request_id: + def to_ams_dict(self): + params = dict() + if hasattr(self, "capture_request_id") and self.capture_request_id is not None: params['captureRequestId'] = self.capture_request_id - - if hasattr(self, "capture_amount") and self.capture_amount: + if hasattr(self, "payment_id") and self.payment_id is not None: + params['paymentId'] = self.payment_id + if hasattr(self, "capture_amount") and self.capture_amount is not None: params['captureAmount'] = self.capture_amount - - if hasattr(self, "is_last_capture") and self.is_last_capture: + if hasattr(self, "is_last_capture") and self.is_last_capture is not None: params['isLastCapture'] = self.is_last_capture - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'captureRequestId' in response_body: + self.__capture_request_id = response_body['captureRequestId'] + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'captureAmount' in response_body: + self.__capture_amount = Amount() + self.__capture_amount.parse_rsp_body(response_body['captureAmount']) + if 'isLastCapture' in response_body: + self.__is_last_capture = response_body['isLastCapture'] diff --git a/com/alipay/ams/api/request/pay/alipay_inquiry_refund_request.py b/com/alipay/ams/api/request/pay/alipay_inquiry_refund_request.py new file mode 100644 index 0000000..cc47e9e --- /dev/null +++ b/com/alipay/ams/api/request/pay/alipay_inquiry_refund_request.py @@ -0,0 +1,72 @@ +import json + + + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AlipayInquiryRefundRequest(AlipayRequest): + def __init__(self): + super(AlipayInquiryRefundRequest, self).__init__("/ams/api/v1/payments/inquiryRefund") + + self.__refund_request_id = None # type: str + self.__refund_id = None # type: str + self.__merchant_account_id = None # type: str + + + @property + def refund_request_id(self): + """ + The unique ID assigned by a merchant to identify a refund request. refundRequestId and refundId cannot both be null. Special characters are not supported. If both refundRequestId and refundId are specified, refundId takes precedence. More information: Maximum length: 64 characters + """ + return self.__refund_request_id + + @refund_request_id.setter + def refund_request_id(self, value): + self.__refund_request_id = value + @property + def refund_id(self): + """ + The unique ID assigned by Antom to identify a refund. refundRequestId and refundId cannot both be null. A one-to-one correspondence between refundId and refundRequestId exists. If both refundRequestId and refundId are specified, refundId takes precedence. More information: Maximum length: 64 characters + """ + return self.__refund_id + + @refund_id.setter + def refund_id(self, value): + self.__refund_id = value + @property + def merchant_account_id(self): + """Gets the merchant_account_id of this AlipayInquiryRefundRequest. + + """ + return self.__merchant_account_id + + @merchant_account_id.setter + def merchant_account_id(self, value): + self.__merchant_account_id = value + + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + return json_str + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "refund_request_id") and self.refund_request_id is not None: + params['refundRequestId'] = self.refund_request_id + if hasattr(self, "refund_id") and self.refund_id is not None: + params['refundId'] = self.refund_id + if hasattr(self, "merchant_account_id") and self.merchant_account_id is not None: + params['merchantAccountId'] = self.merchant_account_id + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'refundRequestId' in response_body: + self.__refund_request_id = response_body['refundRequestId'] + if 'refundId' in response_body: + self.__refund_id = response_body['refundId'] + if 'merchantAccountId' in response_body: + self.__merchant_account_id = response_body['merchantAccountId'] diff --git a/com/alipay/ams/api/request/pay/alipay_pay_cancel_request.py b/com/alipay/ams/api/request/pay/alipay_pay_cancel_request.py index 7c53440..9dc5545 100644 --- a/com/alipay/ams/api/request/pay/alipay_pay_cancel_request.py +++ b/com/alipay/ams/api/request/pay/alipay_pay_cancel_request.py @@ -1,57 +1,72 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.request.alipay_request import AlipayRequest -class AlipayPayCancelRequest(AlipayRequest): +from com.alipay.ams.api.request.alipay_request import AlipayRequest +class AlipayPayCancelRequest(AlipayRequest): def __init__(self): - super(AlipayPayCancelRequest, self).__init__(AntomPathConstants.CANCEL_PATH) - self.__payment_id = None - self.__payment_request_id = None - self.__merchant_account_id = None + super(AlipayPayCancelRequest, self).__init__("/ams/api/v1/payments/cancel") + + self.__payment_id = None # type: str + self.__payment_request_id = None # type: str + self.__merchant_account_id = None # type: str + @property def payment_id(self): + """ + The original payment ID of the payment request to be canceled, generated by Antom to uniquely identify the payment when the merchant initiates the original payment. paymentId and paymentRequestId cannot both be null. A one-to-one correspondence between paymentId and paymentRequestId exists. More information: Maximum length: 64 characters + """ return self.__payment_id @payment_id.setter def payment_id(self, value): self.__payment_id = value - @property def payment_request_id(self): + """ + The original payment request ID of the payment request to be canceled, generated by the merchant to uniquely identify a payment request. paymentRequestId and paymentId cannot both be null. If both paymentRequestId and paymentId are provided, paymentId takes precedence. More information: Maximum length: 64 characters + """ return self.__payment_request_id @payment_request_id.setter def payment_request_id(self, value): self.__payment_request_id = value - @property def merchant_account_id(self): + """ + The unique ID to identify a merchant account. Note: Specify this parameter when you use a single client ID across multiple locations. More information: Maximum length: 32 characters + """ return self.__merchant_account_id @merchant_account_id.setter def merchant_account_id(self, value): self.__merchant_account_id = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, "payment_id") and self.payment_id: + if hasattr(self, "payment_id") and self.payment_id is not None: params['paymentId'] = self.payment_id - - if hasattr(self, "payment_request_id") and self.payment_request_id: + if hasattr(self, "payment_request_id") and self.payment_request_id is not None: params['paymentRequestId'] = self.payment_request_id - - if hasattr(self, "merchant_account_id") and self.merchant_account_id: + if hasattr(self, "merchant_account_id") and self.merchant_account_id is not None: params['merchantAccountId'] = self.merchant_account_id - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'paymentRequestId' in response_body: + self.__payment_request_id = response_body['paymentRequestId'] + if 'merchantAccountId' in response_body: + self.__merchant_account_id = response_body['merchantAccountId'] diff --git a/com/alipay/ams/api/request/pay/alipay_pay_consult_request.py b/com/alipay/ams/api/request/pay/alipay_pay_consult_request.py index 7bacdc2..624e2b9 100644 --- a/com/alipay/ams/api/request/pay/alipay_pay_consult_request.py +++ b/com/alipay/ams/api/request/pay/alipay_pay_consult_request.py @@ -1,244 +1,311 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - +from com.alipay.ams.api.model.product_code_type import ProductCodeType from com.alipay.ams.api.model.amount import Amount -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.model.buyer import Buyer from com.alipay.ams.api.model.env import Env -from com.alipay.ams.api.model.merchant import Merchant from com.alipay.ams.api.model.payment_factor import PaymentFactor -from com.alipay.ams.api.model.product_code_type import ProductCodeType from com.alipay.ams.api.model.settlement_strategy import SettlementStrategy -from com.alipay.ams.api.request.alipay_request import AlipayRequest +from com.alipay.ams.api.model.merchant import Merchant +from com.alipay.ams.api.model.buyer import Buyer -class AlipayPayConsultRequest(AlipayRequest): +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AlipayPayConsultRequest(AlipayRequest): def __init__(self): - super(AlipayPayConsultRequest, self).__init__(AntomPathConstants.CONSULT_PAYMENT_PATH) - self.__product_code = None # type:ProductCodeType - self.__payment_amount = None # type:Amount - self.__allowed_payment_methods = None - self.__blocked_payment_methods = None - self.__region = None - self.__customer_id = None - self.__reference_user_id = None - self.__env = None # type:Env - self.__extend_info = None - self.__user_region = None - self.__payment_factor = None # type:PaymentFactor - self.__settlement_strategy = None # type:SettlementStrategy - self.__merchant = None # type:Merchant - self.__allowed_psp_regions = None - self.__merchant_region = None - self.__merchant_account_id = None - self.__allowed_payment_method_regions = None - self.__buyer = None # type:Buyer + super(AlipayPayConsultRequest, self).__init__("/ams/api/v1/payments/consult") + + self.__product_code = None # type: ProductCodeType + self.__payment_amount = None # type: Amount + self.__merchant_region = None # type: str + self.__allowed_payment_method_regions = None # type: [str] + self.__allowed_payment_methods = None # type: [str] + self.__blocked_payment_methods = None # type: [str] + self.__region = None # type: str + self.__customer_id = None # type: str + self.__reference_user_id = None # type: str + self.__env = None # type: Env + self.__extend_info = None # type: str + self.__user_region = None # type: str + self.__payment_factor = None # type: PaymentFactor + self.__settlement_strategy = None # type: SettlementStrategy + self.__merchant = None # type: Merchant + self.__allowed_psp_regions = None # type: [str] + self.__buyer = None # type: Buyer + self.__merchant_account_id = None # type: str + @property def product_code(self): + """Gets the product_code of this AlipayPayConsultRequest. + + """ return self.__product_code @product_code.setter def product_code(self, value): self.__product_code = value - @property def payment_amount(self): + """Gets the payment_amount of this AlipayPayConsultRequest. + + """ return self.__payment_amount @payment_amount.setter def payment_amount(self, value): self.__payment_amount = value + @property + def merchant_region(self): + """ + The country or region where the merchant operates the business. The parameter is a 2-letter country or region code that follows ISO 3166 Country Codes standard. Some possible values are US, SG, HK, PK, JP, CN, BR, AU, and MY. Note: This parameter is required when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + """ + return self.__merchant_region + @merchant_region.setter + def merchant_region(self, value): + self.__merchant_region = value + @property + def allowed_payment_method_regions(self): + """ + A list of region codes that represent the countries or regions of payment methods. The value of this parameter is a 2-letter ISO country code or GLOBAL. Note: Specify this parameter if you want available payment methods from specific regions to be returned. For example, if you pass in GLOBAL, global cards Visa and Mastercard are returned. More information: Maximum length: 6 characters + """ + return self.__allowed_payment_method_regions + + @allowed_payment_method_regions.setter + def allowed_payment_method_regions(self, value): + self.__allowed_payment_method_regions = value @property def allowed_payment_methods(self): + """Gets the allowed_payment_methods of this AlipayPayConsultRequest. + + """ return self.__allowed_payment_methods @allowed_payment_methods.setter def allowed_payment_methods(self, value): self.__allowed_payment_methods = value - @property def blocked_payment_methods(self): + """Gets the blocked_payment_methods of this AlipayPayConsultRequest. + + """ return self.__blocked_payment_methods @blocked_payment_methods.setter def blocked_payment_methods(self, value): self.__blocked_payment_methods = value - @property def region(self): + """Gets the region of this AlipayPayConsultRequest. + + """ return self.__region @region.setter def region(self, value): self.__region = value - @property def customer_id(self): + """Gets the customer_id of this AlipayPayConsultRequest. + + """ return self.__customer_id @customer_id.setter def customer_id(self, value): self.__customer_id = value - @property def reference_user_id(self): + """Gets the reference_user_id of this AlipayPayConsultRequest. + + """ return self.__reference_user_id @reference_user_id.setter def reference_user_id(self, value): self.__reference_user_id = value - @property def env(self): + """Gets the env of this AlipayPayConsultRequest. + + """ return self.__env @env.setter def env(self, value): self.__env = value - @property def extend_info(self): + """Gets the extend_info of this AlipayPayConsultRequest. + + """ return self.__extend_info @extend_info.setter def extend_info(self, value): self.__extend_info = value - @property def user_region(self): + """ + The 2-letter country or region code. For more information, see ISO 3166 Country Codes standard. The payment methods will be sorted based on payment method relevance for the given user's region. More information: Maximum length: 2 characters + """ return self.__user_region @user_region.setter def user_region(self, value): self.__user_region = value - @property def payment_factor(self): + """Gets the payment_factor of this AlipayPayConsultRequest. + + """ return self.__payment_factor @payment_factor.setter def payment_factor(self, value): self.__payment_factor = value - @property def settlement_strategy(self): + """Gets the settlement_strategy of this AlipayPayConsultRequest. + + """ return self.__settlement_strategy @settlement_strategy.setter def settlement_strategy(self, value): self.__settlement_strategy = value - @property def merchant(self): + """Gets the merchant of this AlipayPayConsultRequest. + + """ return self.__merchant @merchant.setter def merchant(self, value): self.__merchant = value - @property def allowed_psp_regions(self): + """Gets the allowed_psp_regions of this AlipayPayConsultRequest. + + """ return self.__allowed_psp_regions @allowed_psp_regions.setter def allowed_psp_regions(self, value): self.__allowed_psp_regions = value - @property - def merchant_region(self): - return self.__merchant_region - - @merchant_region.setter - def merchant_region(self, value): - self.__merchant_region = value + def buyer(self): + """Gets the buyer of this AlipayPayConsultRequest. + + """ + return self.__buyer + @buyer.setter + def buyer(self, value): + self.__buyer = value @property def merchant_account_id(self): + """ + The unique ID to identify a merchant account. Note: Specify this parameter when you use a single client ID across multiple locations. More information: Maximum length: 32 characters + """ return self.__merchant_account_id @merchant_account_id.setter def merchant_account_id(self, value): self.__merchant_account_id = value - @property - def allowed_payment_method_regions(self): - return self.__allowed_payment_method_regions - - @allowed_payment_method_regions.setter - def allowed_payment_method_regions(self, value): - self.__allowed_payment_method_regions = value - @property - def buyer(self): - return self.__buyer - - @buyer.setter - def buyer(self, value): - self.__buyer = value - - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, "product_code") and self.product_code: + if hasattr(self, "product_code") and self.product_code is not None: params['productCode'] = self.product_code - - if hasattr(self, "payment_amount") and self.payment_amount: + if hasattr(self, "payment_amount") and self.payment_amount is not None: params['paymentAmount'] = self.payment_amount - - if hasattr(self, "allowed_payment_methods") and self.allowed_payment_methods: + if hasattr(self, "merchant_region") and self.merchant_region is not None: + params['merchantRegion'] = self.merchant_region + if hasattr(self, "allowed_payment_method_regions") and self.allowed_payment_method_regions is not None: + params['allowedPaymentMethodRegions'] = self.allowed_payment_method_regions + if hasattr(self, "allowed_payment_methods") and self.allowed_payment_methods is not None: params['allowedPaymentMethods'] = self.allowed_payment_methods - - if hasattr(self, "blocked_payment_methods") and self.blocked_payment_methods: + if hasattr(self, "blocked_payment_methods") and self.blocked_payment_methods is not None: params['blockedPaymentMethods'] = self.blocked_payment_methods - - if hasattr(self, "region") and self.region: + if hasattr(self, "region") and self.region is not None: params['region'] = self.region - - if hasattr(self, "customer_id") and self.customer_id: + if hasattr(self, "customer_id") and self.customer_id is not None: params['customerId'] = self.customer_id - - if hasattr(self, "reference_user_id") and self.reference_user_id: + if hasattr(self, "reference_user_id") and self.reference_user_id is not None: params['referenceUserId'] = self.reference_user_id - - if hasattr(self, "env") and self.env: + if hasattr(self, "env") and self.env is not None: params['env'] = self.env - - if hasattr(self, "extend_info") and self.extend_info: + if hasattr(self, "extend_info") and self.extend_info is not None: params['extendInfo'] = self.extend_info - - if hasattr(self, "user_region") and self.user_region: + if hasattr(self, "user_region") and self.user_region is not None: params['userRegion'] = self.user_region - - if hasattr(self, "payment_factor") and self.payment_factor: + if hasattr(self, "payment_factor") and self.payment_factor is not None: params['paymentFactor'] = self.payment_factor - - if hasattr(self, "settlement_strategy") and self.settlement_strategy: + if hasattr(self, "settlement_strategy") and self.settlement_strategy is not None: params['settlementStrategy'] = self.settlement_strategy - - if hasattr(self, "merchant") and self.merchant: + if hasattr(self, "merchant") and self.merchant is not None: params['merchant'] = self.merchant - - if hasattr(self, "allowed_psp_regions") and self.allowed_psp_regions: + if hasattr(self, "allowed_psp_regions") and self.allowed_psp_regions is not None: params['allowedPspRegions'] = self.allowed_psp_regions - - if hasattr(self, "merchant_region") and self.merchant_region: - params['merchantRegion'] = self.merchant_region - - if hasattr(self, "merchant_account_id") and self.merchant_account_id: + if hasattr(self, "buyer") and self.buyer is not None: + params['buyer'] = self.buyer + if hasattr(self, "merchant_account_id") and self.merchant_account_id is not None: params['merchantAccountId'] = self.merchant_account_id + return params - if hasattr(self, "allowed_payment_method_regions") and self.allowed_payment_method_regions: - params['allowedPaymentMethodRegions'] = self.allowed_payment_method_regions - if hasattr(self, "buyer") and self.buyer: - params['buyer'] = self.buyer - - return params + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'productCode' in response_body: + product_code_temp = ProductCodeType.value_of(response_body['productCode']) + self.__product_code = product_code_temp + if 'paymentAmount' in response_body: + self.__payment_amount = Amount() + self.__payment_amount.parse_rsp_body(response_body['paymentAmount']) + if 'merchantRegion' in response_body: + self.__merchant_region = response_body['merchantRegion'] + if 'allowedPaymentMethodRegions' in response_body: + self.__allowed_payment_method_regions = response_body['allowedPaymentMethodRegions'] + if 'allowedPaymentMethods' in response_body: + self.__allowed_payment_methods = response_body['allowedPaymentMethods'] + if 'blockedPaymentMethods' in response_body: + self.__blocked_payment_methods = response_body['blockedPaymentMethods'] + if 'region' in response_body: + self.__region = response_body['region'] + if 'customerId' in response_body: + self.__customer_id = response_body['customerId'] + if 'referenceUserId' in response_body: + self.__reference_user_id = response_body['referenceUserId'] + if 'env' in response_body: + self.__env = Env() + self.__env.parse_rsp_body(response_body['env']) + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'userRegion' in response_body: + self.__user_region = response_body['userRegion'] + if 'paymentFactor' in response_body: + self.__payment_factor = PaymentFactor() + self.__payment_factor.parse_rsp_body(response_body['paymentFactor']) + if 'settlementStrategy' in response_body: + self.__settlement_strategy = SettlementStrategy() + self.__settlement_strategy.parse_rsp_body(response_body['settlementStrategy']) + if 'merchant' in response_body: + self.__merchant = Merchant() + self.__merchant.parse_rsp_body(response_body['merchant']) + if 'allowedPspRegions' in response_body: + self.__allowed_psp_regions = response_body['allowedPspRegions'] + if 'buyer' in response_body: + self.__buyer = Buyer() + self.__buyer.parse_rsp_body(response_body['buyer']) + if 'merchantAccountId' in response_body: + self.__merchant_account_id = response_body['merchantAccountId'] diff --git a/com/alipay/ams/api/request/pay/alipay_pay_query_request.py b/com/alipay/ams/api/request/pay/alipay_pay_query_request.py index c4f7497..a4cb66e 100644 --- a/com/alipay/ams/api/request/pay/alipay_pay_query_request.py +++ b/com/alipay/ams/api/request/pay/alipay_pay_query_request.py @@ -1,39 +1,43 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.request.alipay_request import AlipayRequest -class AlipayPayQueryRequest(AlipayRequest): +from com.alipay.ams.api.request.alipay_request import AlipayRequest +class AlipayPayQueryRequest(AlipayRequest): def __init__(self): - super(AlipayPayQueryRequest, self).__init__(AntomPathConstants.INQUIRY_PAYMENT_PATH) - self.__payment_id = None - self.__payment_request_id = None - self.__merchant_account_id = None - - - @property - def payment_id(self): - return self.__payment_id + super(AlipayPayQueryRequest, self).__init__("/ams/api/v1/payments/inquiryPayment") - @payment_id.setter - def payment_id(self, value): - self.__payment_id = value + self.__payment_request_id = None # type: str + self.__payment_id = None # type: str + self.__merchant_account_id = None # type: str + @property def payment_request_id(self): + """ + The unique ID that is assigned by a merchant to identify a payment request. paymentRequestId and paymentId cannot both be null. If both paymentRequestId and paymentId are specified, paymentId takes precedence. More information: Maximum length: 64 characters + """ return self.__payment_request_id @payment_request_id.setter def payment_request_id(self, value): self.__payment_request_id = value + @property + def payment_id(self): + """ + The unique ID that is assigned by Antom to identify a payment. paymentRequestId and paymentId cannot both be null. A one-to-one correspondence between paymentId and paymentRequestId exists. If both paymentRequestId and paymentId are specified, paymentId takes precedence. More information: Maximum length: 64 characters + """ + return self.__payment_id + @payment_id.setter + def payment_id(self, value): + self.__payment_id = value @property def merchant_account_id(self): + """ + The unique ID to identify a merchant account. Note: Specify this parameter when you use a single client ID across multiple locations. More information: Maximum length: 32 characters + """ return self.__merchant_account_id @merchant_account_id.setter @@ -41,20 +45,28 @@ def merchant_account_id(self, value): self.__merchant_account_id = value - # 将对象转换为json字符串 - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), indent=3) + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): - params = dict() - if hasattr(self, "payment_id") and self.payment_id: - params['paymentId'] = self.payment_id - if hasattr(self, "payment_request_id") and self.payment_request_id: + def to_ams_dict(self): + params = dict() + if hasattr(self, "payment_request_id") and self.payment_request_id is not None: params['paymentRequestId'] = self.payment_request_id - - if hasattr(self, "merchant_account_id") and self.merchant_account_id: + if hasattr(self, "payment_id") and self.payment_id is not None: + params['paymentId'] = self.payment_id + if hasattr(self, "merchant_account_id") and self.merchant_account_id is not None: params['merchantAccountId'] = self.merchant_account_id - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'paymentRequestId' in response_body: + self.__payment_request_id = response_body['paymentRequestId'] + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'merchantAccountId' in response_body: + self.__merchant_account_id = response_body['merchantAccountId'] diff --git a/com/alipay/ams/api/request/pay/alipay_pay_request.py b/com/alipay/ams/api/request/pay/alipay_pay_request.py index ab552aa..b8657bd 100644 --- a/com/alipay/ams/api/request/pay/alipay_pay_request.py +++ b/com/alipay/ams/api/request/pay/alipay_pay_request.py @@ -1,282 +1,379 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - +from com.alipay.ams.api.model.product_code_type import ProductCodeType +from com.alipay.ams.api.model.order import Order from com.alipay.ams.api.model.amount import Amount -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants +from com.alipay.ams.api.model.payment_method import PaymentMethod +from com.alipay.ams.api.model.payment_factor import PaymentFactor +from com.alipay.ams.api.model.settlement_strategy import SettlementStrategy from com.alipay.ams.api.model.credit_pay_plan import CreditPayPlan from com.alipay.ams.api.model.env import Env -from com.alipay.ams.api.model.order import Order -from com.alipay.ams.api.model.payment_factor import PaymentFactor from com.alipay.ams.api.model.payment_method import PaymentMethod -from com.alipay.ams.api.model.product_code_type import ProductCodeType -from com.alipay.ams.api.model.settlement_strategy import SettlementStrategy -from com.alipay.ams.api.model.subscription_info import SubscriptionInfo -from com.alipay.ams.api.request.alipay_request import AlipayRequest +from com.alipay.ams.api.model.merchant import Merchant +from com.alipay.ams.api.model.payment_verification_data import PaymentVerificationData -class AlipayPayRequest(AlipayRequest): +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AlipayPayRequest(AlipayRequest): def __init__(self): - super(AlipayPayRequest, self).__init__(AntomPathConstants.PAYMENT_PATH) + super(AlipayPayRequest, self).__init__("/ams/api/v1/payments/pay") + self.__product_code = None # type: ProductCodeType - self.__payment_request_id = None + self.__payment_request_id = None # type: str self.__order = None # type: Order self.__payment_amount = None # type: Amount - self.__pay_to_method = None # type: PaymentMethod self.__payment_method = None # type: PaymentMethod - self.__payment_expiry_time = None - self.__payment_redirect_url = None - self.__payment_notify_url = None - self.__is_authorization = None - self.__payment_verification_data = None + self.__payment_expiry_time = None # type: str + self.__payment_redirect_url = None # type: str + self.__payment_notify_url = None # type: str self.__payment_factor = None # type: PaymentFactor self.__settlement_strategy = None # type: SettlementStrategy - self.__extend_info = None - self.__env = None # type: Env - self.__merchant_region = None - self.__app_id = None - self.__merchant_account_id = None - self.__user_region = None self.__credit_pay_plan = None # type: CreditPayPlan - self.__subscription_info = None # type: SubscriptionInfo - - @property - def merchant_region(self): - return self.__merchant_region - - @merchant_region.setter - def merchant_region(self, value): - self.__merchant_region = value - - @property - def app_id(self): - return self.__app_id - - @app_id.setter - def app_id(self, value): - self.__app_id = value + self.__app_id = None # type: str + self.__merchant_region = None # type: str + self.__user_region = None # type: str + self.__env = None # type: Env + self.__pay_to_method = None # type: PaymentMethod + self.__is_authorization = None # type: bool + self.__merchant = None # type: Merchant + self.__payment_verification_data = None # type: PaymentVerificationData + self.__extend_info = None # type: str + self.__merchant_account_id = None # type: str + self.__dual_offline_payment = None # type: bool + @property def product_code(self): + """Gets the product_code of this AlipayPayRequest. + + """ return self.__product_code @product_code.setter def product_code(self, value): self.__product_code = value - @property def payment_request_id(self): + """ + The unique ID assigned by a merchant to identify a payment request. Antom uses this field for idempotence control. More information: This field is an API idempotency field.For payment requests that are initiated with the same value of paymentRequestId and reach a final status of S or F, the same result is to be returned for the request. Maximum length: 64 characters + """ return self.__payment_request_id @payment_request_id.setter def payment_request_id(self, value): self.__payment_request_id = value - @property def order(self): + """Gets the order of this AlipayPayRequest. + + """ return self.__order @order.setter def order(self, value): self.__order = value - @property def payment_amount(self): + """Gets the payment_amount of this AlipayPayRequest. + + """ return self.__payment_amount @payment_amount.setter def payment_amount(self, value): self.__payment_amount = value - - @property - def pay_to_method(self): - return self.__pay_to_method - - @pay_to_method.setter - def pay_to_method(self, value): - self.__pay_to_method = value - @property def payment_method(self): + """Gets the payment_method of this AlipayPayRequest. + + """ return self.__payment_method @payment_method.setter def payment_method(self, value): self.__payment_method = value - @property def payment_expiry_time(self): + """ + The payment expiration time is a specific time after which the payment will expire and the acquirer or merchant must terminate the order processing. Notes: For bank transfer payments, the default payment expiration time is 48 hours after the payment request is sent. For other payment categories, the default payment expiration time is usually 14 minutes after the payment request is sent. For example, if the request is sent on 2019-11-27T12:00:01+08:30, the payment expiration time is 2019-11-27T12:14:01+08:30. Specify this field if you want to use a payment expiration time that differs from the default time. For bank transfer payments, the specified payment expiration time must be less than 48 hours after the payment request is sent. For other payment categories, the specified payment expiration time must be less than 10 minutes after the payment request is sent. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__payment_expiry_time @payment_expiry_time.setter def payment_expiry_time(self, value): self.__payment_expiry_time = value - @property def payment_redirect_url(self): + """ + The merchant page URL that the user is redirected to after the payment is completed. More information: Maximum length: 2048 characters + """ return self.__payment_redirect_url @payment_redirect_url.setter def payment_redirect_url(self, value): self.__payment_redirect_url = value - @property def payment_notify_url(self): + """ + The URL that is used to receive the payment result notification. Note: Specify this parameter if you want to receive an asynchronous notification of the payment result. You can also set the URL to receive the result notification in Antom Dashboard. If the URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence. More information: Maximum length: 2048 characters + """ return self.__payment_notify_url @payment_notify_url.setter def payment_notify_url(self, value): self.__payment_notify_url = value - - @property - def is_authorization(self): - return self.__is_authorization - - @is_authorization.setter - def is_authorization(self, value): - self.__is_authorization = value - - @property - def payment_verification_data(self): - return self.__payment_verification_data - - @payment_verification_data.setter - def payment_verification_data(self, value): - self.__payment_verification_data = value - @property def payment_factor(self): + """Gets the payment_factor of this AlipayPayRequest. + + """ return self.__payment_factor @payment_factor.setter def payment_factor(self, value): self.__payment_factor = value - @property def settlement_strategy(self): + """Gets the settlement_strategy of this AlipayPayRequest. + + """ return self.__settlement_strategy @settlement_strategy.setter def settlement_strategy(self, value): self.__settlement_strategy = value + @property + def credit_pay_plan(self): + """Gets the credit_pay_plan of this AlipayPayRequest. + + """ + return self.__credit_pay_plan + @credit_pay_plan.setter + def credit_pay_plan(self, value): + self.__credit_pay_plan = value @property - def extend_info(self): - return self.__extend_info + def app_id(self): + """ + The unique ID that is assigned by Antom to identify the mini program. Note: This field is required when terminalType is MINI_APP. More information: Maximum length: 32 characters + """ + return self.__app_id - @extend_info.setter - def extend_info(self, value): - self.__extend_info = value + @app_id.setter + def app_id(self, value): + self.__app_id = value + @property + def merchant_region(self): + """ + The country or region where the merchant operates the business. The parameter is a 2-letter country or region code that follows ISO 3166 Country Codes standard. Some possible values are US, SG, HK, PK, JP, CN, BR, AU, and MY. Note: This parameter is required when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + """ + return self.__merchant_region + @merchant_region.setter + def merchant_region(self, value): + self.__merchant_region = value + @property + def user_region(self): + """ + A 2-letter country or region code based on the standard of ISO 3166 Country Codes. This parameter is used to sort Alipay+ payment methods according to the user's region. For example, if ALIPAY_CN and KAKAOPAYare both on your payment method list and the user is from South Korea, KAKAOPAY will be listed first on the Alipay+ cashier page. Note: This parameter is only for the merchant that has integrated the Alipay+ cashier page. More information: Maximum length: 2 characters + """ + return self.__user_region + + @user_region.setter + def user_region(self, value): + self.__user_region = value @property def env(self): + """Gets the env of this AlipayPayRequest. + + """ return self.__env @env.setter def env(self, value): self.__env = value + @property + def pay_to_method(self): + """Gets the pay_to_method of this AlipayPayRequest. + + """ + return self.__pay_to_method + @pay_to_method.setter + def pay_to_method(self, value): + self.__pay_to_method = value + @property + def is_authorization(self): + """Gets the is_authorization of this AlipayPayRequest. + + """ + return self.__is_authorization + + @is_authorization.setter + def is_authorization(self, value): + self.__is_authorization = value + @property + def merchant(self): + """Gets the merchant of this AlipayPayRequest. + + """ + return self.__merchant + + @merchant.setter + def merchant(self, value): + self.__merchant = value + @property + def payment_verification_data(self): + """Gets the payment_verification_data of this AlipayPayRequest. + + """ + return self.__payment_verification_data + + @payment_verification_data.setter + def payment_verification_data(self, value): + self.__payment_verification_data = value + @property + def extend_info(self): + """Gets the extend_info of this AlipayPayRequest. + + """ + return self.__extend_info + + @extend_info.setter + def extend_info(self, value): + self.__extend_info = value @property def merchant_account_id(self): + """ + The unique ID to identify a merchant account. Note: Specify this parameter when you use a single client ID across multiple locations. More information: Maximum length: 32 characters + """ return self.__merchant_account_id @merchant_account_id.setter def merchant_account_id(self, value): self.__merchant_account_id = value - - @property - def user_region(self): - return self.__user_region - - @user_region.setter - def user_region(self, value): - self.__user_region = value - @property - def credit_pay_plan(self): - return self.__credit_pay_plan - - @credit_pay_plan.setter - def credit_pay_plan(self, value): - self.__credit_pay_plan = value + def dual_offline_payment(self): + """Gets the dual_offline_payment of this AlipayPayRequest. + + """ + return self.__dual_offline_payment - @property - def subscription_info(self): - return self.__subscription_info + @dual_offline_payment.setter + def dual_offline_payment(self, value): + self.__dual_offline_payment = value - @subscription_info.setter - def subscription_info(self, value): - self.__subscription_info = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, "product_code") and self.product_code: + if hasattr(self, "product_code") and self.product_code is not None: params['productCode'] = self.product_code - - if hasattr(self, "payment_request_id") and self.payment_request_id: + if hasattr(self, "payment_request_id") and self.payment_request_id is not None: params['paymentRequestId'] = self.payment_request_id - - if hasattr(self, "order") and self.order: + if hasattr(self, "order") and self.order is not None: params['order'] = self.order - - if hasattr(self, "payment_amount") and self.payment_amount: + if hasattr(self, "payment_amount") and self.payment_amount is not None: params['paymentAmount'] = self.payment_amount - - if hasattr(self, "pay_to_method") and self.pay_to_method: - params['payToMethod'] = self.pay_to_method - - if hasattr(self, "payment_method") and self.payment_method: + if hasattr(self, "payment_method") and self.payment_method is not None: params['paymentMethod'] = self.payment_method - - if hasattr(self, "payment_expiry_time") and self.payment_expiry_time: + if hasattr(self, "payment_expiry_time") and self.payment_expiry_time is not None: params['paymentExpiryTime'] = self.payment_expiry_time - - if hasattr(self, "payment_redirect_url") and self.payment_redirect_url: + if hasattr(self, "payment_redirect_url") and self.payment_redirect_url is not None: params['paymentRedirectUrl'] = self.payment_redirect_url - - if hasattr(self, "payment_notify_url") and self.payment_notify_url: + if hasattr(self, "payment_notify_url") and self.payment_notify_url is not None: params['paymentNotifyUrl'] = self.payment_notify_url - - if hasattr(self, "is_authorization") and self.is_authorization: - params['isAuthorization'] = self.is_authorization - - if hasattr(self, "payment_verification_data") and self.payment_verification_data: - params['paymentVerificationData'] = self.payment_verification_data - - if hasattr(self, "payment_factor") and self.payment_factor: + if hasattr(self, "payment_factor") and self.payment_factor is not None: params['paymentFactor'] = self.payment_factor - - if hasattr(self, "settlement_strategy") and self.settlement_strategy: + if hasattr(self, "settlement_strategy") and self.settlement_strategy is not None: params['settlementStrategy'] = self.settlement_strategy - - if hasattr(self, "extend_info") and self.extend_info: - params['extendInfo'] = self.extend_info - - if hasattr(self, "env") and self.env: - params['env'] = self.env - - if hasattr(self, "merchant_region") and self.merchant_region: - params['merchantRegion'] = self.merchant_region - - if hasattr(self, "app_id") and self.app_id: + if hasattr(self, "credit_pay_plan") and self.credit_pay_plan is not None: + params['creditPayPlan'] = self.credit_pay_plan + if hasattr(self, "app_id") and self.app_id is not None: params['appId'] = self.app_id - - if hasattr(self, "merchant_account_id") and self.merchant_account_id: - params['merchantAccountId'] = self.merchant_account_id - - if hasattr(self, "user_region") and self.user_region: + if hasattr(self, "merchant_region") and self.merchant_region is not None: + params['merchantRegion'] = self.merchant_region + if hasattr(self, "user_region") and self.user_region is not None: params['userRegion'] = self.user_region + if hasattr(self, "env") and self.env is not None: + params['env'] = self.env + if hasattr(self, "pay_to_method") and self.pay_to_method is not None: + params['payToMethod'] = self.pay_to_method + if hasattr(self, "is_authorization") and self.is_authorization is not None: + params['isAuthorization'] = self.is_authorization + if hasattr(self, "merchant") and self.merchant is not None: + params['merchant'] = self.merchant + if hasattr(self, "payment_verification_data") and self.payment_verification_data is not None: + params['paymentVerificationData'] = self.payment_verification_data + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + if hasattr(self, "merchant_account_id") and self.merchant_account_id is not None: + params['merchantAccountId'] = self.merchant_account_id + if hasattr(self, "dual_offline_payment") and self.dual_offline_payment is not None: + params['dualOfflinePayment'] = self.dual_offline_payment + return params - if hasattr(self, "credit_pay_plan") and self.credit_pay_plan: - params['creditPayPlan'] = self.credit_pay_plan - - if hasattr(self, "subscription_info") and self.subscription_info: - params['subscriptionInfo'] = self.subscription_info - return params + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'productCode' in response_body: + product_code_temp = ProductCodeType.value_of(response_body['productCode']) + self.__product_code = product_code_temp + if 'paymentRequestId' in response_body: + self.__payment_request_id = response_body['paymentRequestId'] + if 'order' in response_body: + self.__order = Order() + self.__order.parse_rsp_body(response_body['order']) + if 'paymentAmount' in response_body: + self.__payment_amount = Amount() + self.__payment_amount.parse_rsp_body(response_body['paymentAmount']) + if 'paymentMethod' in response_body: + self.__payment_method = PaymentMethod() + self.__payment_method.parse_rsp_body(response_body['paymentMethod']) + if 'paymentExpiryTime' in response_body: + self.__payment_expiry_time = response_body['paymentExpiryTime'] + if 'paymentRedirectUrl' in response_body: + self.__payment_redirect_url = response_body['paymentRedirectUrl'] + if 'paymentNotifyUrl' in response_body: + self.__payment_notify_url = response_body['paymentNotifyUrl'] + if 'paymentFactor' in response_body: + self.__payment_factor = PaymentFactor() + self.__payment_factor.parse_rsp_body(response_body['paymentFactor']) + if 'settlementStrategy' in response_body: + self.__settlement_strategy = SettlementStrategy() + self.__settlement_strategy.parse_rsp_body(response_body['settlementStrategy']) + if 'creditPayPlan' in response_body: + self.__credit_pay_plan = CreditPayPlan() + self.__credit_pay_plan.parse_rsp_body(response_body['creditPayPlan']) + if 'appId' in response_body: + self.__app_id = response_body['appId'] + if 'merchantRegion' in response_body: + self.__merchant_region = response_body['merchantRegion'] + if 'userRegion' in response_body: + self.__user_region = response_body['userRegion'] + if 'env' in response_body: + self.__env = Env() + self.__env.parse_rsp_body(response_body['env']) + if 'payToMethod' in response_body: + self.__pay_to_method = PaymentMethod() + self.__pay_to_method.parse_rsp_body(response_body['payToMethod']) + if 'isAuthorization' in response_body: + self.__is_authorization = response_body['isAuthorization'] + if 'merchant' in response_body: + self.__merchant = Merchant() + self.__merchant.parse_rsp_body(response_body['merchant']) + if 'paymentVerificationData' in response_body: + self.__payment_verification_data = PaymentVerificationData() + self.__payment_verification_data.parse_rsp_body(response_body['paymentVerificationData']) + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'merchantAccountId' in response_body: + self.__merchant_account_id = response_body['merchantAccountId'] + if 'dualOfflinePayment' in response_body: + self.__dual_offline_payment = response_body['dualOfflinePayment'] diff --git a/com/alipay/ams/api/request/pay/alipay_payment_session_request.py b/com/alipay/ams/api/request/pay/alipay_payment_session_request.py new file mode 100644 index 0000000..6362bfb --- /dev/null +++ b/com/alipay/ams/api/request/pay/alipay_payment_session_request.py @@ -0,0 +1,369 @@ +import json +from com.alipay.ams.api.model.product_code_type import ProductCodeType +from com.alipay.ams.api.model.order import Order +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.payment_method import PaymentMethod +from com.alipay.ams.api.model.payment_factor import PaymentFactor +from com.alipay.ams.api.model.settlement_strategy import SettlementStrategy +from com.alipay.ams.api.model.credit_pay_plan import CreditPayPlan +from com.alipay.ams.api.model.env import Env +from com.alipay.ams.api.model.agreement_info import AgreementInfo +from com.alipay.ams.api.model.risk_data import RiskData +from com.alipay.ams.api.model.payment_method import PaymentMethod +from com.alipay.ams.api.model.available_payment_method import AvailablePaymentMethod + + + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AlipayPaymentSessionRequest(AlipayRequest): + def __init__(self): + super(AlipayPaymentSessionRequest, self).__init__("/ams/api/v1/payments/createPaymentSession") + + self.__product_code = None # type: ProductCodeType + self.__payment_request_id = None # type: str + self.__order = None # type: Order + self.__payment_amount = None # type: Amount + self.__payment_method = None # type: PaymentMethod + self.__payment_session_expiry_time = None # type: str + self.__payment_redirect_url = None # type: str + self.__payment_notify_url = None # type: str + self.__payment_factor = None # type: PaymentFactor + self.__settlement_strategy = None # type: SettlementStrategy + self.__enable_installment_collection = None # type: bool + self.__credit_pay_plan = None # type: CreditPayPlan + self.__merchant_region = None # type: str + self.__env = None # type: Env + self.__agreement_info = None # type: AgreementInfo + self.__risk_data = None # type: RiskData + self.__product_scene = None # type: str + self.__saved_payment_methods = None # type: [PaymentMethod] + self.__locale = None # type: str + self.__available_payment_method = None # type: AvailablePaymentMethod + self.__test_file = None # type: str + + + @property + def product_code(self): + """Gets the product_code of this AlipayPaymentSessionRequest. + + """ + return self.__product_code + + @product_code.setter + def product_code(self, value): + self.__product_code = value + @property + def payment_request_id(self): + """ + The unique ID assigned by a merchant to identify a payment request. More information: Maximum length: 64 characters + """ + return self.__payment_request_id + + @payment_request_id.setter + def payment_request_id(self, value): + self.__payment_request_id = value + @property + def order(self): + """Gets the order of this AlipayPaymentSessionRequest. + + """ + return self.__order + + @order.setter + def order(self, value): + self.__order = value + @property + def payment_amount(self): + """Gets the payment_amount of this AlipayPaymentSessionRequest. + + """ + return self.__payment_amount + + @payment_amount.setter + def payment_amount(self, value): + self.__payment_amount = value + @property + def payment_method(self): + """Gets the payment_method of this AlipayPaymentSessionRequest. + + """ + return self.__payment_method + + @payment_method.setter + def payment_method(self, value): + self.__payment_method = value + @property + def payment_session_expiry_time(self): + """ + The specific date and time after which the payment session will expire. The default expiration time is 1 hour after the session creation. For example, if the session is created at 2023-7-27T12:00:01+08:30, the session expiration time is 2023-7-27T13:00:01+08:30. Specify this parameter if you want to use a payment session expiration time that differs from the default time. The specified expiration time must be 0 to 1 hour after session creation. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ + return self.__payment_session_expiry_time + + @payment_session_expiry_time.setter + def payment_session_expiry_time(self, value): + self.__payment_session_expiry_time = value + @property + def payment_redirect_url(self): + """ + The merchant page URL that the user is redirected to after the payment is completed. More information: Maximum length: 2048 characters + """ + return self.__payment_redirect_url + + @payment_redirect_url.setter + def payment_redirect_url(self, value): + self.__payment_redirect_url = value + @property + def payment_notify_url(self): + """ + The URL that is used to receive the payment result notification. Specify this parameter if you want to receive an asynchronous notification of the payment result. You can also set the URL to receive the result notification in Antom Dashboard. If the URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence. More information: Maximum length: 2048 characters + """ + return self.__payment_notify_url + + @payment_notify_url.setter + def payment_notify_url(self, value): + self.__payment_notify_url = value + @property + def payment_factor(self): + """Gets the payment_factor of this AlipayPaymentSessionRequest. + + """ + return self.__payment_factor + + @payment_factor.setter + def payment_factor(self, value): + self.__payment_factor = value + @property + def settlement_strategy(self): + """Gets the settlement_strategy of this AlipayPaymentSessionRequest. + + """ + return self.__settlement_strategy + + @settlement_strategy.setter + def settlement_strategy(self, value): + self.__settlement_strategy = value + @property + def enable_installment_collection(self): + """ + Indicates whether Antom collects the installment information for the payment. Specify this parameter if you need Antom to collect the installment information. Valid values are: true: indicates Antom collects installment information when the user's card supports installments. Installments are not available when the user's card does not support installments. false: indicates you do not need Antom to collect the installment information. The same applies when the value is empty or you do not specify this parameter. + """ + return self.__enable_installment_collection + + @enable_installment_collection.setter + def enable_installment_collection(self, value): + self.__enable_installment_collection = value + @property + def credit_pay_plan(self): + """Gets the credit_pay_plan of this AlipayPaymentSessionRequest. + + """ + return self.__credit_pay_plan + + @credit_pay_plan.setter + def credit_pay_plan(self, value): + self.__credit_pay_plan = value + @property + def merchant_region(self): + """ + The country or region where the merchant operates the business. The parameter is a 2-letter country or region code that follows ISO 3166 Country Codes standard. Some possible values are US, SG, HK, PK, JP, CN, BR, AU, and MY. Note: This parameter is required when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + """ + return self.__merchant_region + + @merchant_region.setter + def merchant_region(self, value): + self.__merchant_region = value + @property + def env(self): + """Gets the env of this AlipayPaymentSessionRequest. + + """ + return self.__env + + @env.setter + def env(self, value): + self.__env = value + @property + def agreement_info(self): + """Gets the agreement_info of this AlipayPaymentSessionRequest. + + """ + return self.__agreement_info + + @agreement_info.setter + def agreement_info(self, value): + self.__agreement_info = value + @property + def risk_data(self): + """Gets the risk_data of this AlipayPaymentSessionRequest. + + """ + return self.__risk_data + + @risk_data.setter + def risk_data(self, value): + self.__risk_data = value + @property + def product_scene(self): + """ + Specified product scenarios include valid values: ​CHECKOUT_PAYMENT​: Indicates that the merchant integrates using the Checkout Page. ​ELEMENT_PAYMENT​: Indicates that the merchant integrates using the Element. More information: Maximum length: 32 characters + """ + return self.__product_scene + + @product_scene.setter + def product_scene(self, value): + self.__product_scene = value + @property + def saved_payment_methods(self): + """ + Payment information stored by the user in the merchant system. + """ + return self.__saved_payment_methods + + @saved_payment_methods.setter + def saved_payment_methods(self, value): + self.__saved_payment_methods = value + @property + def locale(self): + """ + Language tag specified for the Checkout Page. If this field is empty or set to automatic, the default language setting of the browser will be used, which is usually English. More information: Maximum length: 8 characters + """ + return self.__locale + + @locale.setter + def locale(self, value): + self.__locale = value + @property + def available_payment_method(self): + """Gets the available_payment_method of this AlipayPaymentSessionRequest. + + """ + return self.__available_payment_method + + @available_payment_method.setter + def available_payment_method(self, value): + self.__available_payment_method = value + @property + def test_file(self): + """Gets the test_file of this AlipayPaymentSessionRequest. + + """ + return self.__test_file + + @test_file.setter + def test_file(self, value): + self.__test_file = value + + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + return json_str + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "product_code") and self.product_code is not None: + params['productCode'] = self.product_code + if hasattr(self, "payment_request_id") and self.payment_request_id is not None: + params['paymentRequestId'] = self.payment_request_id + if hasattr(self, "order") and self.order is not None: + params['order'] = self.order + if hasattr(self, "payment_amount") and self.payment_amount is not None: + params['paymentAmount'] = self.payment_amount + if hasattr(self, "payment_method") and self.payment_method is not None: + params['paymentMethod'] = self.payment_method + if hasattr(self, "payment_session_expiry_time") and self.payment_session_expiry_time is not None: + params['paymentSessionExpiryTime'] = self.payment_session_expiry_time + if hasattr(self, "payment_redirect_url") and self.payment_redirect_url is not None: + params['paymentRedirectUrl'] = self.payment_redirect_url + if hasattr(self, "payment_notify_url") and self.payment_notify_url is not None: + params['paymentNotifyUrl'] = self.payment_notify_url + if hasattr(self, "payment_factor") and self.payment_factor is not None: + params['paymentFactor'] = self.payment_factor + if hasattr(self, "settlement_strategy") and self.settlement_strategy is not None: + params['settlementStrategy'] = self.settlement_strategy + if hasattr(self, "enable_installment_collection") and self.enable_installment_collection is not None: + params['enableInstallmentCollection'] = self.enable_installment_collection + if hasattr(self, "credit_pay_plan") and self.credit_pay_plan is not None: + params['creditPayPlan'] = self.credit_pay_plan + if hasattr(self, "merchant_region") and self.merchant_region is not None: + params['merchantRegion'] = self.merchant_region + if hasattr(self, "env") and self.env is not None: + params['env'] = self.env + if hasattr(self, "agreement_info") and self.agreement_info is not None: + params['agreementInfo'] = self.agreement_info + if hasattr(self, "risk_data") and self.risk_data is not None: + params['riskData'] = self.risk_data + if hasattr(self, "product_scene") and self.product_scene is not None: + params['productScene'] = self.product_scene + if hasattr(self, "saved_payment_methods") and self.saved_payment_methods is not None: + params['savedPaymentMethods'] = self.saved_payment_methods + if hasattr(self, "locale") and self.locale is not None: + params['locale'] = self.locale + if hasattr(self, "available_payment_method") and self.available_payment_method is not None: + params['availablePaymentMethod'] = self.available_payment_method + if hasattr(self, "test_file") and self.test_file is not None: + params['testFile'] = self.test_file + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'productCode' in response_body: + product_code_temp = ProductCodeType.value_of(response_body['productCode']) + self.__product_code = product_code_temp + if 'paymentRequestId' in response_body: + self.__payment_request_id = response_body['paymentRequestId'] + if 'order' in response_body: + self.__order = Order() + self.__order.parse_rsp_body(response_body['order']) + if 'paymentAmount' in response_body: + self.__payment_amount = Amount() + self.__payment_amount.parse_rsp_body(response_body['paymentAmount']) + if 'paymentMethod' in response_body: + self.__payment_method = PaymentMethod() + self.__payment_method.parse_rsp_body(response_body['paymentMethod']) + if 'paymentSessionExpiryTime' in response_body: + self.__payment_session_expiry_time = response_body['paymentSessionExpiryTime'] + if 'paymentRedirectUrl' in response_body: + self.__payment_redirect_url = response_body['paymentRedirectUrl'] + if 'paymentNotifyUrl' in response_body: + self.__payment_notify_url = response_body['paymentNotifyUrl'] + if 'paymentFactor' in response_body: + self.__payment_factor = PaymentFactor() + self.__payment_factor.parse_rsp_body(response_body['paymentFactor']) + if 'settlementStrategy' in response_body: + self.__settlement_strategy = SettlementStrategy() + self.__settlement_strategy.parse_rsp_body(response_body['settlementStrategy']) + if 'enableInstallmentCollection' in response_body: + self.__enable_installment_collection = response_body['enableInstallmentCollection'] + if 'creditPayPlan' in response_body: + self.__credit_pay_plan = CreditPayPlan() + self.__credit_pay_plan.parse_rsp_body(response_body['creditPayPlan']) + if 'merchantRegion' in response_body: + self.__merchant_region = response_body['merchantRegion'] + if 'env' in response_body: + self.__env = Env() + self.__env.parse_rsp_body(response_body['env']) + if 'agreementInfo' in response_body: + self.__agreement_info = AgreementInfo() + self.__agreement_info.parse_rsp_body(response_body['agreementInfo']) + if 'riskData' in response_body: + self.__risk_data = RiskData() + self.__risk_data.parse_rsp_body(response_body['riskData']) + if 'productScene' in response_body: + self.__product_scene = response_body['productScene'] + if 'savedPaymentMethods' in response_body: + self.__saved_payment_methods = [] + for item in response_body['savedPaymentMethods']: + obj = PaymentMethod() + obj.parse_rsp_body(item) + self.__saved_payment_methods.append(obj) + if 'locale' in response_body: + self.__locale = response_body['locale'] + if 'availablePaymentMethod' in response_body: + self.__available_payment_method = AvailablePaymentMethod() + self.__available_payment_method.parse_rsp_body(response_body['availablePaymentMethod']) + if 'testFile' in response_body: + self.__test_file = response_body['testFile'] diff --git a/com/alipay/ams/api/request/pay/alipay_refund_request.py b/com/alipay/ams/api/request/pay/alipay_refund_request.py index 49a63e3..9b1d2bb 100644 --- a/com/alipay/ams/api/request/pay/alipay_refund_request.py +++ b/com/alipay/ams/api/request/pay/alipay_refund_request.py @@ -1,118 +1,184 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import json - from com.alipay.ams.api.model.amount import Amount -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.request.alipay_request import AlipayRequest +from com.alipay.ams.api.model.refund_detail import RefundDetail -class AlipayRefundRequest(AlipayRequest): +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AlipayRefundRequest(AlipayRequest): def __init__(self): - super(AlipayRefundRequest, self).__init__(AntomPathConstants.REFUND_PATH) - self.__refund_request_id = None - self.__reference_refund_id = None - self.__payment_id = None + super(AlipayRefundRequest, self).__init__("/ams/api/v1/payments/refund") + + self.__refund_request_id = None # type: str + self.__payment_id = None # type: str + self.__reference_refund_id = None # type: str self.__refund_amount = None # type: Amount - self.__refund_reason = None - self.__is_async_refund = None - self.__refund_notify_url = None - self.__extend_info = None + self.__refund_reason = None # type: str + self.__refund_notify_url = None # type: str + self.__is_async_refund = None # type: bool + self.__extend_info = None # type: str + self.__refund_details = None # type: [RefundDetail] + self.__refund_source_account_no = None # type: str + @property def refund_request_id(self): + """ + The unique ID assigned by the merchant to identify a refund request. More information: This field is an API idempotency field.The merchant uses the refundRequestId field for idempotency control. For payment requests that are initiated with the same value of refundRequestId and reach a final status (S or F), the same result is to be returned for the request. Maximum length: 64 characters + """ return self.__refund_request_id @refund_request_id.setter def refund_request_id(self, value): self.__refund_request_id = value - - @property - def reference_refund_id(self): - return self.__reference_refund_id - - @reference_refund_id.setter - def reference_refund_id(self, value): - self.__reference_refund_id = value - @property def payment_id(self): + """ + The unique ID assigned by Antom for the original payment to be refunded. More information: Maximum length: 64 characters + """ return self.__payment_id @payment_id.setter def payment_id(self, value): self.__payment_id = value + @property + def reference_refund_id(self): + """ + The unique ID to identify a refund, which is assigned by the merchant that directly provides services or goods to the customer. Note: Specify this field if this value is needed for internal use or reconciliation. More information: Maximum length: 64 characters + """ + return self.__reference_refund_id + @reference_refund_id.setter + def reference_refund_id(self, value): + self.__reference_refund_id = value @property def refund_amount(self): + """Gets the refund_amount of this AlipayRefundRequest. + + """ return self.__refund_amount @refund_amount.setter def refund_amount(self, value): self.__refund_amount = value - @property def refund_reason(self): + """ + The refund reason. Note: Specify this field if you want to provide the refund reason to the user and payment method. More information: Maximum length: 256 characters + """ return self.__refund_reason @refund_reason.setter def refund_reason(self, value): self.__refund_reason = value + @property + def refund_notify_url(self): + """ + The URL that is used to receive the refund result notification. The URL must be either specified in the request or set in Antom Dashboard. Note: Specify this field if you want to receive an asynchronous notification of the refund result. If the refund notification URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence. More information: Maximum length: 1024 characters + """ + return self.__refund_notify_url + @refund_notify_url.setter + def refund_notify_url(self, value): + self.__refund_notify_url = value @property def is_async_refund(self): + """Gets the is_async_refund of this AlipayRefundRequest. + + """ return self.__is_async_refund @is_async_refund.setter def is_async_refund(self, value): self.__is_async_refund = value - @property def extend_info(self): + """Gets the extend_info of this AlipayRefundRequest. + + """ return self.__extend_info @extend_info.setter def extend_info(self, value): self.__extend_info = value - @property - def refund_notify_url(self): - return self.__refund_notify_url + def refund_details(self): + """Gets the refund_details of this AlipayRefundRequest. + + """ + return self.__refund_details + + @refund_details.setter + def refund_details(self, value): + self.__refund_details = value + @property + def refund_source_account_no(self): + """Gets the refund_source_account_no of this AlipayRefundRequest. + + """ + return self.__refund_source_account_no + + @refund_source_account_no.setter + def refund_source_account_no(self, value): + self.__refund_source_account_no = value - @refund_notify_url.setter - def refund_notify_url(self, value): - self.__refund_notify_url = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): - params = dict() - if hasattr(self, "payment_id") and self.payment_id: - params['paymentId'] = self.payment_id - if hasattr(self, "refund_request_id") and self.refund_request_id: + def to_ams_dict(self): + params = dict() + if hasattr(self, "refund_request_id") and self.refund_request_id is not None: params['refundRequestId'] = self.refund_request_id - - if hasattr(self, "reference_refund_id") and self.reference_refund_id: + if hasattr(self, "payment_id") and self.payment_id is not None: + params['paymentId'] = self.payment_id + if hasattr(self, "reference_refund_id") and self.reference_refund_id is not None: params['referenceRefundId'] = self.reference_refund_id - - if hasattr(self, "refund_amount") and self.refund_amount: + if hasattr(self, "refund_amount") and self.refund_amount is not None: params['refundAmount'] = self.refund_amount - - if hasattr(self, "refund_reason") and self.refund_reason: + if hasattr(self, "refund_reason") and self.refund_reason is not None: params['refundReason'] = self.refund_reason - - if hasattr(self, "is_async_refund") and self.is_async_refund: + if hasattr(self, "refund_notify_url") and self.refund_notify_url is not None: + params['refundNotifyUrl'] = self.refund_notify_url + if hasattr(self, "is_async_refund") and self.is_async_refund is not None: params['isAsyncRefund'] = self.is_async_refund - - if hasattr(self, "extend_info") and self.extend_info: + if hasattr(self, "extend_info") and self.extend_info is not None: params['extendInfo'] = self.extend_info + if hasattr(self, "refund_details") and self.refund_details is not None: + params['refundDetails'] = self.refund_details + if hasattr(self, "refund_source_account_no") and self.refund_source_account_no is not None: + params['refundSourceAccountNo'] = self.refund_source_account_no + return params - if hasattr(self, "refund_notify_url") and self.refund_notify_url: - params['refundNotifyUrl'] = self.refund_notify_url - return params + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'refundRequestId' in response_body: + self.__refund_request_id = response_body['refundRequestId'] + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'referenceRefundId' in response_body: + self.__reference_refund_id = response_body['referenceRefundId'] + if 'refundAmount' in response_body: + self.__refund_amount = Amount() + self.__refund_amount.parse_rsp_body(response_body['refundAmount']) + if 'refundReason' in response_body: + self.__refund_reason = response_body['refundReason'] + if 'refundNotifyUrl' in response_body: + self.__refund_notify_url = response_body['refundNotifyUrl'] + if 'isAsyncRefund' in response_body: + self.__is_async_refund = response_body['isAsyncRefund'] + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'refundDetails' in response_body: + self.__refund_details = [] + for item in response_body['refundDetails']: + obj = RefundDetail() + obj.parse_rsp_body(item) + self.__refund_details.append(obj) + if 'refundSourceAccountNo' in response_body: + self.__refund_source_account_no = response_body['refundSourceAccountNo'] diff --git a/com/alipay/ams/api/request/pay/alipay_vaulting_payment_method_request.py b/com/alipay/ams/api/request/pay/alipay_vaulting_payment_method_request.py new file mode 100644 index 0000000..7379a60 --- /dev/null +++ b/com/alipay/ams/api/request/pay/alipay_vaulting_payment_method_request.py @@ -0,0 +1,168 @@ +import json +from com.alipay.ams.api.model.payment_method_detail import PaymentMethodDetail +from com.alipay.ams.api.model.env import Env +from com.alipay.ams.api.model.customized_info import CustomizedInfo + + + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AlipayVaultingPaymentMethodRequest(AlipayRequest): + def __init__(self): + super(AlipayVaultingPaymentMethodRequest, self).__init__("/ams/api/v1/vaults/vaultPaymentMethod") + + self.__vaulting_request_id = None # type: str + self.__vaulting_notification_url = None # type: str + self.__redirect_url = None # type: str + self.__merchant_region = None # type: str + self.__payment_method_detail = None # type: PaymentMethodDetail + self.__env = None # type: Env + self.__merchant_account_id = None # type: str + self.__vaulting_currency = None # type: str + self.__customized_info = None # type: CustomizedInfo + + + @property + def vaulting_request_id(self): + """ + The unique ID that is assigned by a merchant to identify a card vaulting request. More information: This field is an API idempotency field.For vaulting requests that are initiated with the same value of vaultingRequestId and reach a final status of S or F, the same result is to be returned for the request. Maximum length: 64 characters + """ + return self.__vaulting_request_id + + @vaulting_request_id.setter + def vaulting_request_id(self, value): + self.__vaulting_request_id = value + @property + def vaulting_notification_url(self): + """ + The URL that is used to receive the vaulting result notification. More information: Maximum length: 2048 characters + """ + return self.__vaulting_notification_url + + @vaulting_notification_url.setter + def vaulting_notification_url(self, value): + self.__vaulting_notification_url = value + @property + def redirect_url(self): + """ + The merchant page URL that the buyer is redirected to after the vaulting process is completed. More information: Maximum length: 2048 characters + """ + return self.__redirect_url + + @redirect_url.setter + def redirect_url(self, value): + self.__redirect_url = value + @property + def merchant_region(self): + """ + The country or region where the merchant operates the business. The value of this parameter is a 2-letter country or region code based on the ISO 3166 Country Codes standard. Some possible values are US, SG, HK, PK, JP, CN, BR, AU, and MY. Note: Specify this parameter when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + """ + return self.__merchant_region + + @merchant_region.setter + def merchant_region(self, value): + self.__merchant_region = value + @property + def payment_method_detail(self): + """Gets the payment_method_detail of this AlipayVaultingPaymentMethodRequest. + + """ + return self.__payment_method_detail + + @payment_method_detail.setter + def payment_method_detail(self, value): + self.__payment_method_detail = value + @property + def env(self): + """Gets the env of this AlipayVaultingPaymentMethodRequest. + + """ + return self.__env + + @env.setter + def env(self, value): + self.__env = value + @property + def merchant_account_id(self): + """Gets the merchant_account_id of this AlipayVaultingPaymentMethodRequest. + + """ + return self.__merchant_account_id + + @merchant_account_id.setter + def merchant_account_id(self, value): + self.__merchant_account_id = value + @property + def vaulting_currency(self): + """Gets the vaulting_currency of this AlipayVaultingPaymentMethodRequest. + + """ + return self.__vaulting_currency + + @vaulting_currency.setter + def vaulting_currency(self, value): + self.__vaulting_currency = value + @property + def customized_info(self): + """Gets the customized_info of this AlipayVaultingPaymentMethodRequest. + + """ + return self.__customized_info + + @customized_info.setter + def customized_info(self, value): + self.__customized_info = value + + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + return json_str + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "vaulting_request_id") and self.vaulting_request_id is not None: + params['vaultingRequestId'] = self.vaulting_request_id + if hasattr(self, "vaulting_notification_url") and self.vaulting_notification_url is not None: + params['vaultingNotificationUrl'] = self.vaulting_notification_url + if hasattr(self, "redirect_url") and self.redirect_url is not None: + params['redirectUrl'] = self.redirect_url + if hasattr(self, "merchant_region") and self.merchant_region is not None: + params['merchantRegion'] = self.merchant_region + if hasattr(self, "payment_method_detail") and self.payment_method_detail is not None: + params['paymentMethodDetail'] = self.payment_method_detail + if hasattr(self, "env") and self.env is not None: + params['env'] = self.env + if hasattr(self, "merchant_account_id") and self.merchant_account_id is not None: + params['merchantAccountId'] = self.merchant_account_id + if hasattr(self, "vaulting_currency") and self.vaulting_currency is not None: + params['vaultingCurrency'] = self.vaulting_currency + if hasattr(self, "customized_info") and self.customized_info is not None: + params['customizedInfo'] = self.customized_info + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'vaultingRequestId' in response_body: + self.__vaulting_request_id = response_body['vaultingRequestId'] + if 'vaultingNotificationUrl' in response_body: + self.__vaulting_notification_url = response_body['vaultingNotificationUrl'] + if 'redirectUrl' in response_body: + self.__redirect_url = response_body['redirectUrl'] + if 'merchantRegion' in response_body: + self.__merchant_region = response_body['merchantRegion'] + if 'paymentMethodDetail' in response_body: + self.__payment_method_detail = PaymentMethodDetail() + self.__payment_method_detail.parse_rsp_body(response_body['paymentMethodDetail']) + if 'env' in response_body: + self.__env = Env() + self.__env.parse_rsp_body(response_body['env']) + if 'merchantAccountId' in response_body: + self.__merchant_account_id = response_body['merchantAccountId'] + if 'vaultingCurrency' in response_body: + self.__vaulting_currency = response_body['vaultingCurrency'] + if 'customizedInfo' in response_body: + self.__customized_info = CustomizedInfo() + self.__customized_info.parse_rsp_body(response_body['customizedInfo']) diff --git a/com/alipay/ams/api/request/pay/alipay_vaulting_query_request.py b/com/alipay/ams/api/request/pay/alipay_vaulting_query_request.py new file mode 100644 index 0000000..74c2a4a --- /dev/null +++ b/com/alipay/ams/api/request/pay/alipay_vaulting_query_request.py @@ -0,0 +1,42 @@ +import json + + + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AlipayVaultingQueryRequest(AlipayRequest): + def __init__(self): + super(AlipayVaultingQueryRequest, self).__init__("/ams/api/v1/vaults/inquireVaulting") + + self.__vaulting_request_id = None # type: str + + + @property + def vaulting_request_id(self): + """ + The unique ID that is assigned by a merchant to identify a card vaulting request. More information about this field This field is an API idempotency field. For vaulting requests that are initiated with the same value of vaultingRequestId and reach a final status of S or F, the same result is to be returned for the request. More information: Maximum length: 64 characters + """ + return self.__vaulting_request_id + + @vaulting_request_id.setter + def vaulting_request_id(self, value): + self.__vaulting_request_id = value + + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + return json_str + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "vaulting_request_id") and self.vaulting_request_id is not None: + params['vaultingRequestId'] = self.vaulting_request_id + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'vaultingRequestId' in response_body: + self.__vaulting_request_id = response_body['vaultingRequestId'] diff --git a/com/alipay/ams/api/request/pay/alipay_vaulting_session_request.py b/com/alipay/ams/api/request/pay/alipay_vaulting_session_request.py new file mode 100644 index 0000000..b3ea7c1 --- /dev/null +++ b/com/alipay/ams/api/request/pay/alipay_vaulting_session_request.py @@ -0,0 +1,117 @@ +import json + + + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AlipayVaultingSessionRequest(AlipayRequest): + def __init__(self): + super(AlipayVaultingSessionRequest, self).__init__("/ams/api/v1/vaults/createVaultingSession") + + self.__payment_method_type = None # type: str + self.__vaulting_request_id = None # type: str + self.__vaulting_notification_url = None # type: str + self.__redirect_url = None # type: str + self.__merchant_region = None # type: str + self.__is3_ds_authentication = None # type: bool + + + @property + def payment_method_type(self): + """ + The payment method type is included in payment method options. See Payment methods to check the valid values for card payments. More information: Maximum length: 64 characters + """ + return self.__payment_method_type + + @payment_method_type.setter + def payment_method_type(self, value): + self.__payment_method_type = value + @property + def vaulting_request_id(self): + """ + The unique ID that is assigned by a merchant to identify a card vaulting request. More information: Maximum length: 64 characters + """ + return self.__vaulting_request_id + + @vaulting_request_id.setter + def vaulting_request_id(self, value): + self.__vaulting_request_id = value + @property + def vaulting_notification_url(self): + """ + The URL that is used to receive the vaulting result notification. More information: Maximum length: 2048 characters + """ + return self.__vaulting_notification_url + + @vaulting_notification_url.setter + def vaulting_notification_url(self, value): + self.__vaulting_notification_url = value + @property + def redirect_url(self): + """ + The merchant page URL that the buyer is redirected to after the vaulting is completed. Note: Specify this parameter if you want to redirect the buyer to your page directly after the vaulting is completed. More information: Maximum length: 2048 characters + """ + return self.__redirect_url + + @redirect_url.setter + def redirect_url(self, value): + self.__redirect_url = value + @property + def merchant_region(self): + """ + The country or region where the merchant operates the business. The value of this parameter is a 2-letter country or region code based on the ISO 3166 Country Codes standard. Some possible values are US, SG, HK, PK, JP, CN, BR, AU, and MY. Note: Specify this parameter when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + """ + return self.__merchant_region + + @merchant_region.setter + def merchant_region(self, value): + self.__merchant_region = value + @property + def is3_ds_authentication(self): + """ + Indicates whether the transaction authentication type is 3D secure. Specify this parameter when the value of paymentMethodType is CARD. + """ + return self.__is3_ds_authentication + + @is3_ds_authentication.setter + def is3_ds_authentication(self, value): + self.__is3_ds_authentication = value + + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + return json_str + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "payment_method_type") and self.payment_method_type is not None: + params['paymentMethodType'] = self.payment_method_type + if hasattr(self, "vaulting_request_id") and self.vaulting_request_id is not None: + params['vaultingRequestId'] = self.vaulting_request_id + if hasattr(self, "vaulting_notification_url") and self.vaulting_notification_url is not None: + params['vaultingNotificationUrl'] = self.vaulting_notification_url + if hasattr(self, "redirect_url") and self.redirect_url is not None: + params['redirectUrl'] = self.redirect_url + if hasattr(self, "merchant_region") and self.merchant_region is not None: + params['merchantRegion'] = self.merchant_region + if hasattr(self, "is3_ds_authentication") and self.is3_ds_authentication is not None: + params['is3DSAuthentication'] = self.is3_ds_authentication + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'paymentMethodType' in response_body: + self.__payment_method_type = response_body['paymentMethodType'] + if 'vaultingRequestId' in response_body: + self.__vaulting_request_id = response_body['vaultingRequestId'] + if 'vaultingNotificationUrl' in response_body: + self.__vaulting_notification_url = response_body['vaultingNotificationUrl'] + if 'redirectUrl' in response_body: + self.__redirect_url = response_body['redirectUrl'] + if 'merchantRegion' in response_body: + self.__merchant_region = response_body['merchantRegion'] + if 'is3DSAuthentication' in response_body: + self.__is3_ds_authentication = response_body['is3DSAuthentication'] diff --git a/com/alipay/ams/api/request/pay/ams_api_v1_payments_capture_post_request.py b/com/alipay/ams/api/request/pay/ams_api_v1_payments_capture_post_request.py new file mode 100644 index 0000000..3a13ea8 --- /dev/null +++ b/com/alipay/ams/api/request/pay/ams_api_v1_payments_capture_post_request.py @@ -0,0 +1,89 @@ +import json +from com.alipay.ams.api.model.amount import Amount + + + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AmsApiV1PaymentsCapturePostRequest(AlipayRequest): + def __init__(self): + super(AmsApiV1PaymentsCapturePostRequest, self).__init__("/ams/api/v1/payments/capture") + + self.__capture_request_id = None # type: str + self.__payment_id = None # type: str + self.__capture_amount = None # type: Amount + self.__is_last_capture = None # type: bool + + + @property + def capture_request_id(self): + """ + The unique ID that is assigned by the merchant to identify a capture request. Antom uses this field for idempotence control. More information: This field is an API idempotency field.For capture requests that are initiated with the same value of captureRequestId and reach a final status (S or F), the same result is to be returned for the request. Maximum length: 64 characters + """ + return self.__capture_request_id + + @capture_request_id.setter + def capture_request_id(self, value): + self.__capture_request_id = value + @property + def payment_id(self): + """ + The unique ID that is assigned by Antom to identify a payment. More information: Maximum length: 64 characters + """ + return self.__payment_id + + @payment_id.setter + def payment_id(self, value): + self.__payment_id = value + @property + def capture_amount(self): + """Gets the capture_amount of this AmsApiV1PaymentsCapturePostRequest. + + """ + return self.__capture_amount + + @capture_amount.setter + def capture_amount(self, value): + self.__capture_amount = value + @property + def is_last_capture(self): + """Gets the is_last_capture of this AmsApiV1PaymentsCapturePostRequest. + + """ + return self.__is_last_capture + + @is_last_capture.setter + def is_last_capture(self, value): + self.__is_last_capture = value + + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + return json_str + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "capture_request_id") and self.capture_request_id is not None: + params['captureRequestId'] = self.capture_request_id + if hasattr(self, "payment_id") and self.payment_id is not None: + params['paymentId'] = self.payment_id + if hasattr(self, "capture_amount") and self.capture_amount is not None: + params['captureAmount'] = self.capture_amount + if hasattr(self, "is_last_capture") and self.is_last_capture is not None: + params['isLastCapture'] = self.is_last_capture + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'captureRequestId' in response_body: + self.__capture_request_id = response_body['captureRequestId'] + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'captureAmount' in response_body: + self.__capture_amount = Amount() + self.__capture_amount.parse_rsp_body(response_body['captureAmount']) + if 'isLastCapture' in response_body: + self.__is_last_capture = response_body['isLastCapture'] diff --git a/com/alipay/ams/api/request/pay/ams_api_v1_payments_inquiry_refund_post_request.py b/com/alipay/ams/api/request/pay/ams_api_v1_payments_inquiry_refund_post_request.py new file mode 100644 index 0000000..a841d5f --- /dev/null +++ b/com/alipay/ams/api/request/pay/ams_api_v1_payments_inquiry_refund_post_request.py @@ -0,0 +1,72 @@ +import json + + + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + +class AmsApiV1PaymentsInquiryRefundPostRequest(AlipayRequest): + def __init__(self): + super(AmsApiV1PaymentsInquiryRefundPostRequest, self).__init__("/ams/api/v1/payments/inquiryRefund") + + self.__refund_request_id = None # type: str + self.__refund_id = None # type: str + self.__merchant_account_id = None # type: str + + + @property + def refund_request_id(self): + """ + The unique ID assigned by a merchant to identify a refund request. refundRequestId and refundId cannot both be null. Special characters are not supported. If both refundRequestId and refundId are specified, refundId takes precedence. More information: Maximum length: 64 characters + """ + return self.__refund_request_id + + @refund_request_id.setter + def refund_request_id(self, value): + self.__refund_request_id = value + @property + def refund_id(self): + """ + The unique ID assigned by Antom to identify a refund. refundRequestId and refundId cannot both be null. A one-to-one correspondence between refundId and refundRequestId exists. If both refundRequestId and refundId are specified, refundId takes precedence. More information: Maximum length: 64 characters + """ + return self.__refund_id + + @refund_id.setter + def refund_id(self, value): + self.__refund_id = value + @property + def merchant_account_id(self): + """Gets the merchant_account_id of this AmsApiV1PaymentsInquiryRefundPostRequest. + + """ + return self.__merchant_account_id + + @merchant_account_id.setter + def merchant_account_id(self, value): + self.__merchant_account_id = value + + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + return json_str + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "refund_request_id") and self.refund_request_id is not None: + params['refundRequestId'] = self.refund_request_id + if hasattr(self, "refund_id") and self.refund_id is not None: + params['refundId'] = self.refund_id + if hasattr(self, "merchant_account_id") and self.merchant_account_id is not None: + params['merchantAccountId'] = self.merchant_account_id + return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'refundRequestId' in response_body: + self.__refund_request_id = response_body['refundRequestId'] + if 'refundId' in response_body: + self.__refund_id = response_body['refundId'] + if 'merchantAccountId' in response_body: + self.__merchant_account_id = response_body['merchantAccountId'] diff --git a/com/alipay/ams/api/request/subscription/alipay_subscription_cancel_request.py b/com/alipay/ams/api/request/subscription/alipay_subscription_cancel_request.py index d770ddc..818e55d 100644 --- a/com/alipay/ams/api/request/subscription/alipay_subscription_cancel_request.py +++ b/com/alipay/ams/api/request/subscription/alipay_subscription_cancel_request.py @@ -1,52 +1,72 @@ import json -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.model.cancellation_type import CancellationType -from com.alipay.ams.api.request.alipay_request import AlipayRequest +from com.alipay.ams.api.request.alipay_request import AlipayRequest + class AlipaySubscriptionCancelRequest(AlipayRequest): def __init__(self): - super(AlipaySubscriptionCancelRequest, self).__init__(AntomPathConstants.SUBSCRIPTION_CANCEL_PATH) - self.__subscription_id = None - self.__subscription_request_id = None - self.__cancellation_type = None # type:CancellationType + super(AlipaySubscriptionCancelRequest, self).__init__("/ams/api/v1/subscriptions/cancel") + + self.__subscription_id = None # type: str + self.__subscription_request_id = None # type: str + self.__cancellation_type = None # type: str + @property def subscription_id(self): + """ + The unique ID assigned by Antom to identify a subscription. The value of this parameter is the value of the same parameter that is returned by notifyPayment and notifySubscription for the original subscription. Note: Specify at least one of subscriptionId and subscriptionRequestId. A one-to-one correspondence between paymentId and paymentRequestId exists. More information: Maximum length: 64 characters + """ return self.__subscription_id @subscription_id.setter def subscription_id(self, value): self.__subscription_id = value - @property def subscription_request_id(self): + """ + The unique ID assigned by a merchant to identify a subscription request. Note: Specify at least one of subscriptionId and subscriptionRequestId. A one-to-one correspondence between paymentId and paymentRequestId exists. More information: Maximum length: 64 characters + """ return self.__subscription_request_id @subscription_request_id.setter def subscription_request_id(self, value): self.__subscription_request_id = value - @property def cancellation_type(self): + """ + The cancellation type for the subscription. Valid values are: CANCEL: indicates canceling the subscription. The subscription service is not provided to the user after the current subscription period ends. TERMINATE: indicates terminating the subscription. The subscription service is ceased immediately. More information: Maximum length: 32 characters + """ return self.__cancellation_type @cancellation_type.setter def cancellation_type(self, value): self.__cancellation_type = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, "subscription_id") and self.subscription_id: + if hasattr(self, "subscription_id") and self.subscription_id is not None: params['subscriptionId'] = self.subscription_id - if hasattr(self, "subscription_request_id") and self.subscription_request_id: + if hasattr(self, "subscription_request_id") and self.subscription_request_id is not None: params['subscriptionRequestId'] = self.subscription_request_id - if hasattr(self, "cancellation_type") and self.cancellation_type: + if hasattr(self, "cancellation_type") and self.cancellation_type is not None: params['cancellationType'] = self.cancellation_type - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'subscriptionId' in response_body: + self.__subscription_id = response_body['subscriptionId'] + if 'subscriptionRequestId' in response_body: + self.__subscription_request_id = response_body['subscriptionRequestId'] + if 'cancellationType' in response_body: + self.__cancellation_type = response_body['cancellationType'] diff --git a/com/alipay/ams/api/request/subscription/alipay_subscription_change_request.py b/com/alipay/ams/api/request/subscription/alipay_subscription_change_request.py index 27fec7f..fc8de95 100644 --- a/com/alipay/ams/api/request/subscription/alipay_subscription_change_request.py +++ b/com/alipay/ams/api/request/subscription/alipay_subscription_change_request.py @@ -1,140 +1,185 @@ import json - -from com.alipay.ams.api.model.amount import Amount -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.model.order_info import OrderInfo from com.alipay.ams.api.model.period_rule import PeriodRule -from com.alipay.ams.api.request.alipay_request import AlipayRequest +from com.alipay.ams.api.model.order_info import OrderInfo +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.amount import Amount + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + class AlipaySubscriptionChangeRequest(AlipayRequest): def __init__(self): - super(AlipaySubscriptionChangeRequest, self).__init__(AntomPathConstants.SUBSCRIPTION_CHANGE_PATH) - self.__subscription_change_request_id = None - self.__subscription_id = None - self.__subscription_description = None - self.__subscription_start_time = None - self.__subscription_end_time = None + super(AlipaySubscriptionChangeRequest, self).__init__("/ams/api/v1/subscriptions/change") + + self.__subscription_change_request_id = None # type: str + self.__subscription_id = None # type: str + self.__subscription_description = None # type: str + self.__subscription_start_time = None # type: str + self.__subscription_end_time = None # type: str self.__period_rule = None # type: PeriodRule - self.__subscription_expiry_time = None + self.__subscription_expiry_time = None # type: str self.__order_info = None # type: OrderInfo self.__payment_amount = None # type: Amount self.__payment_amount_difference = None # type: Amount + @property def subscription_change_request_id(self): + """ + The unique ID assigned by a merchant to identify a subscription change request. Antom uses this field for idempotency control. Note: For subscription change requests that are initiated with the same value of subscriptionChangeRequestId and reach a final status of ​S​ or​F​, the same result is to be returned for the request. More information: This field is an API idempotency field. Maximum length: 64 characters + """ return self.__subscription_change_request_id @subscription_change_request_id.setter def subscription_change_request_id(self, value): self.__subscription_change_request_id = value - @property def subscription_id(self): + """ + The unique ID assigned by Antom to identify a subscription. The value of this parameter is the value of the same parameter that is returned by notifyPayment and notifySubscription for the original subscription. More information: Maximum length: 64 characters + """ return self.__subscription_id @subscription_id.setter def subscription_id(self, value): self.__subscription_id = value - @property def subscription_description(self): + """ + The description of the subscription, used for displaying user consumption records and other actions. Note: Specify this parameter if you want to change this information. More information: Maximum length: 256 characters + """ return self.__subscription_description @subscription_description.setter def subscription_description(self, value): self.__subscription_description = value - @property def subscription_start_time(self): + """ + The date and time when the subscription becomes active. Note: Specify this parameter when you want to designate the start time of the changed subscription. If you leave this parameter empty, the default value of this parameter is the time when Antom receives this request. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__subscription_start_time @subscription_start_time.setter def subscription_start_time(self, value): self.__subscription_start_time = value - @property def subscription_end_time(self): + """ + The date and time when the subscription ends. The default value of this parameter is 2099-12-31T23:59:59+08:00. Note: Specify this parameter when you want to change this information. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__subscription_end_time @subscription_end_time.setter def subscription_end_time(self, value): self.__subscription_end_time = value - @property def period_rule(self): + """Gets the period_rule of this AlipaySubscriptionChangeRequest. + + """ return self.__period_rule @period_rule.setter def period_rule(self, value): self.__period_rule = value - @property def subscription_expiry_time(self): + """ + A specific date and time after which the created subscription expires. When the subscription expires, the order must be terminated. The default value of this parameter is 30 minutes after the subscription creation request is sent. Note: Specify this parameter if you want to change the subscription creation expiration time. The specified payment expiration time must be less than 48 hours after the subscription request is sent. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__subscription_expiry_time @subscription_expiry_time.setter def subscription_expiry_time(self, value): self.__subscription_expiry_time = value - @property def order_info(self): + """Gets the order_info of this AlipaySubscriptionChangeRequest. + + """ return self.__order_info @order_info.setter def order_info(self, value): self.__order_info = value - @property def payment_amount(self): + """Gets the payment_amount of this AlipaySubscriptionChangeRequest. + + """ return self.__payment_amount @payment_amount.setter def payment_amount(self, value): self.__payment_amount = value - @property def payment_amount_difference(self): + """Gets the payment_amount_difference of this AlipaySubscriptionChangeRequest. + + """ return self.__payment_amount_difference @payment_amount_difference.setter def payment_amount_difference(self, value): self.__payment_amount_difference = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() - if hasattr(self, "subscription_change_request_id") and self.subscription_change_request_id: + if hasattr(self, "subscription_change_request_id") and self.subscription_change_request_id is not None: params['subscriptionChangeRequestId'] = self.subscription_change_request_id - - if hasattr(self, "subscription_id") and self.subscription_id: + if hasattr(self, "subscription_id") and self.subscription_id is not None: params['subscriptionId'] = self.subscription_id - - if hasattr(self, "subscription_description") and self.subscription_description: + if hasattr(self, "subscription_description") and self.subscription_description is not None: params['subscriptionDescription'] = self.subscription_description - - if hasattr(self, "subscription_start_time") and self.subscription_start_time: + if hasattr(self, "subscription_start_time") and self.subscription_start_time is not None: params['subscriptionStartTime'] = self.subscription_start_time - - if hasattr(self, "subscription_end_time") and self.subscription_end_time: + if hasattr(self, "subscription_end_time") and self.subscription_end_time is not None: params['subscriptionEndTime'] = self.subscription_end_time - - if hasattr(self, "period_rule") and self.period_rule: + if hasattr(self, "period_rule") and self.period_rule is not None: params['periodRule'] = self.period_rule - - if hasattr(self, "subscription_expiry_time") and self.subscription_expiry_time: + if hasattr(self, "subscription_expiry_time") and self.subscription_expiry_time is not None: params['subscriptionExpiryTime'] = self.subscription_expiry_time - - if hasattr(self, "order_info") and self.order_info: + if hasattr(self, "order_info") and self.order_info is not None: params['orderInfo'] = self.order_info - - if hasattr(self, "payment_amount") and self.payment_amount: + if hasattr(self, "payment_amount") and self.payment_amount is not None: params['paymentAmount'] = self.payment_amount - - if hasattr(self, "payment_amount_difference") and self.payment_amount_difference: + if hasattr(self, "payment_amount_difference") and self.payment_amount_difference is not None: params['paymentAmountDifference'] = self.payment_amount_difference - return params + + + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'subscriptionChangeRequestId' in response_body: + self.__subscription_change_request_id = response_body['subscriptionChangeRequestId'] + if 'subscriptionId' in response_body: + self.__subscription_id = response_body['subscriptionId'] + if 'subscriptionDescription' in response_body: + self.__subscription_description = response_body['subscriptionDescription'] + if 'subscriptionStartTime' in response_body: + self.__subscription_start_time = response_body['subscriptionStartTime'] + if 'subscriptionEndTime' in response_body: + self.__subscription_end_time = response_body['subscriptionEndTime'] + if 'periodRule' in response_body: + self.__period_rule = PeriodRule() + self.__period_rule.parse_rsp_body(response_body['periodRule']) + if 'subscriptionExpiryTime' in response_body: + self.__subscription_expiry_time = response_body['subscriptionExpiryTime'] + if 'orderInfo' in response_body: + self.__order_info = OrderInfo() + self.__order_info.parse_rsp_body(response_body['orderInfo']) + if 'paymentAmount' in response_body: + self.__payment_amount = Amount() + self.__payment_amount.parse_rsp_body(response_body['paymentAmount']) + if 'paymentAmountDifference' in response_body: + self.__payment_amount_difference = Amount() + self.__payment_amount_difference.parse_rsp_body(response_body['paymentAmountDifference']) diff --git a/com/alipay/ams/api/request/subscription/alipay_subscription_create_request.py b/com/alipay/ams/api/request/subscription/alipay_subscription_create_request.py index a91c34d..78fc47a 100644 --- a/com/alipay/ams/api/request/subscription/alipay_subscription_create_request.py +++ b/com/alipay/ams/api/request/subscription/alipay_subscription_create_request.py @@ -1,205 +1,269 @@ import json - -from com.alipay.ams.api.model.amount import Amount -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants -from com.alipay.ams.api.model.env import Env -from com.alipay.ams.api.model.order_info import OrderInfo -from com.alipay.ams.api.model.payment_method import PaymentMethod from com.alipay.ams.api.model.period_rule import PeriodRule +from com.alipay.ams.api.model.payment_method import PaymentMethod +from com.alipay.ams.api.model.order_info import OrderInfo +from com.alipay.ams.api.model.amount import Amount from com.alipay.ams.api.model.settlement_strategy import SettlementStrategy +from com.alipay.ams.api.model.env import Env from com.alipay.ams.api.model.trial import Trial -from com.alipay.ams.api.request.alipay_request import AlipayRequest + +from com.alipay.ams.api.request.alipay_request import AlipayRequest + class AlipaySubscriptionCreateRequest(AlipayRequest): def __init__(self): - super(AlipaySubscriptionCreateRequest, self).__init__(AntomPathConstants.SUBSCRIPTION_CREATE_PATH) - self.__subscription_request_id = None - self.__subscription_description = None - self.__subscription_redirect_url = None - self.__subscription_start_time = None - self.__subscription_end_time = None + super(AlipaySubscriptionCreateRequest, self).__init__("/ams/api/v1/subscriptions/create") + + self.__subscription_request_id = None # type: str + self.__subscription_description = None # type: str + self.__subscription_redirect_url = None # type: str + self.__subscription_start_time = None # type: str + self.__subscription_end_time = None # type: str self.__period_rule = None # type: PeriodRule - self.__subscription_expiry_time = None + self.__subscription_expiry_time = None # type: str self.__payment_method = None # type: PaymentMethod - self.__subscription_notification_url = None - self.__payment_notification_url = None + self.__subscription_notification_url = None # type: str + self.__payment_notification_url = None # type: str self.__order_info = None # type: OrderInfo self.__payment_amount = None # type: Amount - self.__payment_amount_difference = None # type: Amount self.__settlement_strategy = None # type: SettlementStrategy self.__env = None # type: Env - self.__trials = None # type: list[Trial] + self.__trials = None # type: [Trial] + @property def subscription_request_id(self): + """ + The unique ID assigned by a merchant to identify a subscription request. Antom uses this field for idempotency control. More information: This field is an API idempotency field.For subscription requests that are initiated with the same value of subscriptionRequestId and reach a final status of S or F, the same result is to be returned for the request. Maximum length: 64 characters + """ return self.__subscription_request_id @subscription_request_id.setter def subscription_request_id(self, value): self.__subscription_request_id = value - @property def subscription_description(self): + """ + The description of the subscription, used for displaying user consumption records and other actions. More information: Maximum length: 256 characters + """ return self.__subscription_description @subscription_description.setter def subscription_description(self, value): self.__subscription_description = value - @property def subscription_redirect_url(self): + """ + The merchant page URL that the user is redirected to after authorizing the subscription. More information: Maximum length: 2048 characters + """ return self.__subscription_redirect_url @subscription_redirect_url.setter def subscription_redirect_url(self, value): self.__subscription_redirect_url = value - @property def subscription_start_time(self): + """ + The date and time when the subscription becomes active. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__subscription_start_time @subscription_start_time.setter def subscription_start_time(self, value): self.__subscription_start_time = value - @property def subscription_end_time(self): + """ + The date and time when the subscription ends. Note: Specify this parameter when you want to designate the subscription end time. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__subscription_end_time @subscription_end_time.setter def subscription_end_time(self, value): self.__subscription_end_time = value - @property def period_rule(self): + """Gets the period_rule of this AlipaySubscriptionCreateRequest. + + """ return self.__period_rule @period_rule.setter def period_rule(self, value): self.__period_rule = value - @property def subscription_expiry_time(self): + """ + A specific date and time after which the created subscription expires. When the subscription expires, the order must be terminated. The default value of this parameter is 30 minutes after the subscription creation request is sent. Note: Specify this parameter if you want to designate the subscription creation expiration time. The specified payment expiration time must be less than 48 hours after the subscription request is sent. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__subscription_expiry_time @subscription_expiry_time.setter def subscription_expiry_time(self, value): self.__subscription_expiry_time = value - @property def payment_method(self): + """Gets the payment_method of this AlipaySubscriptionCreateRequest. + + """ return self.__payment_method @payment_method.setter def payment_method(self, value): self.__payment_method = value - @property def subscription_notification_url(self): + """ + The URL that is used to receive the subscription result notification. You can also configure the subscription notification URL in Antom Dashboard. If you specify this URL in both this API and Antom Dashboard, the URL configured in the API takes precedence. Only one subscription notification URL can be configured in Antom Dashboard. More information: Maximum length: 2048 characters + """ return self.__subscription_notification_url @subscription_notification_url.setter def subscription_notification_url(self, value): self.__subscription_notification_url = value - @property def payment_notification_url(self): + """ + The URL that is used to receive the payment result notification for each subscription period. You can also configure the subscription notification URL in Antom Dashboard. If you specify this URL in both this API and Antom Dashboard, the URL configured in the API takes precedence. You can only configure one subscription notification URL in Antom Dashboard. More information: Maximum length: 2048 characters + """ return self.__payment_notification_url @payment_notification_url.setter def payment_notification_url(self, value): self.__payment_notification_url = value - @property def order_info(self): + """Gets the order_info of this AlipaySubscriptionCreateRequest. + + """ return self.__order_info @order_info.setter def order_info(self, value): self.__order_info = value - @property def payment_amount(self): + """Gets the payment_amount of this AlipaySubscriptionCreateRequest. + + """ return self.__payment_amount @payment_amount.setter def payment_amount(self, value): self.__payment_amount = value - - @property - def payment_amount_difference(self): - return self.__payment_amount_difference - - @payment_amount_difference.setter - def payment_amount_difference(self, value): - self.__payment_amount_difference = value - @property def settlement_strategy(self): + """Gets the settlement_strategy of this AlipaySubscriptionCreateRequest. + + """ return self.__settlement_strategy @settlement_strategy.setter def settlement_strategy(self, value): self.__settlement_strategy = value - @property def env(self): + """Gets the env of this AlipaySubscriptionCreateRequest. + + """ return self.__env @env.setter def env(self, value): self.__env = value - @property def trials(self): + """ + The list of trial information of a subscription. Note: Specify this parameter if the subscription includes any trial periods. + """ return self.__trials @trials.setter def trials(self, value): self.__trials = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): + + def to_ams_dict(self): params = dict() + if hasattr(self, "subscription_request_id") and self.subscription_request_id is not None: + params['subscriptionRequestId'] = self.subscription_request_id + if hasattr(self, "subscription_description") and self.subscription_description is not None: + params['subscriptionDescription'] = self.subscription_description + if hasattr(self, "subscription_redirect_url") and self.subscription_redirect_url is not None: + params['subscriptionRedirectUrl'] = self.subscription_redirect_url + if hasattr(self, "subscription_start_time") and self.subscription_start_time is not None: + params['subscriptionStartTime'] = self.subscription_start_time + if hasattr(self, "subscription_end_time") and self.subscription_end_time is not None: + params['subscriptionEndTime'] = self.subscription_end_time + if hasattr(self, "period_rule") and self.period_rule is not None: + params['periodRule'] = self.period_rule + if hasattr(self, "subscription_expiry_time") and self.subscription_expiry_time is not None: + params['subscriptionExpiryTime'] = self.subscription_expiry_time + if hasattr(self, "payment_method") and self.payment_method is not None: + params['paymentMethod'] = self.payment_method + if hasattr(self, "subscription_notification_url") and self.subscription_notification_url is not None: + params['subscriptionNotificationUrl'] = self.subscription_notification_url + if hasattr(self, "payment_notification_url") and self.payment_notification_url is not None: + params['paymentNotificationUrl'] = self.payment_notification_url + if hasattr(self, "order_info") and self.order_info is not None: + params['orderInfo'] = self.order_info + if hasattr(self, "payment_amount") and self.payment_amount is not None: + params['paymentAmount'] = self.payment_amount + if hasattr(self, "settlement_strategy") and self.settlement_strategy is not None: + params['settlementStrategy'] = self.settlement_strategy + if hasattr(self, "env") and self.env is not None: + params['env'] = self.env + if hasattr(self, "trials") and self.trials is not None: + params['trials'] = self.trials + return params - if self.__subscription_request_id is not None: - params['subscriptionRequestId'] = self.__subscription_request_id - if self.__subscription_description is not None: - params['subscriptionDescription'] = self.__subscription_description - if self.__subscription_redirect_url is not None: - params['subscriptionRedirectUrl'] = self.__subscription_redirect_url - if self.__subscription_start_time is not None: - params['subscriptionStartTime'] = self.__subscription_start_time - if self.__subscription_end_time is not None: - params['subscriptionEndTime'] = self.__subscription_end_time - if self.__period_rule is not None: - params['periodRule'] = self.__period_rule.to_ams_dict() - if self.__subscription_expiry_time is not None: - params['subscriptionExpiryTime'] = self.__subscription_expiry_time - if self.__payment_method is not None: - params['paymentMethod'] = self.__payment_method.to_ams_dict() - if self.__subscription_notification_url is not None: - params['subscriptionNotificationUrl'] = self.__subscription_notification_url - if self.__payment_notification_url is not None: - params['paymentNotificationUrl'] = self.__payment_notification_url - if self.__order_info is not None: - params['orderInfo'] = self.__order_info.to_ams_dict() - if self.__payment_amount is not None: - params['paymentAmount'] = self.__payment_amount.to_ams_dict() - if self.__payment_amount_difference is not None: - params['paymentAmountDifference'] = self.__payment_amount_difference.to_ams_dict() - if self.__settlement_strategy is not None: - params['settlementStrategy'] = self.__settlement_strategy.to_ams_dict() - if self.__env is not None: - params['env'] = self.__env.to_ams_dict() - if self.__trials is not None: - trials_list = [] - for trial in self.__trials: - trials_list.append(trial.to_ams_json()) - params['trials'] = trials_list - return params + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'subscriptionRequestId' in response_body: + self.__subscription_request_id = response_body['subscriptionRequestId'] + if 'subscriptionDescription' in response_body: + self.__subscription_description = response_body['subscriptionDescription'] + if 'subscriptionRedirectUrl' in response_body: + self.__subscription_redirect_url = response_body['subscriptionRedirectUrl'] + if 'subscriptionStartTime' in response_body: + self.__subscription_start_time = response_body['subscriptionStartTime'] + if 'subscriptionEndTime' in response_body: + self.__subscription_end_time = response_body['subscriptionEndTime'] + if 'periodRule' in response_body: + self.__period_rule = PeriodRule() + self.__period_rule.parse_rsp_body(response_body['periodRule']) + if 'subscriptionExpiryTime' in response_body: + self.__subscription_expiry_time = response_body['subscriptionExpiryTime'] + if 'paymentMethod' in response_body: + self.__payment_method = PaymentMethod() + self.__payment_method.parse_rsp_body(response_body['paymentMethod']) + if 'subscriptionNotificationUrl' in response_body: + self.__subscription_notification_url = response_body['subscriptionNotificationUrl'] + if 'paymentNotificationUrl' in response_body: + self.__payment_notification_url = response_body['paymentNotificationUrl'] + if 'orderInfo' in response_body: + self.__order_info = OrderInfo() + self.__order_info.parse_rsp_body(response_body['orderInfo']) + if 'paymentAmount' in response_body: + self.__payment_amount = Amount() + self.__payment_amount.parse_rsp_body(response_body['paymentAmount']) + if 'settlementStrategy' in response_body: + self.__settlement_strategy = SettlementStrategy() + self.__settlement_strategy.parse_rsp_body(response_body['settlementStrategy']) + if 'env' in response_body: + self.__env = Env() + self.__env.parse_rsp_body(response_body['env']) + if 'trials' in response_body: + self.__trials = [] + for item in response_body['trials']: + obj = Trial() + obj.parse_rsp_body(item) + self.__trials.append(obj) diff --git a/com/alipay/ams/api/request/subscription/alipay_subscription_update_request.py b/com/alipay/ams/api/request/subscription/alipay_subscription_update_request.py index 11f774d..b272b33 100644 --- a/com/alipay/ams/api/request/subscription/alipay_subscription_update_request.py +++ b/com/alipay/ams/api/request/subscription/alipay_subscription_update_request.py @@ -1,74 +1,90 @@ import json - +from com.alipay.ams.api.model.period_rule import PeriodRule from com.alipay.ams.api.model.amount import Amount -from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants from com.alipay.ams.api.model.order_info import OrderInfo -from com.alipay.ams.api.model.period_rule import PeriodRule -from com.alipay.ams.api.request.alipay_request import AlipayRequest -class AlipaySubscriptionUpdateRequest(AlipayRequest): - def __init__(self): - super(AlipaySubscriptionUpdateRequest, self).__init__(AntomPathConstants.SUBSCRIPTION_UPDATE_PATH) - self.__subscription_update_requestId = None - self.__subscription_id = None - self.__subscription_description = None - self.__period_rule = None #type: PeriodRule - self.__payment_amount = None #type: Amount - self.__subscription_end_time = None - self.__order_info = None #type: OrderInfo +from com.alipay.ams.api.request.alipay_request import AlipayRequest - @property - def subscription_update_requestId(self): - return self.__subscription_update_requestId +class AlipaySubscriptionUpdateRequest(AlipayRequest): + def __init__(self): + super(AlipaySubscriptionUpdateRequest, self).__init__("/ams/api/v1/subscriptions/update") - @subscription_update_requestId.setter - def subscription_update_requestId(self, value): - self.__subscription_update_requestId = value + self.__subscription_update_request_id = None # type: str + self.__subscription_id = None # type: str + self.__subscription_description = None # type: str + self.__period_rule = None # type: PeriodRule + self.__payment_amount = None # type: Amount + self.__subscription_end_time = None # type: str + self.__order_info = None # type: OrderInfo + + @property + def subscription_update_request_id(self): + """ + The unique ID assigned by a merchant to identify a subscription update request. More information: Maximum length: 64 characters + """ + return self.__subscription_update_request_id + + @subscription_update_request_id.setter + def subscription_update_request_id(self, value): + self.__subscription_update_request_id = value @property def subscription_id(self): + """ + The unique ID assigned by Antom to identify a subscription. More information: Maximum length: 64 characters + """ return self.__subscription_id @subscription_id.setter def subscription_id(self, value): self.__subscription_id = value - @property def subscription_description(self): + """ + The description of the subscription, used for displaying user consumption records and other actions. More information: Maximum length: 256 characters + """ return self.__subscription_description @subscription_description.setter def subscription_description(self, value): self.__subscription_description = value - @property def period_rule(self): + """Gets the period_rule of this AlipaySubscriptionUpdateRequest. + + """ return self.__period_rule @period_rule.setter def period_rule(self, value): self.__period_rule = value - @property def payment_amount(self): + """Gets the payment_amount of this AlipaySubscriptionUpdateRequest. + + """ return self.__payment_amount @payment_amount.setter def payment_amount(self, value): self.__payment_amount = value - @property def subscription_end_time(self): + """ + The date and time when the subscription ends. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__subscription_end_time @subscription_end_time.setter def subscription_end_time(self, value): self.__subscription_end_time = value - @property def order_info(self): + """Gets the order_info of this AlipaySubscriptionUpdateRequest. + + """ return self.__order_info @order_info.setter @@ -76,29 +92,47 @@ def order_info(self, value): self.__order_info = value - def to_ams_json(self): - json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) + def to_ams_json(self): + json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) return json_str - def __to_ams_dict(self): - params = dict() - if self.__subscription_update_requestId is not None: - params['subscriptionUpdateRequestId'] = self.__subscription_update_requestId - if self.__subscription_id is not None: - params['subscriptionId'] = self.__subscription_id - if self.__subscription_description is not None: - params['subscriptionDescription'] = self.__subscription_description - if self.__period_rule is not None: - params['periodRule'] = self.__period_rule.to_ams_dict() - if self.__payment_amount is not None: - params['paymentAmount'] = self.__payment_amount.to_ams_dict() - if self.__subscription_end_time is not None: - params['subscriptionEndTime'] = self.__subscription_end_time - if self.__order_info is not None: - params['orderInfo'] = self.__order_info.to_ams_dict() + def to_ams_dict(self): + params = dict() + if hasattr(self, "subscription_update_request_id") and self.subscription_update_request_id is not None: + params['subscriptionUpdateRequestId'] = self.subscription_update_request_id + if hasattr(self, "subscription_id") and self.subscription_id is not None: + params['subscriptionId'] = self.subscription_id + if hasattr(self, "subscription_description") and self.subscription_description is not None: + params['subscriptionDescription'] = self.subscription_description + if hasattr(self, "period_rule") and self.period_rule is not None: + params['periodRule'] = self.period_rule + if hasattr(self, "payment_amount") and self.payment_amount is not None: + params['paymentAmount'] = self.payment_amount + if hasattr(self, "subscription_end_time") and self.subscription_end_time is not None: + params['subscriptionEndTime'] = self.subscription_end_time + if hasattr(self, "order_info") and self.order_info is not None: + params['orderInfo'] = self.order_info return params - - + def parse_rsp_body(self, response_body): + if isinstance(response_body, str): + response_body = json.loads(response_body) + if 'subscriptionUpdateRequestId' in response_body: + self.__subscription_update_request_id = response_body['subscriptionUpdateRequestId'] + if 'subscriptionId' in response_body: + self.__subscription_id = response_body['subscriptionId'] + if 'subscriptionDescription' in response_body: + self.__subscription_description = response_body['subscriptionDescription'] + if 'periodRule' in response_body: + self.__period_rule = PeriodRule() + self.__period_rule.parse_rsp_body(response_body['periodRule']) + if 'paymentAmount' in response_body: + self.__payment_amount = Amount() + self.__payment_amount.parse_rsp_body(response_body['paymentAmount']) + if 'subscriptionEndTime' in response_body: + self.__subscription_end_time = response_body['subscriptionEndTime'] + if 'orderInfo' in response_body: + self.__order_info = OrderInfo() + self.__order_info.parse_rsp_body(response_body['orderInfo']) diff --git a/com/alipay/ams/api/response/auth/alipay_auth_apply_token_response.py b/com/alipay/ams/api/response/auth/alipay_auth_apply_token_response.py index 954b426..f81de4e 100644 --- a/com/alipay/ams/api/response/auth/alipay_auth_apply_token_response.py +++ b/com/alipay/ams/api/response/auth/alipay_auth_apply_token_response.py @@ -1,57 +1,148 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json +from com.alipay.ams.api.model.result import Result +from com.alipay.ams.api.model.psp_customer_info import PspCustomerInfo -from com.alipay.ams.api.response.alipay_response import AlipayResponse -class AlipayAuthApplyTokenResponse(AlipayResponse): +from com.alipay.ams.api.response.alipay_response import AlipayResponse +class AlipayAuthApplyTokenResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayAuthApplyTokenResponse, self).__init__() - self.__access_token = None - self.__access_token_expiry_time = None - self.__refresh_token = None - self.__refresh_token_expiry_time = None - self.__user_login_id = None - self.__extend_info = None - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__access_token = None # type: str + self.__access_token_expiry_time = None # type: str + self.__refresh_token = None # type: str + self.__refresh_token_expiry_time = None # type: str + self.__extend_info = None # type: str + self.__user_login_id = None # type: str + self.__psp_customer_info = None # type: PspCustomerInfo + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AlipayAuthApplyTokenResponse. + + """ + return self.__result + @result.setter + def result(self, value): + self.__result = value @property def access_token(self): + """ + The access token that is used to access the corresponding scope of the user resource. Note: This field is returned when the API is called successfully. More information: Maximum length: 128 characters + """ return self.__access_token + @access_token.setter + def access_token(self, value): + self.__access_token = value @property def access_token_expiry_time(self): + """ + The time after which the access token expires. After the access token expires, the access token cannot be used to deduct money from the user's account. Note: This field is returned when accessToken is returned. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__access_token_expiry_time + @access_token_expiry_time.setter + def access_token_expiry_time(self, value): + self.__access_token_expiry_time = value @property def refresh_token(self): + """ + The refresh token that is used to exchange for a new access token when the access token is about to expire. Note: This field is returned when the wallet supports refreshing the token. If this field is not returned, it indicates that the access token has a quite long valid period. More information: Maximum length: 128 characters + """ return self.__refresh_token + @refresh_token.setter + def refresh_token(self, value): + self.__refresh_token = value @property def refresh_token_expiry_time(self): + """ + The time after which the refresh token expires. After the refresh token expires, the refresh token cannot be used to retrieve a new access token. Note: This field is returned when refreshToken is returned. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__refresh_token_expiry_time + @refresh_token_expiry_time.setter + def refresh_token_expiry_time(self, value): + self.__refresh_token_expiry_time = value @property def extend_info(self): + """ + Extended information. Note: This field is returned when extended information exists. More information: Maximum length: 2048 characters + """ return self.__extend_info + @extend_info.setter + def extend_info(self, value): + self.__extend_info = value @property def user_login_id(self): + """ + The login ID that the user used to register in the wallet. The login ID can be the user's email address or phone number, which is masked when returned to Alipay+ payment methods . This field can inform the merchant of the users who are registered. Note: This field is returned when result.resultCode is SUCCESS and the value of the scopes field in the consult API is AGREEMENT_PAY. More information: Maximum length: 64 characters + """ return self.__user_login_id - def __parse_rsp_body(self, rsp_body): - response = super(AlipayAuthApplyTokenResponse, self).parse_rsp_body(rsp_body) - if 'accessToken' in response: - self.__access_token = response['accessToken'] - if 'accessTokenExpiryTime' in response: - self.__access_token_expiry_time = response['accessTokenExpiryTime'] - if 'refreshToken' in response: - self.__refresh_token = response['refreshToken'] - if 'refreshTokenExpiryTime' in response: - self.__refresh_token_expiry_time = response['refreshTokenExpiryTime'] - if 'extendInfo' in response: - self.__extend_info = response['extendInfo'] - - if 'userLoginId' in response: - self.__user_login_id = response['userLoginId'] + @user_login_id.setter + def user_login_id(self, value): + self.__user_login_id = value + @property + def psp_customer_info(self): + """Gets the psp_customer_info of this AlipayAuthApplyTokenResponse. + + """ + return self.__psp_customer_info + + @psp_customer_info.setter + def psp_customer_info(self, value): + self.__psp_customer_info = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "access_token") and self.access_token is not None: + params['accessToken'] = self.access_token + if hasattr(self, "access_token_expiry_time") and self.access_token_expiry_time is not None: + params['accessTokenExpiryTime'] = self.access_token_expiry_time + if hasattr(self, "refresh_token") and self.refresh_token is not None: + params['refreshToken'] = self.refresh_token + if hasattr(self, "refresh_token_expiry_time") and self.refresh_token_expiry_time is not None: + params['refreshTokenExpiryTime'] = self.refresh_token_expiry_time + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + if hasattr(self, "user_login_id") and self.user_login_id is not None: + params['userLoginId'] = self.user_login_id + if hasattr(self, "psp_customer_info") and self.psp_customer_info is not None: + params['pspCustomerInfo'] = self.psp_customer_info + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayAuthApplyTokenResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'accessToken' in response_body: + self.__access_token = response_body['accessToken'] + if 'accessTokenExpiryTime' in response_body: + self.__access_token_expiry_time = response_body['accessTokenExpiryTime'] + if 'refreshToken' in response_body: + self.__refresh_token = response_body['refreshToken'] + if 'refreshTokenExpiryTime' in response_body: + self.__refresh_token_expiry_time = response_body['refreshTokenExpiryTime'] + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'userLoginId' in response_body: + self.__user_login_id = response_body['userLoginId'] + if 'pspCustomerInfo' in response_body: + self.__psp_customer_info = PspCustomerInfo() + self.__psp_customer_info.parse_rsp_body(response_body['pspCustomerInfo']) diff --git a/com/alipay/ams/api/response/auth/alipay_auth_consult_response.py b/com/alipay/ams/api/response/auth/alipay_auth_consult_response.py index 66f25c2..c71c222 100644 --- a/com/alipay/ams/api/response/auth/alipay_auth_consult_response.py +++ b/com/alipay/ams/api/response/auth/alipay_auth_consult_response.py @@ -1,68 +1,148 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json +from com.alipay.ams.api.model.result import Result from com.alipay.ams.api.model.auth_code_form import AuthCodeForm -from com.alipay.ams.api.response.alipay_response import AlipayResponse -class AlipayAuthConsultResponse(AlipayResponse): +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayAuthConsultResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayAuthConsultResponse, self).__init__() - self.__auth_url = None - self.__extend_info = None - self.__scheme_url = None - self.__applink_url = None - self.__appIdentifier = None - self.__normal_url = None + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__auth_url = None # type: str + self.__extend_info = None # type: str + self.__normal_url = None # type: str + self.__scheme_url = None # type: str + self.__applink_url = None # type: str + self.__app_identifier = None # type: str self.__auth_code_form = None # type: AuthCodeForm - self.__parse_rsp_body(rsp_body) + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipayAuthConsultResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def auth_url(self): + """Gets the auth_url of this AlipayAuthConsultResponse. + + """ return self.__auth_url + @auth_url.setter + def auth_url(self, value): + self.__auth_url = value @property def extend_info(self): + """Gets the extend_info of this AlipayAuthConsultResponse. + + """ return self.__extend_info + @extend_info.setter + def extend_info(self, value): + self.__extend_info = value + @property + def normal_url(self): + """ + The URL that redirects users to a WAP or WEB page in the default browser or the embedded WebView. Note: When the value of result.resultCode is SUCCESS, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + """ + return self.__normal_url + + @normal_url.setter + def normal_url(self, value): + self.__normal_url = value @property def scheme_url(self): + """ + The URL scheme that redirects users to open an app in an Android or iOS system when the target app is installed. Note: When the value of result.resultCode is SUCCESS, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + """ return self.__scheme_url + @scheme_url.setter + def scheme_url(self, value): + self.__scheme_url = value @property def applink_url(self): + """ + The URL that redirects users to open an app when the target app is installed, or to open a WAP page when the target app is not installed. For Android, the URL is a Native App Link. For iOS, the URL is a Universal Link. Note: When the value of result.resultCode is SUCCESS, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + """ return self.__applink_url + @applink_url.setter + def applink_url(self, value): + self.__applink_url = value @property - def appIdentifier(self): - return self.__appIdentifier - - @property - def normal_url(self): - return self.__normal_url - + def app_identifier(self): + """ + Android package name, which is used for Android app to open a cashier page. Note: This field is returned when result.resultCode is SUCCESS and terminalType is ​APP or ​WAP​. More information: Maximum length: 128 characters + """ + return self.__app_identifier + + @app_identifier.setter + def app_identifier(self, value): + self.__app_identifier = value @property def auth_code_form(self): + """Gets the auth_code_form of this AlipayAuthConsultResponse. + + """ return self.__auth_code_form - def __parse_rsp_body(self, rsp_body): - response = super(AlipayAuthConsultResponse, self).parse_rsp_body(rsp_body) - if 'authUrl' in response: - self.__auth_url = response['authUrl'] - if 'extendInfo' in response: - self.__extend_info = response['extendInfo'] - - if 'schemeUrl' in response: - self.__scheme_url = response['schemeUrl'] - - if 'applinkUrl' in response: - self.__applink_url = response['applinkUrl'] - - if 'appIdentifier' in response: - self.__appIdentifier = response['appIdentifier'] - - if 'normalUrl' in response: - self.__normal_url = response['normalUrl'] - - if 'authCodeForm' in response: - self.__auth_code_form = response['authCodeForm'] + @auth_code_form.setter + def auth_code_form(self, value): + self.__auth_code_form = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "auth_url") and self.auth_url is not None: + params['authUrl'] = self.auth_url + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + if hasattr(self, "normal_url") and self.normal_url is not None: + params['normalUrl'] = self.normal_url + if hasattr(self, "scheme_url") and self.scheme_url is not None: + params['schemeUrl'] = self.scheme_url + if hasattr(self, "applink_url") and self.applink_url is not None: + params['applinkUrl'] = self.applink_url + if hasattr(self, "app_identifier") and self.app_identifier is not None: + params['appIdentifier'] = self.app_identifier + if hasattr(self, "auth_code_form") and self.auth_code_form is not None: + params['authCodeForm'] = self.auth_code_form + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayAuthConsultResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'authUrl' in response_body: + self.__auth_url = response_body['authUrl'] + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'normalUrl' in response_body: + self.__normal_url = response_body['normalUrl'] + if 'schemeUrl' in response_body: + self.__scheme_url = response_body['schemeUrl'] + if 'applinkUrl' in response_body: + self.__applink_url = response_body['applinkUrl'] + if 'appIdentifier' in response_body: + self.__app_identifier = response_body['appIdentifier'] + if 'authCodeForm' in response_body: + self.__auth_code_form = AuthCodeForm() + self.__auth_code_form.parse_rsp_body(response_body['authCodeForm']) diff --git a/com/alipay/ams/api/response/auth/alipay_auth_revoke_token_response.py b/com/alipay/ams/api/response/auth/alipay_auth_revoke_token_response.py index 857eb94..dcac5cb 100644 --- a/com/alipay/ams/api/response/auth/alipay_auth_revoke_token_response.py +++ b/com/alipay/ams/api/response/auth/alipay_auth_revoke_token_response.py @@ -1,21 +1,56 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json +from com.alipay.ams.api.model.result import Result -from com.alipay.ams.api.response.alipay_response import AlipayResponse -class AlipayAuthRevokeTokenResponse(AlipayResponse): +from com.alipay.ams.api.response.alipay_response import AlipayResponse +class AlipayAuthRevokeTokenResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayAuthRevokeTokenResponse, self).__init__() - self.__extend_info = None - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__extend_info = None # type: str + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipayAuthRevokeTokenResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def extend_info(self): + """Gets the extend_info of this AlipayAuthRevokeTokenResponse. + + """ return self.__extend_info - def __parse_rsp_body(self, rsp_body): - response = super(AlipayAuthRevokeTokenResponse, self).parse_rsp_body(rsp_body) - if 'extendInfo' in response: - self.__extend_info = response['extendInfo'] + @extend_info.setter + def extend_info(self, value): + self.__extend_info = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayAuthRevokeTokenResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] diff --git a/com/alipay/ams/api/response/dispute/alipay_accept_dispute_response.py b/com/alipay/ams/api/response/dispute/alipay_accept_dispute_response.py index 7d96b2f..3efe19b 100644 --- a/com/alipay/ams/api/response/dispute/alipay_accept_dispute_response.py +++ b/com/alipay/ams/api/response/dispute/alipay_accept_dispute_response.py @@ -1,24 +1,71 @@ -from com.alipay.ams.api.response.alipay_response import AlipayResponse +import json +from com.alipay.ams.api.model.result import Result + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + class AlipayAcceptDisputeResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayAcceptDisputeResponse, self).__init__() - self.__dispute_id = None - self.__dispute_resolution_time = None - self.parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__dispute_id = None # type: str + self.__dispute_resolution_time = None # type: str + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipayAcceptDisputeResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def dispute_id(self): + """ + The unique ID assigned by Antom to identify a dispute. Note: This prameter is returned when the value of resultCode is SUCCESS. More information: Maximum length: 64 characters + """ return self.__dispute_id + @dispute_id.setter + def dispute_id(self, value): + self.__dispute_id = value @property def dispute_resolution_time(self): + """ + The time when you accept the dispute. Note: This prameter is returned when the value of resultCode is SUCCESS. More information: Maximum length: 64 characters + """ return self.__dispute_resolution_time - def parse_rsp_body(self, rsp_body): - rsp_dict = super(AlipayAcceptDisputeResponse, self).parse_rsp_body(rsp_body) - if 'disputeId' in rsp_dict: - self.__dispute_id = rsp_dict['disputeId'] - if 'disputeResolutionTime' in rsp_dict: - self.__dispute_resolution_time = rsp_dict['disputeResolutionTime'] + @dispute_resolution_time.setter + def dispute_resolution_time(self, value): + self.__dispute_resolution_time = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "dispute_id") and self.dispute_id is not None: + params['disputeId'] = self.dispute_id + if hasattr(self, "dispute_resolution_time") and self.dispute_resolution_time is not None: + params['disputeResolutionTime'] = self.dispute_resolution_time + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayAcceptDisputeResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'disputeId' in response_body: + self.__dispute_id = response_body['disputeId'] + if 'disputeResolutionTime' in response_body: + self.__dispute_resolution_time = response_body['disputeResolutionTime'] diff --git a/com/alipay/ams/api/response/dispute/alipay_download_dispute_evidence_response.py b/com/alipay/ams/api/response/dispute/alipay_download_dispute_evidence_response.py index ae5fd16..a1a454c 100644 --- a/com/alipay/ams/api/response/dispute/alipay_download_dispute_evidence_response.py +++ b/com/alipay/ams/api/response/dispute/alipay_download_dispute_evidence_response.py @@ -1,26 +1,73 @@ +import json +from com.alipay.ams.api.model.result import Result from com.alipay.ams.api.model.dispute_evidence_format_type import DisputeEvidenceFormatType -from com.alipay.ams.api.response.alipay_response import AlipayResponse -class AlipayDownloadDisputeEvidenceResponse(AlipayResponse): +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayDownloadDisputeEvidenceResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayDownloadDisputeEvidenceResponse, self).__init__() - self.__dispute_evidence = None - self.__dispute_evidence_format = None # type:DisputeEvidenceFormatType - self.parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__dispute_evidence = None # type: str + self.__dispute_evidence_format = None # type: DisputeEvidenceFormatType + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipayDownloadDisputeEvidenceResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def dispute_evidence(self): + """ + The dispute evidence that is encoded in the Based64 format. Decode the Base64 document to get the Word or PDF file. Note: This prameter is returned when the value of resultCode is SUCCESS. More information: Maximum length: 1000000 characters + """ return self.__dispute_evidence + @dispute_evidence.setter + def dispute_evidence(self, value): + self.__dispute_evidence = value @property def dispute_evidence_format(self): + """Gets the dispute_evidence_format of this AlipayDownloadDisputeEvidenceResponse. + + """ return self.__dispute_evidence_format - def parse_rsp_body(self, rsp_body): - rsp_dict = super(AlipayDownloadDisputeEvidenceResponse, self).parse_rsp_body(rsp_body) - if 'disputeEvidence' in rsp_dict: - self.__dispute_evidence = rsp_dict['disputeEvidence'] - if 'disputeEvidenceFormat' in rsp_dict: - self.__dispute_evidence_format = rsp_dict['disputeEvidenceFormat'] + @dispute_evidence_format.setter + def dispute_evidence_format(self, value): + self.__dispute_evidence_format = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "dispute_evidence") and self.dispute_evidence is not None: + params['disputeEvidence'] = self.dispute_evidence + if hasattr(self, "dispute_evidence_format") and self.dispute_evidence_format is not None: + params['disputeEvidenceFormat'] = self.dispute_evidence_format + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayDownloadDisputeEvidenceResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'disputeEvidence' in response_body: + self.__dispute_evidence = response_body['disputeEvidence'] + if 'disputeEvidenceFormat' in response_body: + dispute_evidence_format_temp = DisputeEvidenceFormatType.value_of(response_body['disputeEvidenceFormat']) + self.__dispute_evidence_format = dispute_evidence_format_temp diff --git a/com/alipay/ams/api/response/dispute/alipay_supply_defense_document_response.py b/com/alipay/ams/api/response/dispute/alipay_supply_defense_document_response.py index 8773317..42a9d29 100644 --- a/com/alipay/ams/api/response/dispute/alipay_supply_defense_document_response.py +++ b/com/alipay/ams/api/response/dispute/alipay_supply_defense_document_response.py @@ -1,24 +1,71 @@ -from com.alipay.ams.api.response.alipay_response import AlipayResponse +import json +from com.alipay.ams.api.model.result import Result + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + class AlipaySupplyDefenseDocumentResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipaySupplyDefenseDocumentResponse, self).__init__() - self.__dispute_id = None - self.__dispute_resolution_time = None - self.parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__dispute_id = None # type: str + self.__dispute_resolution_time = None # type: str + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipaySupplyDefenseDocumentResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def dispute_id(self): + """ + The unique ID assigned by Antom to identify a dispute. Note: This prameter is returned when the value of resultCode is SUCCESS. More information: Maximum length: 64 characters + """ return self.__dispute_id + @dispute_id.setter + def dispute_id(self, value): + self.__dispute_id = value @property def dispute_resolution_time(self): + """ + The time when you upload the dispute defense document. Note: This prameter is returned when the value of resultCode is SUCCESS. More information: Maximum length: 64 characters + """ return self.__dispute_resolution_time - def parse_rsp_body(self, rsp_body): - rsp_dict = super(AlipaySupplyDefenseDocumentResponse, self).parse_rsp_body(rsp_body) - if 'disputeId' in rsp_dict: - self.__dispute_id = rsp_dict['disputeId'] - if 'disputeResolutionTime' in rsp_dict: - self.__dispute_resolution_time = rsp_dict['disputeResolutionTime'] + @dispute_resolution_time.setter + def dispute_resolution_time(self, value): + self.__dispute_resolution_time = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "dispute_id") and self.dispute_id is not None: + params['disputeId'] = self.dispute_id + if hasattr(self, "dispute_resolution_time") and self.dispute_resolution_time is not None: + params['disputeResolutionTime'] = self.dispute_resolution_time + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipaySupplyDefenseDocumentResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'disputeId' in response_body: + self.__dispute_id = response_body['disputeId'] + if 'disputeResolutionTime' in response_body: + self.__dispute_resolution_time = response_body['disputeResolutionTime'] diff --git a/com/alipay/ams/api/response/marketplace/alipay_create_payout_response.py b/com/alipay/ams/api/response/marketplace/alipay_create_payout_response.py index 9122a17..090c56a 100644 --- a/com/alipay/ams/api/response/marketplace/alipay_create_payout_response.py +++ b/com/alipay/ams/api/response/marketplace/alipay_create_payout_response.py @@ -1,43 +1,105 @@ +import json +from com.alipay.ams.api.model.result import Result from com.alipay.ams.api.model.transfer_from_detail import TransferFromDetail from com.alipay.ams.api.model.transfer_to_detail import TransferToDetail -from com.alipay.ams.api.response.alipay_response import AlipayResponse -class AlipayCreatePayoutResponse(AlipayResponse): +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayCreatePayoutResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayCreatePayoutResponse, self).__init__() - self.__transfer_id = None - self.__transfer_request_id = None - self.__transfer_from_detail = None #type: TransferFromDetail - self.__transfer_to_detail = None #type: TransferToDetail - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__transfer_id = None # type: str + self.__transfer_request_id = None # type: str + self.__transfer_from_detail = None # type: TransferFromDetail + self.__transfer_to_detail = None # type: TransferToDetail + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipayCreatePayoutResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def transfer_id(self): + """ + The unique ID assigned by Antom to identify a payout. This parameter is returned when the value of result.resultStatus is U. More information: Maximum length: 64 characters + """ return self.__transfer_id + @transfer_id.setter + def transfer_id(self, value): + self.__transfer_id = value @property def transfer_request_id(self): + """ + The unique ID assigned by the marketplace to identify a payout request. This parameter is returned when the value of result.resultStatus is U. More information: Maximum length: 64 characters + """ return self.__transfer_request_id + @transfer_request_id.setter + def transfer_request_id(self, value): + self.__transfer_request_id = value @property def transfer_from_detail(self): + """Gets the transfer_from_detail of this AlipayCreatePayoutResponse. + + """ return self.__transfer_from_detail + @transfer_from_detail.setter + def transfer_from_detail(self, value): + self.__transfer_from_detail = value @property def transfer_to_detail(self): + """Gets the transfer_to_detail of this AlipayCreatePayoutResponse. + + """ return self.__transfer_to_detail - def __parse_rsp_body(self, rsp_body): - response = super(AlipayCreatePayoutResponse, self).parse_rsp_body(rsp_body) - if "transferId" in response: - self.__transfer_id = response["transferId"] - if "transferRequestId" in response: - self.__transfer_request_id = response["transferRequestId"] - if "transferFromDetail" in response: + @transfer_to_detail.setter + def transfer_to_detail(self, value): + self.__transfer_to_detail = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "transfer_id") and self.transfer_id is not None: + params['transferId'] = self.transfer_id + if hasattr(self, "transfer_request_id") and self.transfer_request_id is not None: + params['transferRequestId'] = self.transfer_request_id + if hasattr(self, "transfer_from_detail") and self.transfer_from_detail is not None: + params['transferFromDetail'] = self.transfer_from_detail + if hasattr(self, "transfer_to_detail") and self.transfer_to_detail is not None: + params['transferToDetail'] = self.transfer_to_detail + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayCreatePayoutResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'transferId' in response_body: + self.__transfer_id = response_body['transferId'] + if 'transferRequestId' in response_body: + self.__transfer_request_id = response_body['transferRequestId'] + if 'transferFromDetail' in response_body: self.__transfer_from_detail = TransferFromDetail() - self.__transfer_from_detail.parse_rsp_body(response["transferFromDetail"]) - if "transferToDetail" in response: + self.__transfer_from_detail.parse_rsp_body(response_body['transferFromDetail']) + if 'transferToDetail' in response_body: self.__transfer_to_detail = TransferToDetail() - self.__transfer_to_detail.parse_rsp_body(response["transferToDetail"]) \ No newline at end of file + self.__transfer_to_detail.parse_rsp_body(response_body['transferToDetail']) diff --git a/com/alipay/ams/api/response/marketplace/alipay_create_transfer_response.py b/com/alipay/ams/api/response/marketplace/alipay_create_transfer_response.py index fdfdf2b..126a9aa 100644 --- a/com/alipay/ams/api/response/marketplace/alipay_create_transfer_response.py +++ b/com/alipay/ams/api/response/marketplace/alipay_create_transfer_response.py @@ -1,43 +1,105 @@ +import json +from com.alipay.ams.api.model.result import Result from com.alipay.ams.api.model.transfer_from_detail import TransferFromDetail from com.alipay.ams.api.model.transfer_to_detail import TransferToDetail -from com.alipay.ams.api.response.alipay_response import AlipayResponse + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + class AlipayCreateTransferResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayCreateTransferResponse, self).__init__() - self.__transfer_id = None - self.__transfer_request_id = None - self.__transfer_from_detail = None #type: TransferFromDetail - self.__transfer_to_detail = None #type: TransferToDetail - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__transfer_id = None # type: str + self.__transfer_request_id = None # type: str + self.__transfer_from_detail = None # type: TransferFromDetail + self.__transfer_to_detail = None # type: TransferToDetail + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AlipayCreateTransferResponse. + + """ + return self.__result + @result.setter + def result(self, value): + self.__result = value @property def transfer_id(self): + """ + The unique ID assigned by Antom to identify a transfer. This parameter is returned when the value of result.resultStatus is U. More information: Maximum length: 64 characters + """ return self.__transfer_id + @transfer_id.setter + def transfer_id(self, value): + self.__transfer_id = value @property def transfer_request_id(self): + """ + The unique ID assigned by the marketplace to identify a transfer request. This parameter is returned when the value of result.resultStatus is U. More information: Maximum length: 64 characters + """ return self.__transfer_request_id - + @transfer_request_id.setter + def transfer_request_id(self, value): + self.__transfer_request_id = value @property def transfer_from_detail(self): + """Gets the transfer_from_detail of this AlipayCreateTransferResponse. + + """ return self.__transfer_from_detail + @transfer_from_detail.setter + def transfer_from_detail(self, value): + self.__transfer_from_detail = value @property def transfer_to_detail(self): + """Gets the transfer_to_detail of this AlipayCreateTransferResponse. + + """ return self.__transfer_to_detail - def __parse_rsp_body(self, rsp_body): - response = super(AlipayCreateTransferResponse, self).parse_rsp_body(rsp_body) - if "transferId" in response: - self.__transfer_id = response["transferId"] - if "transferRequestId" in response: - self.__transfer_request_id = response["transferRequestId"] - if "transferFromDetail" in response: + @transfer_to_detail.setter + def transfer_to_detail(self, value): + self.__transfer_to_detail = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "transfer_id") and self.transfer_id is not None: + params['transferId'] = self.transfer_id + if hasattr(self, "transfer_request_id") and self.transfer_request_id is not None: + params['transferRequestId'] = self.transfer_request_id + if hasattr(self, "transfer_from_detail") and self.transfer_from_detail is not None: + params['transferFromDetail'] = self.transfer_from_detail + if hasattr(self, "transfer_to_detail") and self.transfer_to_detail is not None: + params['transferToDetail'] = self.transfer_to_detail + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayCreateTransferResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'transferId' in response_body: + self.__transfer_id = response_body['transferId'] + if 'transferRequestId' in response_body: + self.__transfer_request_id = response_body['transferRequestId'] + if 'transferFromDetail' in response_body: self.__transfer_from_detail = TransferFromDetail() - self.__transfer_from_detail.parse_rsp_body(response["transferFromDetail"]) - if "transferToDetail" in response: + self.__transfer_from_detail.parse_rsp_body(response_body['transferFromDetail']) + if 'transferToDetail' in response_body: self.__transfer_to_detail = TransferToDetail() - self.__transfer_to_detail.parse_rsp_body(response["transferToDetail"]) + self.__transfer_to_detail.parse_rsp_body(response_body['transferToDetail']) diff --git a/com/alipay/ams/api/response/marketplace/alipay_inquire_balance_response.py b/com/alipay/ams/api/response/marketplace/alipay_inquire_balance_response.py index 6d78eb0..08e8676 100644 --- a/com/alipay/ams/api/response/marketplace/alipay_inquire_balance_response.py +++ b/com/alipay/ams/api/response/marketplace/alipay_inquire_balance_response.py @@ -1,26 +1,61 @@ +import json +from com.alipay.ams.api.model.result import Result from com.alipay.ams.api.model.account_balance import AccountBalance -from com.alipay.ams.api.response.alipay_response import AlipayResponse + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + class AlipayInquireBalanceResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayInquireBalanceResponse, self).__init__() - self.__account_balances = None #type: list[AccountBalance] - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__account_balances = None # type: [AccountBalance] + self.parse_rsp_body(rsp_body) + @property + def result(self): + """Gets the result of this AlipayInquireBalanceResponse. + + """ + return self.__result + @result.setter + def result(self, value): + self.__result = value @property def account_balances(self): + """ + The list of balance accounts assigned by Alipay. More information:Maximum length: 64 characters + """ return self.__account_balances + @account_balances.setter + def account_balances(self, value): + self.__account_balances = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "account_balances") and self.account_balances is not None: + params['accountBalances'] = self.account_balances + return params + - def __parse_rsp_body(self, rsp_body): - response = super(AlipayInquireBalanceResponse, self).parse_rsp_body(rsp_body) - if 'accountBalances' in response: - accountBalances = [] - for accountBalance_body in response['accountBalances']: - accountBalance = AccountBalance() - accountBalance.parse_rsp_body(accountBalance_body) - accountBalances.append(accountBalance) - self.__account_balances = accountBalances \ No newline at end of file + def parse_rsp_body(self, response_body): + response_body = super(AlipayInquireBalanceResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'accountBalances' in response_body: + self.__account_balances = [] + for item in response_body['accountBalances']: + obj = AccountBalance() + obj.parse_rsp_body(item) + self.__account_balances.append(obj) diff --git a/com/alipay/ams/api/response/marketplace/alipay_register_response.py b/com/alipay/ams/api/response/marketplace/alipay_register_response.py index 3a3c588..a1fb8a1 100644 --- a/com/alipay/ams/api/response/marketplace/alipay_register_response.py +++ b/com/alipay/ams/api/response/marketplace/alipay_register_response.py @@ -1,18 +1,56 @@ -from com.alipay.ams.api.response.alipay_response import AlipayResponse +import json +from com.alipay.ams.api.model.result import Result + + +from com.alipay.ams.api.response.alipay_response import AlipayResponse class AlipayRegisterResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayRegisterResponse, self).__init__() - self.__registration_status = None - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__registration_status = None # type: str + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipayRegisterResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def registration_status(self): + """ + The registration status of the merchant. The value of this parameter is fixed to PROCESSING. Get the sub-merchant's registration result from the notifyRegistration interface. This parameter is returned when the value of result.resultStatus is S. More information: Maximum length: 64 characters + """ return self.__registration_status - def __parse_rsp_body(self, rsp_body): - response = super(AlipayRegisterResponse, self).parse_rsp_body(rsp_body) - if 'registrationStatus' in response: - self.__registration_status = response['registrationStatus'] + @registration_status.setter + def registration_status(self, value): + self.__registration_status = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "registration_status") and self.registration_status is not None: + params['registrationStatus'] = self.registration_status + return params + + def parse_rsp_body(self, response_body): + response_body = super(AlipayRegisterResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'registrationStatus' in response_body: + self.__registration_status = response_body['registrationStatus'] diff --git a/com/alipay/ams/api/response/marketplace/alipay_settle_response.py b/com/alipay/ams/api/response/marketplace/alipay_settle_response.py index 04cfbb4..f845df3 100644 --- a/com/alipay/ams/api/response/marketplace/alipay_settle_response.py +++ b/com/alipay/ams/api/response/marketplace/alipay_settle_response.py @@ -1,25 +1,71 @@ -from com.alipay.ams.api.response.alipay_response import AlipayResponse +import json +from com.alipay.ams.api.model.result import Result + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + class AlipaySettleResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipaySettleResponse, self).__init__() - self.__settlement_request_id = None - self.__settlement_id = None - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__settlement_request_id = None # type: str + self.__settlement_id = None # type: str + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AlipaySettleResponse. + + """ + return self.__result + @result.setter + def result(self, value): + self.__result = value @property def settlement_request_id(self): + """ + The unique ID that is assigned by the marketplace to identify a settlement request. More information: Maximum length: 64 characters + """ return self.__settlement_request_id - + @settlement_request_id.setter + def settlement_request_id(self, value): + self.__settlement_request_id = value @property def settlement_id(self): + """ + The unique ID that is assigned by Antom to identify a settlement. More information: Maximum length: 64 characters + """ return self.__settlement_id - def __parse_rsp_body(self, rsp_body): - response = super(AlipaySettleResponse, self).parse_rsp_body(rsp_body) - if 'settlementRequestId' in response: - self.__settlement_request_id = response['settlementRequestId'] - if 'settlementId' in response: - self.__settlement_id = response['settlementId'] \ No newline at end of file + @settlement_id.setter + def settlement_id(self, value): + self.__settlement_id = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "settlement_request_id") and self.settlement_request_id is not None: + params['settlementRequestId'] = self.settlement_request_id + if hasattr(self, "settlement_id") and self.settlement_id is not None: + params['settlementId'] = self.settlement_id + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipaySettleResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'settlementRequestId' in response_body: + self.__settlement_request_id = response_body['settlementRequestId'] + if 'settlementId' in response_body: + self.__settlement_id = response_body['settlementId'] diff --git a/com/alipay/ams/api/response/marketplace/alipay_settlement_info_update_response.py b/com/alipay/ams/api/response/marketplace/alipay_settlement_info_update_response.py index 50eab0e..771be1a 100644 --- a/com/alipay/ams/api/response/marketplace/alipay_settlement_info_update_response.py +++ b/com/alipay/ams/api/response/marketplace/alipay_settlement_info_update_response.py @@ -1,17 +1,56 @@ -from com.alipay.ams.api.response.alipay_response import AlipayResponse +import json +from com.alipay.ams.api.model.result import Result + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + class AlipaySettlementInfoUpdateResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipaySettlementInfoUpdateResponse, self).__init__() - self.__update_status = None - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__update_status = None # type: str + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipaySettlementInfoUpdateResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def update_status(self): + """ + The update status of the settlement information. The value of this parameter is fixed to PROCESSING. Get the settlement information update result from the notifyUpdate and inquireUpdate interfaces. This parameter is returned when the value of result.resultStatus is S. More information: Maximum length: 64 characters + """ return self.__update_status - def __parse_rsp_body(self, rsp_body): - response = super(AlipaySettlementInfoUpdateResponse, self).parse_rsp_body(rsp_body) - if 'updateStatus' in response: - self.__update_status = response['updateStatus'] \ No newline at end of file + @update_status.setter + def update_status(self, value): + self.__update_status = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "update_status") and self.update_status is not None: + params['updateStatus'] = self.update_status + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipaySettlementInfoUpdateResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'updateStatus' in response_body: + self.__update_status = response_body['updateStatus'] diff --git a/com/alipay/ams/api/response/marketplace/alipay_submit_attachment_response.py b/com/alipay/ams/api/response/marketplace/alipay_submit_attachment_response.py index c736cbb..ef88de7 100644 --- a/com/alipay/ams/api/response/marketplace/alipay_submit_attachment_response.py +++ b/com/alipay/ams/api/response/marketplace/alipay_submit_attachment_response.py @@ -1,26 +1,88 @@ +import json +from com.alipay.ams.api.model.result import Result from com.alipay.ams.api.model.attachment_type import AttachmentType -from com.alipay.ams.api.response.alipay_response import AlipayResponse + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + class AlipaySubmitAttachmentResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipaySubmitAttachmentResponse, self).__init__() - self.__submit_attachment_request_id = None - self.__attachment_type = None #type: AttachmentType - self.__attachment_key = None - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__submit_attachment_request_id = None # type: str + self.__attachment_type = None # type: AttachmentType + self.__attachment_key = None # type: str + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipaySubmitAttachmentResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def submit_attachment_request_id(self): + """ + The unique ID assigned by the marketplace to identify an attachment submission request. This parameter is returned when the value of result.resultStatus is S. More information: Maximum length: 32 characters + """ return self.__submit_attachment_request_id + @submit_attachment_request_id.setter + def submit_attachment_request_id(self, value): + self.__submit_attachment_request_id = value @property def attachment_type(self): + """Gets the attachment_type of this AlipaySubmitAttachmentResponse. + + """ return self.__attachment_type + @attachment_type.setter + def attachment_type(self, value): + self.__attachment_type = value @property def attachment_key(self): + """ + The unique key value of the attachment that you submit. The value of this parameter is used by the fileKeys or fileKey parameters in the register API. This parameter is returned when the value of result.resultStatus is S. More information: Maximum length: 256 characters + """ return self.__attachment_key - def __parse_rsp_body(self, rsp_body): - response = super(AlipaySubmitAttachmentResponse, self).parse_rsp_body(rsp_body) \ No newline at end of file + @attachment_key.setter + def attachment_key(self, value): + self.__attachment_key = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "submit_attachment_request_id") and self.submit_attachment_request_id is not None: + params['submitAttachmentRequestId'] = self.submit_attachment_request_id + if hasattr(self, "attachment_type") and self.attachment_type is not None: + params['attachmentType'] = self.attachment_type + if hasattr(self, "attachment_key") and self.attachment_key is not None: + params['attachmentKey'] = self.attachment_key + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipaySubmitAttachmentResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'submitAttachmentRequestId' in response_body: + self.__submit_attachment_request_id = response_body['submitAttachmentRequestId'] + if 'attachmentType' in response_body: + attachment_type_temp = AttachmentType.value_of(response_body['attachmentType']) + self.__attachment_type = attachment_type_temp + if 'attachmentKey' in response_body: + self.__attachment_key = response_body['attachmentKey'] diff --git a/com/alipay/ams/api/response/pay/alipay_capture_response.py b/com/alipay/ams/api/response/pay/alipay_capture_response.py index 43984c8..47ee28e 100644 --- a/com/alipay/ams/api/response/pay/alipay_capture_response.py +++ b/com/alipay/ams/api/response/pay/alipay_capture_response.py @@ -1,59 +1,133 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - +import json +from com.alipay.ams.api.model.result import Result from com.alipay.ams.api.model.amount import Amount -from com.alipay.ams.api.response.alipay_response import AlipayResponse -class AlipayCaptureResponse(AlipayResponse): +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayCaptureResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayCaptureResponse, self).__init__() - self.__capture_request_id = None - self.__capture_id = None - self.__payment_id = None + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__capture_request_id = None # type: str + self.__capture_id = None # type: str + self.__payment_id = None # type: str self.__capture_amount = None # type: Amount - self.__capture_time = None - self.__acquirer_reference_no = None - self.__parse_rsp_body(rsp_body) + self.__capture_time = None # type: str + self.__acquirer_reference_no = None # type: str + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipayCaptureResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def capture_request_id(self): + """ + The unique ID that is assigned by a merchant to identify a capture request. Note: This parameter is returned when the capture status is successful. More information: Maximum length: 64 characters + """ return self.__capture_request_id + @capture_request_id.setter + def capture_request_id(self, value): + self.__capture_request_id = value @property def capture_id(self): + """ + The unique ID that is assigned by Antom to identify a capture. Note: This parameter is returned when the capture status is successful. More information: Maximum length: 64 characters + """ return self.__capture_id + @capture_id.setter + def capture_id(self, value): + self.__capture_id = value @property def payment_id(self): + """ + The unique ID that is assigned by Antom to identify a payment. Note: This parameter is returned when the capture status is successful. More information: Maximum length: 64 characters + """ return self.__payment_id + @payment_id.setter + def payment_id(self, value): + self.__payment_id = value @property def capture_amount(self): + """Gets the capture_amount of this AlipayCaptureResponse. + + """ return self.__capture_amount + @capture_amount.setter + def capture_amount(self, value): + self.__capture_amount = value @property def capture_time(self): + """ + The time when Antom captures the payment. Note: This parameter is returned when the capture status is successful. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__capture_time + @capture_time.setter + def capture_time(self, value): + self.__capture_time = value @property - def acquirer__reference__no(self): + def acquirer_reference_no(self): + """ + The unique ID assigned by the non-Antom acquirer for the transaction. More information: Maximum length: 64 characters + """ return self.__acquirer_reference_no - def __parse_rsp_body(self, rsp_body): - response = super(AlipayCaptureResponse, self).parse_rsp_body(rsp_body) - if 'captureRequestId' in response: - self.__capture_request_id = response['captureRequestId'] - if 'paymentId' in response: - self.__payment_id = response['paymentId'] - if 'captureId' in response: - self.__capture_id = response['captureId'] - if 'captureAmount' in response: - capture_amount = Amount() - capture_amount.parse_rsp_body(response['captureAmount']) - self.__capture_amount = capture_amount - if 'captureTime' in response: - self.__capture_time = response['captureTime'] - if 'acquirerReferenceNo' in response: - self.__acquirer_reference_no = response['acquirerReferenceNo'] + @acquirer_reference_no.setter + def acquirer_reference_no(self, value): + self.__acquirer_reference_no = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "capture_request_id") and self.capture_request_id is not None: + params['captureRequestId'] = self.capture_request_id + if hasattr(self, "capture_id") and self.capture_id is not None: + params['captureId'] = self.capture_id + if hasattr(self, "payment_id") and self.payment_id is not None: + params['paymentId'] = self.payment_id + if hasattr(self, "capture_amount") and self.capture_amount is not None: + params['captureAmount'] = self.capture_amount + if hasattr(self, "capture_time") and self.capture_time is not None: + params['captureTime'] = self.capture_time + if hasattr(self, "acquirer_reference_no") and self.acquirer_reference_no is not None: + params['acquirerReferenceNo'] = self.acquirer_reference_no + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayCaptureResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'captureRequestId' in response_body: + self.__capture_request_id = response_body['captureRequestId'] + if 'captureId' in response_body: + self.__capture_id = response_body['captureId'] + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'captureAmount' in response_body: + self.__capture_amount = Amount() + self.__capture_amount.parse_rsp_body(response_body['captureAmount']) + if 'captureTime' in response_body: + self.__capture_time = response_body['captureTime'] + if 'acquirerReferenceNo' in response_body: + self.__acquirer_reference_no = response_body['acquirerReferenceNo'] diff --git a/com/alipay/ams/api/response/pay/alipay_inquiry_refund_response.py b/com/alipay/ams/api/response/pay/alipay_inquiry_refund_response.py new file mode 100644 index 0000000..c5a95bc --- /dev/null +++ b/com/alipay/ams/api/response/pay/alipay_inquiry_refund_response.py @@ -0,0 +1,171 @@ +import json +from com.alipay.ams.api.model.result import Result +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.transaction_status_type import TransactionStatusType +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.quote import Quote +from com.alipay.ams.api.model.acquirer_info import AcquirerInfo + + + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayInquiryRefundResponse(AlipayResponse): + def __init__(self, rsp_body): + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__refund_id = None # type: str + self.__refund_request_id = None # type: str + self.__refund_amount = None # type: Amount + self.__refund_status = None # type: TransactionStatusType + self.__refund_time = None # type: str + self.__gross_settlement_amount = None # type: Amount + self.__settlement_quote = None # type: Quote + self.__acquirer_info = None # type: AcquirerInfo + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AlipayInquiryRefundResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value + @property + def refund_id(self): + """ + The unique ID assigned by Antom to identify a refund. A one-to-one correspondence between refundId and refundRequestId exists. Note: This field is null when the refund record cannot be found, or result.resultStatus is F or U. + """ + return self.__refund_id + + @refund_id.setter + def refund_id(self, value): + self.__refund_id = value + @property + def refund_request_id(self): + """ + The unique ID assigned by the merchant to identify a refund request. Note: This field is null when the refund record cannot be found, or result.resultStatus is F or U. More information: Maximum length: 64 characters + """ + return self.__refund_request_id + + @refund_request_id.setter + def refund_request_id(self, value): + self.__refund_request_id = value + @property + def refund_amount(self): + """Gets the refund_amount of this AlipayInquiryRefundResponse. + + """ + return self.__refund_amount + + @refund_amount.setter + def refund_amount(self, value): + self.__refund_amount = value + @property + def refund_status(self): + """Gets the refund_status of this AlipayInquiryRefundResponse. + + """ + return self.__refund_status + + @refund_status.setter + def refund_status(self, value): + self.__refund_status = value + @property + def refund_time(self): + """ + The date and time when the refund reaches a final state of success on the Antom side, not the Alipay+ Mobile Payment Provider (Alipay+ payment methods) side. Note: This field is returned when the value of refundStatus is SUCCESS. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ + return self.__refund_time + + @refund_time.setter + def refund_time(self, value): + self.__refund_time = value + @property + def gross_settlement_amount(self): + """Gets the gross_settlement_amount of this AlipayInquiryRefundResponse. + + """ + return self.__gross_settlement_amount + + @gross_settlement_amount.setter + def gross_settlement_amount(self, value): + self.__gross_settlement_amount = value + @property + def settlement_quote(self): + """Gets the settlement_quote of this AlipayInquiryRefundResponse. + + """ + return self.__settlement_quote + + @settlement_quote.setter + def settlement_quote(self, value): + self.__settlement_quote = value + @property + def acquirer_info(self): + """Gets the acquirer_info of this AlipayInquiryRefundResponse. + + """ + return self.__acquirer_info + + @acquirer_info.setter + def acquirer_info(self, value): + self.__acquirer_info = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "refund_id") and self.refund_id is not None: + params['refundId'] = self.refund_id + if hasattr(self, "refund_request_id") and self.refund_request_id is not None: + params['refundRequestId'] = self.refund_request_id + if hasattr(self, "refund_amount") and self.refund_amount is not None: + params['refundAmount'] = self.refund_amount + if hasattr(self, "refund_status") and self.refund_status is not None: + params['refundStatus'] = self.refund_status + if hasattr(self, "refund_time") and self.refund_time is not None: + params['refundTime'] = self.refund_time + if hasattr(self, "gross_settlement_amount") and self.gross_settlement_amount is not None: + params['grossSettlementAmount'] = self.gross_settlement_amount + if hasattr(self, "settlement_quote") and self.settlement_quote is not None: + params['settlementQuote'] = self.settlement_quote + if hasattr(self, "acquirer_info") and self.acquirer_info is not None: + params['acquirerInfo'] = self.acquirer_info + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayInquiryRefundResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'refundId' in response_body: + self.__refund_id = response_body['refundId'] + if 'refundRequestId' in response_body: + self.__refund_request_id = response_body['refundRequestId'] + if 'refundAmount' in response_body: + self.__refund_amount = Amount() + self.__refund_amount.parse_rsp_body(response_body['refundAmount']) + if 'refundStatus' in response_body: + refund_status_temp = TransactionStatusType.value_of(response_body['refundStatus']) + self.__refund_status = refund_status_temp + if 'refundTime' in response_body: + self.__refund_time = response_body['refundTime'] + if 'grossSettlementAmount' in response_body: + self.__gross_settlement_amount = Amount() + self.__gross_settlement_amount.parse_rsp_body(response_body['grossSettlementAmount']) + if 'settlementQuote' in response_body: + self.__settlement_quote = Quote() + self.__settlement_quote.parse_rsp_body(response_body['settlementQuote']) + if 'acquirerInfo' in response_body: + self.__acquirer_info = AcquirerInfo() + self.__acquirer_info.parse_rsp_body(response_body['acquirerInfo']) diff --git a/com/alipay/ams/api/response/pay/alipay_pay_cancel_response.py b/com/alipay/ams/api/response/pay/alipay_pay_cancel_response.py index 39f6449..f5c5a99 100644 --- a/com/alipay/ams/api/response/pay/alipay_pay_cancel_response.py +++ b/com/alipay/ams/api/response/pay/alipay_pay_cancel_response.py @@ -1,34 +1,86 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json +from com.alipay.ams.api.model.result import Result + -from com.alipay.ams.api.response.alipay_response import AlipayResponse +from com.alipay.ams.api.response.alipay_response import AlipayResponse class AlipayPayCancelResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayPayCancelResponse, self).__init__() - self.__payment_id = None - self.__payment_request_id = None - self.__cancel_time = None - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__payment_id = None # type: str + self.__payment_request_id = None # type: str + self.__cancel_time = None # type: str + self.parse_rsp_body(rsp_body) + @property - def payment_request_id(self): - return self.__payment_request_id + def result(self): + """Gets the result of this AlipayPayCancelResponse. + + """ + return self.__result + @result.setter + def result(self, value): + self.__result = value @property def payment_id(self): + """ + The unique ID that is assigned by Antom to identify a payment. Note: This field is returned when the cancellation succeeds (the value of result.resultStatus is S). More information: Maximum length: 64 characters + """ return self.__payment_id + @payment_id.setter + def payment_id(self, value): + self.__payment_id = value + @property + def payment_request_id(self): + """ + The unique ID that is assigned by a merchant to identify a payment request. Note: This field is returned when the cancellation succeeds (the value of result.resultStatus is S). More information: Maximum length: 64 characters + """ + return self.__payment_request_id + + @payment_request_id.setter + def payment_request_id(self, value): + self.__payment_request_id = value @property def cancel_time(self): + """ + The actual execution completion time of the payment cancellation process, which is the date and time when the payment cancellation succeeds. Note: This field is returned when the cancellation succeeds (the value of result.resultStatus is S). More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__cancel_time - def __parse_rsp_body(self, rsp_body): - response = super(AlipayPayCancelResponse, self).parse_rsp_body(rsp_body) - if 'paymentRequestId' in response: - self.__payment_request_id = response['paymentRequestId'] - if 'paymentId' in response: - self.__payment_id = response['paymentId'] - if 'cancelTime' in response: - self.__cancel_time = response['cancelTime'] + @cancel_time.setter + def cancel_time(self, value): + self.__cancel_time = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "payment_id") and self.payment_id is not None: + params['paymentId'] = self.payment_id + if hasattr(self, "payment_request_id") and self.payment_request_id is not None: + params['paymentRequestId'] = self.payment_request_id + if hasattr(self, "cancel_time") and self.cancel_time is not None: + params['cancelTime'] = self.cancel_time + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayPayCancelResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'paymentRequestId' in response_body: + self.__payment_request_id = response_body['paymentRequestId'] + if 'cancelTime' in response_body: + self.__cancel_time = response_body['cancelTime'] diff --git a/com/alipay/ams/api/response/pay/alipay_pay_consult_response.py b/com/alipay/ams/api/response/pay/alipay_pay_consult_response.py index 242a54b..cff1a6a 100644 --- a/com/alipay/ams/api/response/pay/alipay_pay_consult_response.py +++ b/com/alipay/ams/api/response/pay/alipay_pay_consult_response.py @@ -1,41 +1,96 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from com.alipay.ams.api.model.payment_method_info import PaymentMethodInfo +import json +from com.alipay.ams.api.model.result import Result from com.alipay.ams.api.model.payment_option import PaymentOption -from com.alipay.ams.api.response.alipay_response import AlipayResponse +from com.alipay.ams.api.model.payment_method_info import PaymentMethodInfo -class AlipayPayConsultResponse(AlipayResponse): +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayPayConsultResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayPayConsultResponse, self).__init__() - self.__payment_options = None # type:PaymentOption - self.__payment_method_infos = None - self.__extend_info = None - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__payment_options = None # type: [PaymentOption] + self.__payment_method_infos = None # type: [PaymentMethodInfo] + self.__extend_info = None # type: str + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipayPayConsultResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def payment_options(self): + """ + The payment option list. + """ return self.__payment_options + @payment_options.setter + def payment_options(self, value): + self.__payment_options = value @property def payment_method_infos(self): + """Gets the payment_method_infos of this AlipayPayConsultResponse. + + """ return self.__payment_method_infos + @payment_method_infos.setter + def payment_method_infos(self, value): + self.__payment_method_infos = value @property def extend_info(self): + """Gets the extend_info of this AlipayPayConsultResponse. + + """ return self.__extend_info - def __parse_rsp_body(self, rsp_body): - response = super(AlipayPayConsultResponse, self).parse_rsp_body(rsp_body) - if 'paymentOptions' in response: - payment_options = PaymentOption() - payment_options.parse_rsp_body(response['paymentOptions']) - self.__payment_options = payment_options - if 'paymentMethodInfos' in response: - payment_method_infos = PaymentMethodInfo() - payment_method_infos.parse_rsp_body(response['paymentMethodInfos']) - self.__payment_method_infos = payment_method_infos - if 'extendInfo' in response: - self.__extend_info = response['extendInfo'] + @extend_info.setter + def extend_info(self, value): + self.__extend_info = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "payment_options") and self.payment_options is not None: + params['paymentOptions'] = self.payment_options + if hasattr(self, "payment_method_infos") and self.payment_method_infos is not None: + params['paymentMethodInfos'] = self.payment_method_infos + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayPayConsultResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'paymentOptions' in response_body: + self.__payment_options = [] + for item in response_body['paymentOptions']: + obj = PaymentOption() + obj.parse_rsp_body(item) + self.__payment_options.append(obj) + if 'paymentMethodInfos' in response_body: + self.__payment_method_infos = [] + for item in response_body['paymentMethodInfos']: + obj = PaymentMethodInfo() + obj.parse_rsp_body(item) + self.__payment_method_infos.append(obj) + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] diff --git a/com/alipay/ams/api/response/pay/alipay_pay_query_response.py b/com/alipay/ams/api/response/pay/alipay_pay_query_response.py index 1e452c5..294d8f3 100644 --- a/com/alipay/ams/api/response/pay/alipay_pay_query_response.py +++ b/com/alipay/ams/api/response/pay/alipay_pay_query_response.py @@ -1,245 +1,497 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json +from com.alipay.ams.api.model.result import Result +from com.alipay.ams.api.model.transaction_status_type import TransactionStatusType +from com.alipay.ams.api.model.amount import Amount from com.alipay.ams.api.model.amount import Amount -from com.alipay.ams.api.model.payment_result_info import PaymentResultInfo -from com.alipay.ams.api.model.promotion_result import PromotionResult -from com.alipay.ams.api.model.psp_customer_info import PspCustomerInfo from com.alipay.ams.api.model.quote import Quote +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.psp_customer_info import PspCustomerInfo from com.alipay.ams.api.model.redirect_action_form import RedirectActionForm +from com.alipay.ams.api.model.card_info import CardInfo from com.alipay.ams.api.model.transaction import Transaction -from com.alipay.ams.api.model.transaction_status_type import TransactionStatusType -from com.alipay.ams.api.response.alipay_response import AlipayResponse +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.quote import Quote +from com.alipay.ams.api.model.payment_result_info import PaymentResultInfo +from com.alipay.ams.api.model.acquirer_info import AcquirerInfo +from com.alipay.ams.api.model.promotion_result import PromotionResult -class AlipayPayQueryResponse(AlipayResponse): +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayPayQueryResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayPayQueryResponse, self).__init__() + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result self.__payment_status = None # type: TransactionStatusType - self.__payment_result_code = None - self.__payment_result_message = None - self.__payment_request_id = None - self.__payment_id = None - self.__auth_payment_id = None + self.__payment_result_code = None # type: str + self.__payment_result_message = None # type: str + self.__payment_request_id = None # type: str + self.__payment_id = None # type: str + self.__auth_payment_id = None # type: str self.__payment_amount = None # type: Amount - self.__actual_payment_amount = None + self.__actual_payment_amount = None # type: Amount self.__payment_quote = None # type: Quote - self.__auth_expiry_time = None - self.__payment_create_time = None - self.__payment_time = None - self.__non_guarantee_coupon_amount = None + self.__auth_expiry_time = None # type: str + self.__payment_create_time = None # type: str + self.__payment_time = None # type: str + self.__non_guarantee_coupon_amount = None # type: Amount self.__psp_customer_info = None # type: PspCustomerInfo self.__redirect_action_form = None # type: RedirectActionForm - self.__extend_info = None - self.__transactions = None # type: list[Transaction] + self.__card_info = None # type: CardInfo + self.__acquirer_reference_no = None # type: str + self.__extend_info = None # type: str + self.__transactions = None # type: [Transaction] self.__customs_declaration_amount = None # type: Amount self.__gross_settlement_amount = None # type: Amount self.__settlement_quote = None # type: Quote - self.__acquirer_reference_no = None self.__payment_result_info = None # type: PaymentResultInfo - self.__promotion_results = None # type: PromotionResult - self.__earliest_settlement_time = None - self.__parse_rsp_body(rsp_body) + self.__acquirer_info = None # type: AcquirerInfo + self.__merchant_account_id = None # type: str + self.__promotion_results = None # type: [PromotionResult] + self.__earliest_settlement_time = None # type: str + self.__payment_method_type = None # type: str + self.parse_rsp_body(rsp_body) - @property - def customs_declaration_amount(self): - return self.__customs_declaration_amount - - @property - def gross_settlement_amount(self): - return self.__gross_settlement_amount @property - def settlement_quote(self): - return self.__settlement_quote - + def result(self): + """Gets the result of this AlipayPayQueryResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def payment_status(self): + """Gets the payment_status of this AlipayPayQueryResponse. + + """ return self.__payment_status + @payment_status.setter + def payment_status(self, value): + self.__payment_status = value @property def payment_result_code(self): + """ + The result code for different payment statuses. Possible payment result codes are listed in the Payment result codes table on this page. Note: This field is returned when the API is called successfully (the value of result.resultStatus is S). More information: Maximum length: 64 characters + """ return self.__payment_result_code + @payment_result_code.setter + def payment_result_code(self, value): + self.__payment_result_code = value @property def payment_result_message(self): + """ + The result message that explains the payment result code. Note: This field is returned when the API is called successfully (the value of result.resultStatus is S). More information: Maximum length: 256 characters + """ return self.__payment_result_message + @payment_result_message.setter + def payment_result_message(self, value): + self.__payment_result_message = value @property def payment_request_id(self): + """ + The unique ID that is assigned by a merchant to identify a payment request. Note: This field is returned when the API is called successfully (the value of result.resultStatus is S). More information: Maximum length: 64 characters + """ return self.__payment_request_id + @payment_request_id.setter + def payment_request_id(self, value): + self.__payment_request_id = value @property def payment_id(self): + """ + The unique ID that is assigned by Antom to identify a payment. Note: This field is returned when the API is called successfully (the value of result.resultStatus is S). More information: Maximum length: 64 characters + """ return self.__payment_id + @payment_id.setter + def payment_id(self, value): + self.__payment_id = value @property def auth_payment_id(self): + """Gets the auth_payment_id of this AlipayPayQueryResponse. + + """ return self.__auth_payment_id + @auth_payment_id.setter + def auth_payment_id(self, value): + self.__auth_payment_id = value @property def payment_amount(self): + """Gets the payment_amount of this AlipayPayQueryResponse. + + """ return self.__payment_amount + @payment_amount.setter + def payment_amount(self, value): + self.__payment_amount = value @property def actual_payment_amount(self): + """Gets the actual_payment_amount of this AlipayPayQueryResponse. + + """ return self.__actual_payment_amount + @actual_payment_amount.setter + def actual_payment_amount(self, value): + self.__actual_payment_amount = value @property def payment_quote(self): + """Gets the payment_quote of this AlipayPayQueryResponse. + + """ return self.__payment_quote + @payment_quote.setter + def payment_quote(self, value): + self.__payment_quote = value @property def auth_expiry_time(self): + """ + The expiration date and time of the authorization payment. You cannot capture the payment after this time. This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD. More information about this field: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__auth_expiry_time + @auth_expiry_time.setter + def auth_expiry_time(self, value): + self.__auth_expiry_time = value @property def payment_create_time(self): + """ + The date and time when the payment is created. Note: This field is returned when the API is called successfully (the value of result.resultStatus is S). More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__payment_create_time + @payment_create_time.setter + def payment_create_time(self, value): + self.__payment_create_time = value @property def payment_time(self): + """ + The date and time when the payment reaches a final state of success. Note: This field is returned only when the payment reaches a final state of success (the value of paymentStatus is SUCCESS). More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__payment_time + @payment_time.setter + def payment_time(self, value): + self.__payment_time = value @property def non_guarantee_coupon_amount(self): + """Gets the non_guarantee_coupon_amount of this AlipayPayQueryResponse. + + """ return self.__non_guarantee_coupon_amount + @non_guarantee_coupon_amount.setter + def non_guarantee_coupon_amount(self, value): + self.__non_guarantee_coupon_amount = value @property def psp_customer_info(self): + """Gets the psp_customer_info of this AlipayPayQueryResponse. + + """ return self.__psp_customer_info + @psp_customer_info.setter + def psp_customer_info(self, value): + self.__psp_customer_info = value @property def redirect_action_form(self): + """Gets the redirect_action_form of this AlipayPayQueryResponse. + + """ return self.__redirect_action_form + @redirect_action_form.setter + def redirect_action_form(self, value): + self.__redirect_action_form = value + @property + def card_info(self): + """Gets the card_info of this AlipayPayQueryResponse. + + """ + return self.__card_info + + @card_info.setter + def card_info(self, value): + self.__card_info = value + @property + def acquirer_reference_no(self): + """ + The unique ID assigned by the non-Antom acquirer for the transaction. More information: Maximum length: 64 characters + """ + return self.__acquirer_reference_no + + @acquirer_reference_no.setter + def acquirer_reference_no(self, value): + self.__acquirer_reference_no = value @property def extend_info(self): + """Gets the extend_info of this AlipayPayQueryResponse. + + """ return self.__extend_info + @extend_info.setter + def extend_info(self, value): + self.__extend_info = value @property def transactions(self): + """ + Information about the subsequent action against a transaction. Note: This parameter is returned when a refund or a capture against the transaction exists. + """ return self.__transactions + @transactions.setter + def transactions(self, value): + self.__transactions = value @property - def acquirer_reference_no(self): - return self.__acquirer_reference_no + def customs_declaration_amount(self): + """Gets the customs_declaration_amount of this AlipayPayQueryResponse. + + """ + return self.__customs_declaration_amount + @customs_declaration_amount.setter + def customs_declaration_amount(self, value): + self.__customs_declaration_amount = value + @property + def gross_settlement_amount(self): + """Gets the gross_settlement_amount of this AlipayPayQueryResponse. + + """ + return self.__gross_settlement_amount + + @gross_settlement_amount.setter + def gross_settlement_amount(self, value): + self.__gross_settlement_amount = value + @property + def settlement_quote(self): + """Gets the settlement_quote of this AlipayPayQueryResponse. + + """ + return self.__settlement_quote + + @settlement_quote.setter + def settlement_quote(self, value): + self.__settlement_quote = value @property def payment_result_info(self): + """Gets the payment_result_info of this AlipayPayQueryResponse. + + """ return self.__payment_result_info + @payment_result_info.setter + def payment_result_info(self, value): + self.__payment_result_info = value + @property + def acquirer_info(self): + """Gets the acquirer_info of this AlipayPayQueryResponse. + + """ + return self.__acquirer_info + + @acquirer_info.setter + def acquirer_info(self, value): + self.__acquirer_info = value + @property + def merchant_account_id(self): + """Gets the merchant_account_id of this AlipayPayQueryResponse. + + """ + return self.__merchant_account_id + + @merchant_account_id.setter + def merchant_account_id(self, value): + self.__merchant_account_id = value @property def promotion_results(self): + """ + Promotion result. Note: This parameter is returned when the buyer applied a promotion while placing an order. + """ return self.__promotion_results + @promotion_results.setter + def promotion_results(self, value): + self.__promotion_results = value @property def earliest_settlement_time(self): + """Gets the earliest_settlement_time of this AlipayPayQueryResponse. + + """ return self.__earliest_settlement_time - def __parse_rsp_body(self, rsp_body): - response = super(AlipayPayQueryResponse, self).parse_rsp_body(rsp_body) - - if 'paymentStatus' in response: - payment_status = TransactionStatusType.value_of(response['paymentStatus']) - self.__payment_status = payment_status - - if 'paymentRequestId' in response: - self.__payment_request_id = response['paymentRequestId'] - - if 'paymentResultCode' in response: - self.__payment_result_code = response['paymentResultCode'] - - if 'paymentResultMessage' in response: - self.__payment_result_message = response['paymentResultMessage'] - - if 'paymentId' in response: - self.__payment_id = response['paymentId'] - - if 'paymentRequestId' in response: - self.__payment_request_id = response['paymentRequestId'] - - if 'authPaymentId' in response: - self.__auth_payment_id = response['authPaymentId'] - - if 'paymentAmount' in response: - payment_amount = Amount() - payment_amount.parse_rsp_body(response['paymentAmount']) - self.__payment_amount = payment_amount - - if 'actualPaymentAmount' in response: - actual_payment_amount = Amount() - actual_payment_amount.parse_rsp_body(response['actualPaymentAmount']) - self.__actual_payment_amount = actual_payment_amount - - if 'paymentQuote' in response: - quote = Quote() - quote.parse_rsp_body(response['paymentQuote']) - self.__payment_quote = quote - - if 'paymentTime' in response: - self.__payment_time = response['paymentTime'] - - if 'paymentCreateTime' in response: - self.__payment_create_time = response['paymentCreateTime'] - - if 'authExpiryTime' in response: - self.__auth_expiry_time = response['authExpiryTime'] - - if 'nonGuaranteeCouponValue' in response: - self.__non_guarantee_coupon_value = response['nonGuaranteeCouponValue'] - - if 'paymentActionForm' in response: - self.__payment_action_form = response['paymentActionForm'] - - if 'pspCustomerInfo' in response: - psp_customer_info = PspCustomerInfo() - psp_customer_info.parse_rsp_body(response['pspCustomerInfo']) - self.__psp_customer_info = psp_customer_info - - if 'redirectActionForm' in response: - redirect_action_form = RedirectActionForm() - redirect_action_form.parse_rsp_body(response['redirectActionForm']) - self.__redirect_action_form = redirect_action_form - - if 'extendInfo' in response: - self.__extend_info = response['extendInfo'] - - if 'transactions' in response: - transactions = [] - for transaction_body in response['transactions']: - transaction = Transaction() - transaction.parse_rsp_body(transaction_body) - transactions.append(transaction) - self.__transactions = transactions - - if 'customsDeclarationAmount' in response: - customs_declaration_amount = Amount() - customs_declaration_amount.parse_rsp_body(response['customsDeclarationAmount']) - self.__customs_declaration_amount = customs_declaration_amount - - if 'grossSettlementAmount' in response: - gross_settlement_amount = Amount() - gross_settlement_amount.parse_rsp_body(response['grossSettlementAmount']) - self.__gross_settlement_amount = gross_settlement_amount - - if 'settlementQuote' in response: - settlement_quote = Quote() - settlement_quote.parse_rsp_body(response['settlementQuote']) - self.__settlement_quote = settlement_quote - - if 'acquirerReferenceNo' in response: - self.__acquirer_reference_no = response['acquirerReferenceNo'] - - if 'paymentResultInfo' in response: - payment_result_info = PaymentResultInfo() - payment_result_info.parse_rsp_body(response['paymentResultInfo']) - self.__payment_result_info = payment_result_info - - if 'promotionResults' in response: - promotion_results = PromotionResult() - promotion_results.parse_rsp_body(response['promotionResults']) - self.__promotion_results = promotion_results - - if 'earliestSettlementTime' in response: - self.__earliest_settlement_time = response['earliestSettlementTime'] + @earliest_settlement_time.setter + def earliest_settlement_time(self, value): + self.__earliest_settlement_time = value + @property + def payment_method_type(self): + """ + The payment method type that is included in payment method options. See Payment methods to check the valid values. Note: This field will be returned when selecting the Antom Chechkout Page integration. More information: Maximum length: 64 characters + """ + return self.__payment_method_type + + @payment_method_type.setter + def payment_method_type(self, value): + self.__payment_method_type = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "payment_status") and self.payment_status is not None: + params['paymentStatus'] = self.payment_status + if hasattr(self, "payment_result_code") and self.payment_result_code is not None: + params['paymentResultCode'] = self.payment_result_code + if hasattr(self, "payment_result_message") and self.payment_result_message is not None: + params['paymentResultMessage'] = self.payment_result_message + if hasattr(self, "payment_request_id") and self.payment_request_id is not None: + params['paymentRequestId'] = self.payment_request_id + if hasattr(self, "payment_id") and self.payment_id is not None: + params['paymentId'] = self.payment_id + if hasattr(self, "auth_payment_id") and self.auth_payment_id is not None: + params['authPaymentId'] = self.auth_payment_id + if hasattr(self, "payment_amount") and self.payment_amount is not None: + params['paymentAmount'] = self.payment_amount + if hasattr(self, "actual_payment_amount") and self.actual_payment_amount is not None: + params['actualPaymentAmount'] = self.actual_payment_amount + if hasattr(self, "payment_quote") and self.payment_quote is not None: + params['paymentQuote'] = self.payment_quote + if hasattr(self, "auth_expiry_time") and self.auth_expiry_time is not None: + params['authExpiryTime'] = self.auth_expiry_time + if hasattr(self, "payment_create_time") and self.payment_create_time is not None: + params['paymentCreateTime'] = self.payment_create_time + if hasattr(self, "payment_time") and self.payment_time is not None: + params['paymentTime'] = self.payment_time + if hasattr(self, "non_guarantee_coupon_amount") and self.non_guarantee_coupon_amount is not None: + params['nonGuaranteeCouponAmount'] = self.non_guarantee_coupon_amount + if hasattr(self, "psp_customer_info") and self.psp_customer_info is not None: + params['pspCustomerInfo'] = self.psp_customer_info + if hasattr(self, "redirect_action_form") and self.redirect_action_form is not None: + params['redirectActionForm'] = self.redirect_action_form + if hasattr(self, "card_info") and self.card_info is not None: + params['cardInfo'] = self.card_info + if hasattr(self, "acquirer_reference_no") and self.acquirer_reference_no is not None: + params['acquirerReferenceNo'] = self.acquirer_reference_no + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + if hasattr(self, "transactions") and self.transactions is not None: + params['transactions'] = self.transactions + if hasattr(self, "customs_declaration_amount") and self.customs_declaration_amount is not None: + params['customsDeclarationAmount'] = self.customs_declaration_amount + if hasattr(self, "gross_settlement_amount") and self.gross_settlement_amount is not None: + params['grossSettlementAmount'] = self.gross_settlement_amount + if hasattr(self, "settlement_quote") and self.settlement_quote is not None: + params['settlementQuote'] = self.settlement_quote + if hasattr(self, "payment_result_info") and self.payment_result_info is not None: + params['paymentResultInfo'] = self.payment_result_info + if hasattr(self, "acquirer_info") and self.acquirer_info is not None: + params['acquirerInfo'] = self.acquirer_info + if hasattr(self, "merchant_account_id") and self.merchant_account_id is not None: + params['merchantAccountId'] = self.merchant_account_id + if hasattr(self, "promotion_results") and self.promotion_results is not None: + params['promotionResults'] = self.promotion_results + if hasattr(self, "earliest_settlement_time") and self.earliest_settlement_time is not None: + params['earliestSettlementTime'] = self.earliest_settlement_time + if hasattr(self, "payment_method_type") and self.payment_method_type is not None: + params['paymentMethodType'] = self.payment_method_type + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayPayQueryResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'paymentStatus' in response_body: + payment_status_temp = TransactionStatusType.value_of(response_body['paymentStatus']) + self.__payment_status = payment_status_temp + if 'paymentResultCode' in response_body: + self.__payment_result_code = response_body['paymentResultCode'] + if 'paymentResultMessage' in response_body: + self.__payment_result_message = response_body['paymentResultMessage'] + if 'paymentRequestId' in response_body: + self.__payment_request_id = response_body['paymentRequestId'] + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'authPaymentId' in response_body: + self.__auth_payment_id = response_body['authPaymentId'] + if 'paymentAmount' in response_body: + self.__payment_amount = Amount() + self.__payment_amount.parse_rsp_body(response_body['paymentAmount']) + if 'actualPaymentAmount' in response_body: + self.__actual_payment_amount = Amount() + self.__actual_payment_amount.parse_rsp_body(response_body['actualPaymentAmount']) + if 'paymentQuote' in response_body: + self.__payment_quote = Quote() + self.__payment_quote.parse_rsp_body(response_body['paymentQuote']) + if 'authExpiryTime' in response_body: + self.__auth_expiry_time = response_body['authExpiryTime'] + if 'paymentCreateTime' in response_body: + self.__payment_create_time = response_body['paymentCreateTime'] + if 'paymentTime' in response_body: + self.__payment_time = response_body['paymentTime'] + if 'nonGuaranteeCouponAmount' in response_body: + self.__non_guarantee_coupon_amount = Amount() + self.__non_guarantee_coupon_amount.parse_rsp_body(response_body['nonGuaranteeCouponAmount']) + if 'pspCustomerInfo' in response_body: + self.__psp_customer_info = PspCustomerInfo() + self.__psp_customer_info.parse_rsp_body(response_body['pspCustomerInfo']) + if 'redirectActionForm' in response_body: + self.__redirect_action_form = RedirectActionForm() + self.__redirect_action_form.parse_rsp_body(response_body['redirectActionForm']) + if 'cardInfo' in response_body: + self.__card_info = CardInfo() + self.__card_info.parse_rsp_body(response_body['cardInfo']) + if 'acquirerReferenceNo' in response_body: + self.__acquirer_reference_no = response_body['acquirerReferenceNo'] + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'transactions' in response_body: + self.__transactions = [] + for item in response_body['transactions']: + obj = Transaction() + obj.parse_rsp_body(item) + self.__transactions.append(obj) + if 'customsDeclarationAmount' in response_body: + self.__customs_declaration_amount = Amount() + self.__customs_declaration_amount.parse_rsp_body(response_body['customsDeclarationAmount']) + if 'grossSettlementAmount' in response_body: + self.__gross_settlement_amount = Amount() + self.__gross_settlement_amount.parse_rsp_body(response_body['grossSettlementAmount']) + if 'settlementQuote' in response_body: + self.__settlement_quote = Quote() + self.__settlement_quote.parse_rsp_body(response_body['settlementQuote']) + if 'paymentResultInfo' in response_body: + self.__payment_result_info = PaymentResultInfo() + self.__payment_result_info.parse_rsp_body(response_body['paymentResultInfo']) + if 'acquirerInfo' in response_body: + self.__acquirer_info = AcquirerInfo() + self.__acquirer_info.parse_rsp_body(response_body['acquirerInfo']) + if 'merchantAccountId' in response_body: + self.__merchant_account_id = response_body['merchantAccountId'] + if 'promotionResults' in response_body: + self.__promotion_results = [] + for item in response_body['promotionResults']: + obj = PromotionResult() + obj.parse_rsp_body(item) + self.__promotion_results.append(obj) + if 'earliestSettlementTime' in response_body: + self.__earliest_settlement_time = response_body['earliestSettlementTime'] + if 'paymentMethodType' in response_body: + self.__payment_method_type = response_body['paymentMethodType'] diff --git a/com/alipay/ams/api/response/pay/alipay_pay_response.py b/com/alipay/ams/api/response/pay/alipay_pay_response.py index 1b3e10a..e5af338 100644 --- a/com/alipay/ams/api/response/pay/alipay_pay_response.py +++ b/com/alipay/ams/api/response/pay/alipay_pay_response.py @@ -1,218 +1,445 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json +from com.alipay.ams.api.model.result import Result from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.quote import Quote +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.psp_customer_info import PspCustomerInfo from com.alipay.ams.api.model.challenge_action_form import ChallengeActionForm +from com.alipay.ams.api.model.redirect_action_form import RedirectActionForm from com.alipay.ams.api.model.order_code_form import OrderCodeForm +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.quote import Quote from com.alipay.ams.api.model.payment_result_info import PaymentResultInfo +from com.alipay.ams.api.model.acquirer_info import AcquirerInfo from com.alipay.ams.api.model.promotion_result import PromotionResult -from com.alipay.ams.api.model.psp_customer_info import PspCustomerInfo -from com.alipay.ams.api.model.quote import Quote -from com.alipay.ams.api.model.redirect_action_form import RedirectActionForm -from com.alipay.ams.api.response.alipay_response import AlipayResponse -class AlipayPayResponse(AlipayResponse): +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayPayResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayPayResponse, self).__init__() - self.__payment_request_id = None - self.__payment_id = None + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__payment_request_id = None # type: str + self.__payment_id = None # type: str self.__payment_amount = None # type: Amount + self.__payment_data = None # type: str self.__actual_payment_amount = None # type: Amount self.__payment_quote = None # type: Quote - self.__payment_time = None - self.__payment_create_time = None - self.__auth_expiry_time = None - self.__non_guarantee_coupon_value = None - self.__payment_action_form = None - self.__psp_customer_info = None + self.__payment_time = None # type: str + self.__payment_create_time = None # type: str + self.__auth_expiry_time = None # type: str + self.__non_guarantee_coupon_value = None # type: Amount + self.__payment_action_form = None # type: str + self.__psp_customer_info = None # type: PspCustomerInfo self.__challenge_action_form = None # type: ChallengeActionForm self.__redirect_action_form = None # type: RedirectActionForm self.__order_code_form = None # type: OrderCodeForm - self.__extend_info = None self.__gross_settlement_amount = None # type: Amount self.__settlement_quote = None # type: Quote - self.__payment_data = None - self.__app_identifier = None - self.__app_link_url = None - self.__normal_url = None - self.__scheme_url = None + self.__extend_info = None # type: str + self.__normal_url = None # type: str + self.__scheme_url = None # type: str + self.__applink_url = None # type: str + self.__app_identifier = None # type: str self.__payment_result_info = None # type: PaymentResultInfo - self.__promotion_result = None # type: PromotionResult - self.__payment_method_type = None - self.__parse_rsp_body(rsp_body) + self.__acquirer_info = None # type: AcquirerInfo + self.__promotion_result = None # type: [PromotionResult] + self.parse_rsp_body(rsp_body) - @property - def gross_settlement_amount(self): - return self.__gross_settlement_amount @property - def settlement_quote(self): - return self.__settlement_quote + def result(self): + """Gets the result of this AlipayPayResponse. + + """ + return self.__result + @result.setter + def result(self, value): + self.__result = value @property def payment_request_id(self): + """ + The unique ID that is assigned by a merchant to identify a payment request. Note: This field is returned when resultCode is PAYMENT_IN_PROCESS. More information: Maximum length: 64 characters + """ return self.__payment_request_id + @payment_request_id.setter + def payment_request_id(self, value): + self.__payment_request_id = value @property def payment_id(self): + """ + The unique ID that is assigned by Antom to identify a payment. Note: This field is returned when resultCode is PAYMENT_IN_PROCESS. More information: Maximum length: 64 characters + """ return self.__payment_id + @payment_id.setter + def payment_id(self, value): + self.__payment_id = value @property def payment_amount(self): + """Gets the payment_amount of this AlipayPayResponse. + + """ return self.__payment_amount + @payment_amount.setter + def payment_amount(self, value): + self.__payment_amount = value + @property + def payment_data(self): + """ + Used by the Antom client SDK to render the checkout page. This parameter is returned if the merchant app has integrated Antom client SDK. After receiving the parameter, you can call the showPaymentSheet API of the Antom client SDK. More information: Maximum length: 20000 characters + """ + return self.__payment_data + + @payment_data.setter + def payment_data(self, value): + self.__payment_data = value @property def actual_payment_amount(self): + """Gets the actual_payment_amount of this AlipayPayResponse. + + """ return self.__actual_payment_amount + @actual_payment_amount.setter + def actual_payment_amount(self, value): + self.__actual_payment_amount = value @property def payment_quote(self): + """Gets the payment_quote of this AlipayPayResponse. + + """ return self.__payment_quote + @payment_quote.setter + def payment_quote(self, value): + self.__payment_quote = value @property def payment_time(self): + """Gets the payment_time of this AlipayPayResponse. + + """ return self.__payment_time + @payment_time.setter + def payment_time(self, value): + self.__payment_time = value @property def payment_create_time(self): + """ + The date and time when the payment is created. Note: This field is returned when resultCode is PAYMENT_IN_PROCESS. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__payment_create_time + @payment_create_time.setter + def payment_create_time(self, value): + self.__payment_create_time = value @property def auth_expiry_time(self): + """Gets the auth_expiry_time of this AlipayPayResponse. + + """ return self.__auth_expiry_time + @auth_expiry_time.setter + def auth_expiry_time(self, value): + self.__auth_expiry_time = value @property def non_guarantee_coupon_value(self): + """Gets the non_guarantee_coupon_value of this AlipayPayResponse. + + """ return self.__non_guarantee_coupon_value + @non_guarantee_coupon_value.setter + def non_guarantee_coupon_value(self, value): + self.__non_guarantee_coupon_value = value @property def payment_action_form(self): + """Gets the payment_action_form of this AlipayPayResponse. + + """ return self.__payment_action_form + @payment_action_form.setter + def payment_action_form(self, value): + self.__payment_action_form = value @property def psp_customer_info(self): + """Gets the psp_customer_info of this AlipayPayResponse. + + """ return self.__psp_customer_info + @psp_customer_info.setter + def psp_customer_info(self, value): + self.__psp_customer_info = value @property def challenge_action_form(self): + """Gets the challenge_action_form of this AlipayPayResponse. + + """ return self.__challenge_action_form + @challenge_action_form.setter + def challenge_action_form(self, value): + self.__challenge_action_form = value @property def redirect_action_form(self): + """Gets the redirect_action_form of this AlipayPayResponse. + + """ return self.__redirect_action_form + @redirect_action_form.setter + def redirect_action_form(self, value): + self.__redirect_action_form = value @property def order_code_form(self): + """Gets the order_code_form of this AlipayPayResponse. + + """ return self.__order_code_form + @order_code_form.setter + def order_code_form(self, value): + self.__order_code_form = value @property - def extend_info(self): - return self.__extend_info - - @property - def payment_data(self): - return self.__payment_data + def gross_settlement_amount(self): + """Gets the gross_settlement_amount of this AlipayPayResponse. + + """ + return self.__gross_settlement_amount + @gross_settlement_amount.setter + def gross_settlement_amount(self, value): + self.__gross_settlement_amount = value @property - def app_identifier(self): - return self.__app_identifier + def settlement_quote(self): + """Gets the settlement_quote of this AlipayPayResponse. + + """ + return self.__settlement_quote + @settlement_quote.setter + def settlement_quote(self, value): + self.__settlement_quote = value @property - def app_link_url(self): - return self.__app_link_url + def extend_info(self): + """Gets the extend_info of this AlipayPayResponse. + + """ + return self.__extend_info + @extend_info.setter + def extend_info(self, value): + self.__extend_info = value @property def normal_url(self): + """ + The URL that redirects users to a WAP or WEB page in the default browser or the embedded WebView. Note: When the value of resultCode is ​PAYMENT_IN_PROCESS​, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + """ return self.__normal_url + @normal_url.setter + def normal_url(self, value): + self.__normal_url = value @property def scheme_url(self): + """ + The URL scheme that redirects users to open an app in an Android or iOS system when the target app is installed. Note: When the value of resultCode is ​PAYMENT_IN_PROCESS​, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + """ return self.__scheme_url + @scheme_url.setter + def scheme_url(self, value): + self.__scheme_url = value + @property + def applink_url(self): + """ + The URL that redirects users to open an app when the target app is installed, or to open a WAP page when the target app is not installed. For Android, the URL is a Native App Link. For iOS, the URL is a Universal Link. Note: When the value of resultCode is ​PAYMENT_IN_PROCESS​, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + """ + return self.__applink_url + + @applink_url.setter + def applink_url(self, value): + self.__applink_url = value + @property + def app_identifier(self): + """ + Android package name, which is used by Android apps to open a cashier page. Note: This field is returned when resultCode is ​PAYMENT_IN_PROCESS​ and terminalType is APP or WAP. + """ + return self.__app_identifier + + @app_identifier.setter + def app_identifier(self, value): + self.__app_identifier = value @property def payment_result_info(self): + """Gets the payment_result_info of this AlipayPayResponse. + + """ return self.__payment_result_info + @payment_result_info.setter + def payment_result_info(self, value): + self.__payment_result_info = value + @property + def acquirer_info(self): + """Gets the acquirer_info of this AlipayPayResponse. + + """ + return self.__acquirer_info + + @acquirer_info.setter + def acquirer_info(self, value): + self.__acquirer_info = value @property def promotion_result(self): + """ + Promotion result. + """ return self.__promotion_result - @property - def payment_method_type(self): - return self.__payment_method_type - - def __parse_rsp_body(self, rsp_body): - response = super(AlipayPayResponse, self).parse_rsp_body(rsp_body) - if 'paymentRequestId' in response: - self.__payment_request_id = response['paymentRequestId'] - if 'paymentId' in response: - self.__payment_id = response['paymentId'] - if 'paymentAmount' in response: - payment_amount = Amount() - payment_amount.parse_rsp_body(response['paymentAmount']) - self.__payment_amount = payment_amount - if 'actualPaymentAmount' in response: - actual_payment_amount = Amount() - actual_payment_amount.parse_rsp_body(response['actualPaymentAmount']) - self.__actual_payment_amount = actual_payment_amount - if 'paymentQuote' in response: - quote = Quote() - quote.parse_rsp_body(response['paymentQuote']) - self.__payment_quote = quote - if 'paymentTime' in response: - self.__payment_time = response['paymentTime'] - if 'paymentCreateTime' in response: - self.__payment_create_time = response['paymentCreateTime'] - if 'authExpiryTime' in response: - self.__auth_expiry_time = response['authExpiryTime'] - if 'nonGuaranteeCouponValue' in response: - self.__non_guarantee_coupon_value = response['nonGuaranteeCouponValue'] - if 'paymentActionForm' in response: - self.__payment_action_form = response['paymentActionForm'] - if 'pspCustomerInfo' in response: - psp_customer_info = PspCustomerInfo() - psp_customer_info.parse_rsp_body(response['pspCustomerInfo']) - self.__psp_customer_info = psp_customer_info - if 'challengeActionForm' in response: - challenge_action_form = ChallengeActionForm() - challenge_action_form.parse_rsp_body(response['challengeActionForm']) - self.__challenge_action_form = challenge_action_form - if 'redirectActionForm' in response: - redirect_action_form = RedirectActionForm() - redirect_action_form.parse_rsp_body(response['redirectActionForm']) - self.__redirect_action_form = redirect_action_form - if 'orderCodeForm' in response: - order_code_form = OrderCodeForm() - order_code_form.parse_rsp_body(response['orderCodeForm']) - self.__order_code_form = order_code_form - if 'extendInfo' in response: - self.__extend_info = response['extendInfo'] - if 'grossSettlementAmount' in response: - gross_settlement_amount = Amount() - gross_settlement_amount.parse_rsp_body(response['grossSettlementAmount']) - self.__gross_settlement_amount = gross_settlement_amount - if 'settlementQuote' in response: - settlement_quote = Quote() - settlement_quote.parse_rsp_body(response['settlementQuote']) - self.__settlement_quote = settlement_quote - if 'paymentData' in response: - self.__payment_data = response['paymentData'] - if 'appIdentifier' in response: - self.__app_identifier = response['appIdentifier'] - if 'appLinkUrl' in response: - self.__app_link_url = response['appLinkUrl'] - if 'normalUrl' in response: - self.__normal_url = response['normalUrl'] - if 'schemeUrl' in response: - self.__scheme_url = response['schemeUrl'] - if 'paymentResultInfo' in response: - payment_result_info = PaymentResultInfo() - payment_result_info.parse_rsp_body(response['paymentResultInfo']) - self.__payment_result_info = payment_result_info - if 'promotionResult' in response: - promotion_result = PromotionResult() - promotion_result.parse_rsp_body(response['promotionResult']) - self.__promotion_result = promotion_result - if 'paymentMethodType' in response: - self.__payment_method_type = response['paymentMethodType'] + @promotion_result.setter + def promotion_result(self, value): + self.__promotion_result = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "payment_request_id") and self.payment_request_id is not None: + params['paymentRequestId'] = self.payment_request_id + if hasattr(self, "payment_id") and self.payment_id is not None: + params['paymentId'] = self.payment_id + if hasattr(self, "payment_amount") and self.payment_amount is not None: + params['paymentAmount'] = self.payment_amount + if hasattr(self, "payment_data") and self.payment_data is not None: + params['paymentData'] = self.payment_data + if hasattr(self, "actual_payment_amount") and self.actual_payment_amount is not None: + params['actualPaymentAmount'] = self.actual_payment_amount + if hasattr(self, "payment_quote") and self.payment_quote is not None: + params['paymentQuote'] = self.payment_quote + if hasattr(self, "payment_time") and self.payment_time is not None: + params['paymentTime'] = self.payment_time + if hasattr(self, "payment_create_time") and self.payment_create_time is not None: + params['paymentCreateTime'] = self.payment_create_time + if hasattr(self, "auth_expiry_time") and self.auth_expiry_time is not None: + params['authExpiryTime'] = self.auth_expiry_time + if hasattr(self, "non_guarantee_coupon_value") and self.non_guarantee_coupon_value is not None: + params['nonGuaranteeCouponValue'] = self.non_guarantee_coupon_value + if hasattr(self, "payment_action_form") and self.payment_action_form is not None: + params['paymentActionForm'] = self.payment_action_form + if hasattr(self, "psp_customer_info") and self.psp_customer_info is not None: + params['pspCustomerInfo'] = self.psp_customer_info + if hasattr(self, "challenge_action_form") and self.challenge_action_form is not None: + params['challengeActionForm'] = self.challenge_action_form + if hasattr(self, "redirect_action_form") and self.redirect_action_form is not None: + params['redirectActionForm'] = self.redirect_action_form + if hasattr(self, "order_code_form") and self.order_code_form is not None: + params['orderCodeForm'] = self.order_code_form + if hasattr(self, "gross_settlement_amount") and self.gross_settlement_amount is not None: + params['grossSettlementAmount'] = self.gross_settlement_amount + if hasattr(self, "settlement_quote") and self.settlement_quote is not None: + params['settlementQuote'] = self.settlement_quote + if hasattr(self, "extend_info") and self.extend_info is not None: + params['extendInfo'] = self.extend_info + if hasattr(self, "normal_url") and self.normal_url is not None: + params['normalUrl'] = self.normal_url + if hasattr(self, "scheme_url") and self.scheme_url is not None: + params['schemeUrl'] = self.scheme_url + if hasattr(self, "applink_url") and self.applink_url is not None: + params['applinkUrl'] = self.applink_url + if hasattr(self, "app_identifier") and self.app_identifier is not None: + params['appIdentifier'] = self.app_identifier + if hasattr(self, "payment_result_info") and self.payment_result_info is not None: + params['paymentResultInfo'] = self.payment_result_info + if hasattr(self, "acquirer_info") and self.acquirer_info is not None: + params['acquirerInfo'] = self.acquirer_info + if hasattr(self, "promotion_result") and self.promotion_result is not None: + params['promotionResult'] = self.promotion_result + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayPayResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'paymentRequestId' in response_body: + self.__payment_request_id = response_body['paymentRequestId'] + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'paymentAmount' in response_body: + self.__payment_amount = Amount() + self.__payment_amount.parse_rsp_body(response_body['paymentAmount']) + if 'paymentData' in response_body: + self.__payment_data = response_body['paymentData'] + if 'actualPaymentAmount' in response_body: + self.__actual_payment_amount = Amount() + self.__actual_payment_amount.parse_rsp_body(response_body['actualPaymentAmount']) + if 'paymentQuote' in response_body: + self.__payment_quote = Quote() + self.__payment_quote.parse_rsp_body(response_body['paymentQuote']) + if 'paymentTime' in response_body: + self.__payment_time = response_body['paymentTime'] + if 'paymentCreateTime' in response_body: + self.__payment_create_time = response_body['paymentCreateTime'] + if 'authExpiryTime' in response_body: + self.__auth_expiry_time = response_body['authExpiryTime'] + if 'nonGuaranteeCouponValue' in response_body: + self.__non_guarantee_coupon_value = Amount() + self.__non_guarantee_coupon_value.parse_rsp_body(response_body['nonGuaranteeCouponValue']) + if 'paymentActionForm' in response_body: + self.__payment_action_form = response_body['paymentActionForm'] + if 'pspCustomerInfo' in response_body: + self.__psp_customer_info = PspCustomerInfo() + self.__psp_customer_info.parse_rsp_body(response_body['pspCustomerInfo']) + if 'challengeActionForm' in response_body: + self.__challenge_action_form = ChallengeActionForm() + self.__challenge_action_form.parse_rsp_body(response_body['challengeActionForm']) + if 'redirectActionForm' in response_body: + self.__redirect_action_form = RedirectActionForm() + self.__redirect_action_form.parse_rsp_body(response_body['redirectActionForm']) + if 'orderCodeForm' in response_body: + self.__order_code_form = OrderCodeForm() + self.__order_code_form.parse_rsp_body(response_body['orderCodeForm']) + if 'grossSettlementAmount' in response_body: + self.__gross_settlement_amount = Amount() + self.__gross_settlement_amount.parse_rsp_body(response_body['grossSettlementAmount']) + if 'settlementQuote' in response_body: + self.__settlement_quote = Quote() + self.__settlement_quote.parse_rsp_body(response_body['settlementQuote']) + if 'extendInfo' in response_body: + self.__extend_info = response_body['extendInfo'] + if 'normalUrl' in response_body: + self.__normal_url = response_body['normalUrl'] + if 'schemeUrl' in response_body: + self.__scheme_url = response_body['schemeUrl'] + if 'applinkUrl' in response_body: + self.__applink_url = response_body['applinkUrl'] + if 'appIdentifier' in response_body: + self.__app_identifier = response_body['appIdentifier'] + if 'paymentResultInfo' in response_body: + self.__payment_result_info = PaymentResultInfo() + self.__payment_result_info.parse_rsp_body(response_body['paymentResultInfo']) + if 'acquirerInfo' in response_body: + self.__acquirer_info = AcquirerInfo() + self.__acquirer_info.parse_rsp_body(response_body['acquirerInfo']) + if 'promotionResult' in response_body: + self.__promotion_result = [] + for item in response_body['promotionResult']: + obj = PromotionResult() + obj.parse_rsp_body(item) + self.__promotion_result.append(obj) diff --git a/com/alipay/ams/api/response/pay/alipay_payment_session_response.py b/com/alipay/ams/api/response/pay/alipay_payment_session_response.py new file mode 100644 index 0000000..66d64e1 --- /dev/null +++ b/com/alipay/ams/api/response/pay/alipay_payment_session_response.py @@ -0,0 +1,101 @@ +import json +from com.alipay.ams.api.model.result import Result + + + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayPaymentSessionResponse(AlipayResponse): + def __init__(self, rsp_body): + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__payment_session_data = None # type: str + self.__payment_session_expiry_time = None # type: str + self.__payment_session_id = None # type: str + self.__normal_url = None # type: str + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AlipayPaymentSessionResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value + @property + def payment_session_data(self): + """ + The encrypted payment session data. Pass the data to your front end to initiate the client-side SDK. More information: Maximum length: 4096 characters + """ + return self.__payment_session_data + + @payment_session_data.setter + def payment_session_data(self, value): + self.__payment_session_data = value + @property + def payment_session_expiry_time(self): + """ + The specific date and time after which the payment session will expire. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ + return self.__payment_session_expiry_time + + @payment_session_expiry_time.setter + def payment_session_expiry_time(self, value): + self.__payment_session_expiry_time = value + @property + def payment_session_id(self): + """ + The encrypted ID that is assigned by Antom to identify a payment session. More information: Maximum length: 64 characters + """ + return self.__payment_session_id + + @payment_session_id.setter + def payment_session_id(self, value): + self.__payment_session_id = value + @property + def normal_url(self): + """ + The URL used to redirect to the Checkout Page. More information: Maximum length: 2048 characters + """ + return self.__normal_url + + @normal_url.setter + def normal_url(self, value): + self.__normal_url = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "payment_session_data") and self.payment_session_data is not None: + params['paymentSessionData'] = self.payment_session_data + if hasattr(self, "payment_session_expiry_time") and self.payment_session_expiry_time is not None: + params['paymentSessionExpiryTime'] = self.payment_session_expiry_time + if hasattr(self, "payment_session_id") and self.payment_session_id is not None: + params['paymentSessionId'] = self.payment_session_id + if hasattr(self, "normal_url") and self.normal_url is not None: + params['normalUrl'] = self.normal_url + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayPaymentSessionResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'paymentSessionData' in response_body: + self.__payment_session_data = response_body['paymentSessionData'] + if 'paymentSessionExpiryTime' in response_body: + self.__payment_session_expiry_time = response_body['paymentSessionExpiryTime'] + if 'paymentSessionId' in response_body: + self.__payment_session_id = response_body['paymentSessionId'] + if 'normalUrl' in response_body: + self.__normal_url = response_body['normalUrl'] diff --git a/com/alipay/ams/api/response/pay/alipay_refund_response.py b/com/alipay/ams/api/response/pay/alipay_refund_response.py index c3e5ceb..0c6a098 100644 --- a/com/alipay/ams/api/response/pay/alipay_refund_response.py +++ b/com/alipay/ams/api/response/pay/alipay_refund_response.py @@ -1,111 +1,201 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +import json +from com.alipay.ams.api.model.result import Result +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.amount import Amount from com.alipay.ams.api.model.amount import Amount from com.alipay.ams.api.model.quote import Quote -from com.alipay.ams.api.model.refund_detail import RefundDetail -from com.alipay.ams.api.response.alipay_response import AlipayResponse +from com.alipay.ams.api.model.acquirer_info import AcquirerInfo -class AlipayRefundResponse(AlipayResponse): +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayRefundResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipayRefundResponse, self).__init__() - self.__refund_request_id = None - self.__refund_id = None - self.__payment_id = None + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__refund_request_id = None # type: str + self.__refund_id = None # type: str + self.__payment_id = None # type: str self.__refund_amount = None # type: Amount - self.__refund_time = None - self.__refund_non_guarantee_coupon_amount = None - self.__acquirer_reference_no = None + self.__refund_time = None # type: str + self.__refund_non_guarantee_coupon_amount = None # type: Amount self.__gross_settlement_amount = None # type: Amount self.__settlement_quote = None # type: Quote - self.__refund_details = None # type:list:RefundDetail - self.__refund_source_account_no = None - self.__parse_rsp_body(rsp_body) + self.__acquirer_info = None # type: AcquirerInfo + self.__acquirer_reference_no = None # type: str + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipayRefundResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def refund_request_id(self): + """ + The unique ID that is assigned by the merchant to identify a refund request. Note: This field is returned when the refund succeeds (the value of result.resultStatus is S). More information: Maximum length: 64 characters + """ return self.__refund_request_id + @refund_request_id.setter + def refund_request_id(self, value): + self.__refund_request_id = value @property def refund_id(self): + """ + The unique ID that is assigned by Antom to identify a refund. A one-to-one correspondence between refundId and refundRequestId exists. Note: This field is returned when the refund succeeds (the value of result.resultStatus is S). More information: Maximum length: 64 characters + """ return self.__refund_id + @refund_id.setter + def refund_id(self, value): + self.__refund_id = value @property def payment_id(self): + """ + The unique ID assigned by Antom for the original payment to be refunded. Note: This field is returned when the refund succeeds (the value of result.resultStatus is S). More information: Maximum length: 64 characters + """ return self.__payment_id + @payment_id.setter + def payment_id(self, value): + self.__payment_id = value @property def refund_amount(self): + """Gets the refund_amount of this AlipayRefundResponse. + + """ return self.__refund_amount + @refund_amount.setter + def refund_amount(self, value): + self.__refund_amount = value @property def refund_time(self): + """ + The date and time when the refund reaches the state of success, failure, or unknown. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ return self.__refund_time + @refund_time.setter + def refund_time(self, value): + self.__refund_time = value @property def refund_non_guarantee_coupon_amount(self): + """Gets the refund_non_guarantee_coupon_amount of this AlipayRefundResponse. + + """ return self.__refund_non_guarantee_coupon_amount - @property - def acquirer_reference_no(self): - return self.__acquirer_reference_no - + @refund_non_guarantee_coupon_amount.setter + def refund_non_guarantee_coupon_amount(self, value): + self.__refund_non_guarantee_coupon_amount = value @property def gross_settlement_amount(self): + """Gets the gross_settlement_amount of this AlipayRefundResponse. + + """ return self.__gross_settlement_amount + @gross_settlement_amount.setter + def gross_settlement_amount(self, value): + self.__gross_settlement_amount = value @property def settlement_quote(self): + """Gets the settlement_quote of this AlipayRefundResponse. + + """ return self.__settlement_quote + @settlement_quote.setter + def settlement_quote(self, value): + self.__settlement_quote = value @property - def refund_details(self): - return self.__refund_details - + def acquirer_info(self): + """Gets the acquirer_info of this AlipayRefundResponse. + + """ + return self.__acquirer_info + + @acquirer_info.setter + def acquirer_info(self, value): + self.__acquirer_info = value @property - def refund_source_account_no(self): - return self.__refund_source_account_no - - def __parse_rsp_body(self, rsp_body): - response = super(AlipayRefundResponse, self).parse_rsp_body(rsp_body) - if 'refundRequestId' in response: - self.__refund_request_id = response['refundRequestId'] - if 'paymentId' in response: - self.__payment_id = response['paymentId'] - if 'refundId' in response: - self.__refund_id = response['refundId'] - if 'refundAmount' in response: - refund_amount = Amount() - refund_amount.parse_rsp_body(response['refundAmount']) - self.__refund_amount = refund_amount - if 'refundTime' in response: - self.__refund_time = response['refundTime'] - if 'refundNonGuaranteeCouponAmount' in response: - refund_non_guarantee_coupon_amount = Amount() - refund_non_guarantee_coupon_amount.parse_rsp_body(response['refundNonGuaranteeCouponAmount']) - self.__refund_non_guarantee_coupon_amount = refund_non_guarantee_coupon_amount - - if 'acquirerReferenceNo' in response: - self.__acquirer_reference_no = response['acquirerReferenceNo'] - - if 'grossSettlementAmount' in response: - gross_settlement_amount = Amount() - gross_settlement_amount.parse_rsp_body(response['grossSettlementAmount']) - self.__gross_settlement_amount = gross_settlement_amount - - if 'settlementQuote' in response: - settlement_quote = Quote() - settlement_quote.parse_rsp_body(response['settlementQuote']) - self.__settlement_quote = settlement_quote - - if 'refundDetails' in response: - refund_details = [] - for refund_detail in response['refundDetails']: - refund_detail_obj = RefundDetail() - refund_detail_obj.parse_rsp_body(refund_detail) - refund_details.append(refund_detail_obj) - self.__refund_details = refund_details - - if 'refundSourceAccountNo' in response: - self.__refund_source_account_no = response['refundSourceAccountNo'] + def acquirer_reference_no(self): + """ + The unique ID assigned by the non-Antom acquirer for the transaction. More information: Maximum length: 64 characters + """ + return self.__acquirer_reference_no + + @acquirer_reference_no.setter + def acquirer_reference_no(self, value): + self.__acquirer_reference_no = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "refund_request_id") and self.refund_request_id is not None: + params['refundRequestId'] = self.refund_request_id + if hasattr(self, "refund_id") and self.refund_id is not None: + params['refundId'] = self.refund_id + if hasattr(self, "payment_id") and self.payment_id is not None: + params['paymentId'] = self.payment_id + if hasattr(self, "refund_amount") and self.refund_amount is not None: + params['refundAmount'] = self.refund_amount + if hasattr(self, "refund_time") and self.refund_time is not None: + params['refundTime'] = self.refund_time + if hasattr(self, "refund_non_guarantee_coupon_amount") and self.refund_non_guarantee_coupon_amount is not None: + params['refundNonGuaranteeCouponAmount'] = self.refund_non_guarantee_coupon_amount + if hasattr(self, "gross_settlement_amount") and self.gross_settlement_amount is not None: + params['grossSettlementAmount'] = self.gross_settlement_amount + if hasattr(self, "settlement_quote") and self.settlement_quote is not None: + params['settlementQuote'] = self.settlement_quote + if hasattr(self, "acquirer_info") and self.acquirer_info is not None: + params['acquirerInfo'] = self.acquirer_info + if hasattr(self, "acquirer_reference_no") and self.acquirer_reference_no is not None: + params['acquirerReferenceNo'] = self.acquirer_reference_no + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayRefundResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'refundRequestId' in response_body: + self.__refund_request_id = response_body['refundRequestId'] + if 'refundId' in response_body: + self.__refund_id = response_body['refundId'] + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'refundAmount' in response_body: + self.__refund_amount = Amount() + self.__refund_amount.parse_rsp_body(response_body['refundAmount']) + if 'refundTime' in response_body: + self.__refund_time = response_body['refundTime'] + if 'refundNonGuaranteeCouponAmount' in response_body: + self.__refund_non_guarantee_coupon_amount = Amount() + self.__refund_non_guarantee_coupon_amount.parse_rsp_body(response_body['refundNonGuaranteeCouponAmount']) + if 'grossSettlementAmount' in response_body: + self.__gross_settlement_amount = Amount() + self.__gross_settlement_amount.parse_rsp_body(response_body['grossSettlementAmount']) + if 'settlementQuote' in response_body: + self.__settlement_quote = Quote() + self.__settlement_quote.parse_rsp_body(response_body['settlementQuote']) + if 'acquirerInfo' in response_body: + self.__acquirer_info = AcquirerInfo() + self.__acquirer_info.parse_rsp_body(response_body['acquirerInfo']) + if 'acquirerReferenceNo' in response_body: + self.__acquirer_reference_no = response_body['acquirerReferenceNo'] diff --git a/com/alipay/ams/api/response/pay/alipay_vaulting_payment_method_response.py b/com/alipay/ams/api/response/pay/alipay_vaulting_payment_method_response.py new file mode 100644 index 0000000..df61eb4 --- /dev/null +++ b/com/alipay/ams/api/response/pay/alipay_vaulting_payment_method_response.py @@ -0,0 +1,118 @@ +import json +from com.alipay.ams.api.model.result import Result +from com.alipay.ams.api.model.payment_method_detail import PaymentMethodDetail + + + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayVaultingPaymentMethodResponse(AlipayResponse): + def __init__(self, rsp_body): + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__vaulting_request_id = None # type: str + self.__payment_method_detail = None # type: PaymentMethodDetail + self.__normal_url = None # type: str + self.__scheme_url = None # type: str + self.__applink_url = None # type: str + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AlipayVaultingPaymentMethodResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value + @property + def vaulting_request_id(self): + """ + The unique ID that is assigned by a merchant to identify a card vaulting request. More information: Maximum length: 64 characters + """ + return self.__vaulting_request_id + + @vaulting_request_id.setter + def vaulting_request_id(self, value): + self.__vaulting_request_id = value + @property + def payment_method_detail(self): + """Gets the payment_method_detail of this AlipayVaultingPaymentMethodResponse. + + """ + return self.__payment_method_detail + + @payment_method_detail.setter + def payment_method_detail(self, value): + self.__payment_method_detail = value + @property + def normal_url(self): + """ + The URL that redirects the user to a WAP or WEB page in the default browser or the embedded WebView. Note: When the value of result.resultCode is VERIFICATION_IN_PROCESS, one or more of the following URLs may be returned: schemeUrl, appLinkUrl, and normalUrl. When the value of paymentMethodType is CARD, the user is required to complete the 3DS authentication on the page accessed through this URL. More information: Maximum length: 2048 characters + """ + return self.__normal_url + + @normal_url.setter + def normal_url(self, value): + self.__normal_url = value + @property + def scheme_url(self): + """ + The URL scheme that redirects the user to open an app in an Android or iOS system when the target app is installed. More information: Maximum length: 2048 characters + """ + return self.__scheme_url + + @scheme_url.setter + def scheme_url(self, value): + self.__scheme_url = value + @property + def applink_url(self): + """ + The URL that redirects the user to open an app when the target app is installed, or to open a WAP page when the target app is not installed. More information: Maximum length: 2048 characters + """ + return self.__applink_url + + @applink_url.setter + def applink_url(self, value): + self.__applink_url = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "vaulting_request_id") and self.vaulting_request_id is not None: + params['vaultingRequestId'] = self.vaulting_request_id + if hasattr(self, "payment_method_detail") and self.payment_method_detail is not None: + params['paymentMethodDetail'] = self.payment_method_detail + if hasattr(self, "normal_url") and self.normal_url is not None: + params['normalUrl'] = self.normal_url + if hasattr(self, "scheme_url") and self.scheme_url is not None: + params['schemeUrl'] = self.scheme_url + if hasattr(self, "applink_url") and self.applink_url is not None: + params['applinkUrl'] = self.applink_url + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayVaultingPaymentMethodResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'vaultingRequestId' in response_body: + self.__vaulting_request_id = response_body['vaultingRequestId'] + if 'paymentMethodDetail' in response_body: + self.__payment_method_detail = PaymentMethodDetail() + self.__payment_method_detail.parse_rsp_body(response_body['paymentMethodDetail']) + if 'normalUrl' in response_body: + self.__normal_url = response_body['normalUrl'] + if 'schemeUrl' in response_body: + self.__scheme_url = response_body['schemeUrl'] + if 'applinkUrl' in response_body: + self.__applink_url = response_body['applinkUrl'] diff --git a/com/alipay/ams/api/response/pay/alipay_vaulting_query_response.py b/com/alipay/ams/api/response/pay/alipay_vaulting_query_response.py new file mode 100644 index 0000000..0c02c0f --- /dev/null +++ b/com/alipay/ams/api/response/pay/alipay_vaulting_query_response.py @@ -0,0 +1,133 @@ +import json +from com.alipay.ams.api.model.result import Result +from com.alipay.ams.api.model.payment_method_detail import PaymentMethodDetail + + + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayVaultingQueryResponse(AlipayResponse): + def __init__(self, rsp_body): + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__vaulting_request_id = None # type: str + self.__normal_url = None # type: str + self.__scheme_url = None # type: str + self.__applink_url = None # type: str + self.__vaulting_status = None # type: str + self.__payment_method_detail = None # type: PaymentMethodDetail + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AlipayVaultingQueryResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value + @property + def vaulting_request_id(self): + """ + The unique ID that is assigned by a merchant to identify a card vaulting request. More information: Maximum length: 64 characters + """ + return self.__vaulting_request_id + + @vaulting_request_id.setter + def vaulting_request_id(self, value): + self.__vaulting_request_id = value + @property + def normal_url(self): + """ + The URL that redirects users to a WAP or WEB page in the default browser or the embedded WebView. Note: When the value of result.resultStatus is S and the value of vaultingStatus is PROCESSING, one or more of the following URLs may be returned: schemeUrl, applinkUrl, and normalUrl. When the value of paymentMethodType is CARD, the user is required to complete the 3DS authentication on the page accessed through this URL. More information: Maximum length: 2048 characters + """ + return self.__normal_url + + @normal_url.setter + def normal_url(self, value): + self.__normal_url = value + @property + def scheme_url(self): + """ + The URL scheme that redirects users to open an App in an Android or iOS system when the target App is installed. Note: When the value of result.resultStatus is S and the value of vaultingStatus is PROCESSING, one or more of the following URLs may be returned: schemeUrl, applinkUrl, and normalUrl. More information: Maximum length: 2048 characters + """ + return self.__scheme_url + + @scheme_url.setter + def scheme_url(self, value): + self.__scheme_url = value + @property + def applink_url(self): + """ + The URL that redirects users to open an app when the target app is installed, or to open a WAP page when the target app is not installed. For Android, the URL is a Native App Link. For iOS, the URL is a Universal Link. Note: When the value of result.resultStatus is S and the value of vaultingStatus is PROCESSING, one or more of the following URLs may be returned: schemeUrl, applinkUrl, and normalUrl. More information: Maximum length: 2048 characters + """ + return self.__applink_url + + @applink_url.setter + def applink_url(self, value): + self.__applink_url = value + @property + def vaulting_status(self): + """ + Indicates the payment method's vaulting status. Valid values are: SUCCESS: indicates that the vaulting is successful. FAIL: indicates that the vaulting failed. PROCESSING: indicates that the vaulting is under process. This parameter is returned when the value of result.resultStatus is S. More information: Maximum length: 10 characters + """ + return self.__vaulting_status + + @vaulting_status.setter + def vaulting_status(self, value): + self.__vaulting_status = value + @property + def payment_method_detail(self): + """Gets the payment_method_detail of this AlipayVaultingQueryResponse. + + """ + return self.__payment_method_detail + + @payment_method_detail.setter + def payment_method_detail(self, value): + self.__payment_method_detail = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "vaulting_request_id") and self.vaulting_request_id is not None: + params['vaultingRequestId'] = self.vaulting_request_id + if hasattr(self, "normal_url") and self.normal_url is not None: + params['normalUrl'] = self.normal_url + if hasattr(self, "scheme_url") and self.scheme_url is not None: + params['schemeUrl'] = self.scheme_url + if hasattr(self, "applink_url") and self.applink_url is not None: + params['applinkUrl'] = self.applink_url + if hasattr(self, "vaulting_status") and self.vaulting_status is not None: + params['vaultingStatus'] = self.vaulting_status + if hasattr(self, "payment_method_detail") and self.payment_method_detail is not None: + params['paymentMethodDetail'] = self.payment_method_detail + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayVaultingQueryResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'vaultingRequestId' in response_body: + self.__vaulting_request_id = response_body['vaultingRequestId'] + if 'normalUrl' in response_body: + self.__normal_url = response_body['normalUrl'] + if 'schemeUrl' in response_body: + self.__scheme_url = response_body['schemeUrl'] + if 'applinkUrl' in response_body: + self.__applink_url = response_body['applinkUrl'] + if 'vaultingStatus' in response_body: + self.__vaulting_status = response_body['vaultingStatus'] + if 'paymentMethodDetail' in response_body: + self.__payment_method_detail = PaymentMethodDetail() + self.__payment_method_detail.parse_rsp_body(response_body['paymentMethodDetail']) diff --git a/com/alipay/ams/api/response/pay/alipay_vaulting_session_response.py b/com/alipay/ams/api/response/pay/alipay_vaulting_session_response.py new file mode 100644 index 0000000..e52ffd3 --- /dev/null +++ b/com/alipay/ams/api/response/pay/alipay_vaulting_session_response.py @@ -0,0 +1,86 @@ +import json +from com.alipay.ams.api.model.result import Result + + + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipayVaultingSessionResponse(AlipayResponse): + def __init__(self, rsp_body): + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__vaulting_session_data = None # type: str + self.__vaulting_session_id = None # type: str + self.__vaulting_session_expiry_time = None # type: str + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AlipayVaultingSessionResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value + @property + def vaulting_session_data(self): + """ + The encrypted vaulting session data. Pass the data to your front end to initiate the client-side SDK. More information: Maximum length: 4096 characters + """ + return self.__vaulting_session_data + + @vaulting_session_data.setter + def vaulting_session_data(self, value): + self.__vaulting_session_data = value + @property + def vaulting_session_id(self): + """ + The encrypted ID is assigned by Antom to identify a vaulting session. More information: Maximum length: 64 characters + """ + return self.__vaulting_session_id + + @vaulting_session_id.setter + def vaulting_session_id(self, value): + self.__vaulting_session_id = value + @property + def vaulting_session_expiry_time(self): + """ + The specific date and time after which the vaulting session will expire. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ + return self.__vaulting_session_expiry_time + + @vaulting_session_expiry_time.setter + def vaulting_session_expiry_time(self, value): + self.__vaulting_session_expiry_time = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "vaulting_session_data") and self.vaulting_session_data is not None: + params['vaultingSessionData'] = self.vaulting_session_data + if hasattr(self, "vaulting_session_id") and self.vaulting_session_id is not None: + params['vaultingSessionId'] = self.vaulting_session_id + if hasattr(self, "vaulting_session_expiry_time") and self.vaulting_session_expiry_time is not None: + params['vaultingSessionExpiryTime'] = self.vaulting_session_expiry_time + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AlipayVaultingSessionResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'vaultingSessionData' in response_body: + self.__vaulting_session_data = response_body['vaultingSessionData'] + if 'vaultingSessionId' in response_body: + self.__vaulting_session_id = response_body['vaultingSessionId'] + if 'vaultingSessionExpiryTime' in response_body: + self.__vaulting_session_expiry_time = response_body['vaultingSessionExpiryTime'] diff --git a/com/alipay/ams/api/response/pay/ams_api_v1_payments_capture_post200_response.py b/com/alipay/ams/api/response/pay/ams_api_v1_payments_capture_post200_response.py new file mode 100644 index 0000000..83c92b5 --- /dev/null +++ b/com/alipay/ams/api/response/pay/ams_api_v1_payments_capture_post200_response.py @@ -0,0 +1,133 @@ +import json +from com.alipay.ams.api.model.result import Result +from com.alipay.ams.api.model.amount import Amount + + + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AmsApiV1PaymentsCapturePost200Response(AlipayResponse): + def __init__(self, rsp_body): + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__capture_request_id = None # type: str + self.__capture_id = None # type: str + self.__payment_id = None # type: str + self.__capture_amount = None # type: Amount + self.__capture_time = None # type: str + self.__acquirer_reference_no = None # type: str + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AmsApiV1PaymentsCapturePost200Response. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value + @property + def capture_request_id(self): + """ + The unique ID that is assigned by a merchant to identify a capture request. Note: This parameter is returned when the capture status is successful. More information: Maximum length: 64 characters + """ + return self.__capture_request_id + + @capture_request_id.setter + def capture_request_id(self, value): + self.__capture_request_id = value + @property + def capture_id(self): + """ + The unique ID that is assigned by Antom to identify a capture. Note: This parameter is returned when the capture status is successful. More information: Maximum length: 64 characters + """ + return self.__capture_id + + @capture_id.setter + def capture_id(self, value): + self.__capture_id = value + @property + def payment_id(self): + """ + The unique ID that is assigned by Antom to identify a payment. Note: This parameter is returned when the capture status is successful. More information: Maximum length: 64 characters + """ + return self.__payment_id + + @payment_id.setter + def payment_id(self, value): + self.__payment_id = value + @property + def capture_amount(self): + """Gets the capture_amount of this AmsApiV1PaymentsCapturePost200Response. + + """ + return self.__capture_amount + + @capture_amount.setter + def capture_amount(self, value): + self.__capture_amount = value + @property + def capture_time(self): + """ + The time when Antom captures the payment. Note: This parameter is returned when the capture status is successful. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ + return self.__capture_time + + @capture_time.setter + def capture_time(self, value): + self.__capture_time = value + @property + def acquirer_reference_no(self): + """ + The unique ID assigned by the non-Antom acquirer for the transaction. More information: Maximum length: 64 characters + """ + return self.__acquirer_reference_no + + @acquirer_reference_no.setter + def acquirer_reference_no(self, value): + self.__acquirer_reference_no = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "capture_request_id") and self.capture_request_id is not None: + params['captureRequestId'] = self.capture_request_id + if hasattr(self, "capture_id") and self.capture_id is not None: + params['captureId'] = self.capture_id + if hasattr(self, "payment_id") and self.payment_id is not None: + params['paymentId'] = self.payment_id + if hasattr(self, "capture_amount") and self.capture_amount is not None: + params['captureAmount'] = self.capture_amount + if hasattr(self, "capture_time") and self.capture_time is not None: + params['captureTime'] = self.capture_time + if hasattr(self, "acquirer_reference_no") and self.acquirer_reference_no is not None: + params['acquirerReferenceNo'] = self.acquirer_reference_no + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AmsApiV1PaymentsCapturePost200Response, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'captureRequestId' in response_body: + self.__capture_request_id = response_body['captureRequestId'] + if 'captureId' in response_body: + self.__capture_id = response_body['captureId'] + if 'paymentId' in response_body: + self.__payment_id = response_body['paymentId'] + if 'captureAmount' in response_body: + self.__capture_amount = Amount() + self.__capture_amount.parse_rsp_body(response_body['captureAmount']) + if 'captureTime' in response_body: + self.__capture_time = response_body['captureTime'] + if 'acquirerReferenceNo' in response_body: + self.__acquirer_reference_no = response_body['acquirerReferenceNo'] diff --git a/com/alipay/ams/api/response/pay/ams_api_v1_payments_inquiry_refund_post200_response.py b/com/alipay/ams/api/response/pay/ams_api_v1_payments_inquiry_refund_post200_response.py new file mode 100644 index 0000000..8d35bc9 --- /dev/null +++ b/com/alipay/ams/api/response/pay/ams_api_v1_payments_inquiry_refund_post200_response.py @@ -0,0 +1,171 @@ +import json +from com.alipay.ams.api.model.result import Result +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.transaction_status_type import TransactionStatusType +from com.alipay.ams.api.model.amount import Amount +from com.alipay.ams.api.model.quote import Quote +from com.alipay.ams.api.model.acquirer_info import AcquirerInfo + + + +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AmsApiV1PaymentsInquiryRefundPost200Response(AlipayResponse): + def __init__(self, rsp_body): + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__refund_id = None # type: str + self.__refund_request_id = None # type: str + self.__refund_amount = None # type: Amount + self.__refund_status = None # type: TransactionStatusType + self.__refund_time = None # type: str + self.__gross_settlement_amount = None # type: Amount + self.__settlement_quote = None # type: Quote + self.__acquirer_info = None # type: AcquirerInfo + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AmsApiV1PaymentsInquiryRefundPost200Response. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value + @property + def refund_id(self): + """ + The unique ID assigned by Antom to identify a refund. A one-to-one correspondence between refundId and refundRequestId exists. Note: This field is null when the refund record cannot be found, or result.resultStatus is F or U. + """ + return self.__refund_id + + @refund_id.setter + def refund_id(self, value): + self.__refund_id = value + @property + def refund_request_id(self): + """ + The unique ID assigned by the merchant to identify a refund request. Note: This field is null when the refund record cannot be found, or result.resultStatus is F or U. More information: Maximum length: 64 characters + """ + return self.__refund_request_id + + @refund_request_id.setter + def refund_request_id(self, value): + self.__refund_request_id = value + @property + def refund_amount(self): + """Gets the refund_amount of this AmsApiV1PaymentsInquiryRefundPost200Response. + + """ + return self.__refund_amount + + @refund_amount.setter + def refund_amount(self, value): + self.__refund_amount = value + @property + def refund_status(self): + """Gets the refund_status of this AmsApiV1PaymentsInquiryRefundPost200Response. + + """ + return self.__refund_status + + @refund_status.setter + def refund_status(self, value): + self.__refund_status = value + @property + def refund_time(self): + """ + The date and time when the refund reaches a final state of success on the Antom side, not the Alipay+ Mobile Payment Provider (Alipay+ payment methods) side. Note: This field is returned when the value of refundStatus is SUCCESS. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + """ + return self.__refund_time + + @refund_time.setter + def refund_time(self, value): + self.__refund_time = value + @property + def gross_settlement_amount(self): + """Gets the gross_settlement_amount of this AmsApiV1PaymentsInquiryRefundPost200Response. + + """ + return self.__gross_settlement_amount + + @gross_settlement_amount.setter + def gross_settlement_amount(self, value): + self.__gross_settlement_amount = value + @property + def settlement_quote(self): + """Gets the settlement_quote of this AmsApiV1PaymentsInquiryRefundPost200Response. + + """ + return self.__settlement_quote + + @settlement_quote.setter + def settlement_quote(self, value): + self.__settlement_quote = value + @property + def acquirer_info(self): + """Gets the acquirer_info of this AmsApiV1PaymentsInquiryRefundPost200Response. + + """ + return self.__acquirer_info + + @acquirer_info.setter + def acquirer_info(self, value): + self.__acquirer_info = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "refund_id") and self.refund_id is not None: + params['refundId'] = self.refund_id + if hasattr(self, "refund_request_id") and self.refund_request_id is not None: + params['refundRequestId'] = self.refund_request_id + if hasattr(self, "refund_amount") and self.refund_amount is not None: + params['refundAmount'] = self.refund_amount + if hasattr(self, "refund_status") and self.refund_status is not None: + params['refundStatus'] = self.refund_status + if hasattr(self, "refund_time") and self.refund_time is not None: + params['refundTime'] = self.refund_time + if hasattr(self, "gross_settlement_amount") and self.gross_settlement_amount is not None: + params['grossSettlementAmount'] = self.gross_settlement_amount + if hasattr(self, "settlement_quote") and self.settlement_quote is not None: + params['settlementQuote'] = self.settlement_quote + if hasattr(self, "acquirer_info") and self.acquirer_info is not None: + params['acquirerInfo'] = self.acquirer_info + return params + + + def parse_rsp_body(self, response_body): + response_body = super(AmsApiV1PaymentsInquiryRefundPost200Response, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'refundId' in response_body: + self.__refund_id = response_body['refundId'] + if 'refundRequestId' in response_body: + self.__refund_request_id = response_body['refundRequestId'] + if 'refundAmount' in response_body: + self.__refund_amount = Amount() + self.__refund_amount.parse_rsp_body(response_body['refundAmount']) + if 'refundStatus' in response_body: + refund_status_temp = TransactionStatusType.value_of(response_body['refundStatus']) + self.__refund_status = refund_status_temp + if 'refundTime' in response_body: + self.__refund_time = response_body['refundTime'] + if 'grossSettlementAmount' in response_body: + self.__gross_settlement_amount = Amount() + self.__gross_settlement_amount.parse_rsp_body(response_body['grossSettlementAmount']) + if 'settlementQuote' in response_body: + self.__settlement_quote = Quote() + self.__settlement_quote.parse_rsp_body(response_body['settlementQuote']) + if 'acquirerInfo' in response_body: + self.__acquirer_info = AcquirerInfo() + self.__acquirer_info.parse_rsp_body(response_body['acquirerInfo']) diff --git a/com/alipay/ams/api/response/subscription/alipay_subscription_cancel_response.py b/com/alipay/ams/api/response/subscription/alipay_subscription_cancel_response.py index d6d677c..186bc0d 100644 --- a/com/alipay/ams/api/response/subscription/alipay_subscription_cancel_response.py +++ b/com/alipay/ams/api/response/subscription/alipay_subscription_cancel_response.py @@ -1,12 +1,41 @@ -from com.alipay.ams.api.response.alipay_response import AlipayResponse +import json +from com.alipay.ams.api.model.result import Result -class AlipaySubscriptionCancelResponse(AlipayResponse): +from com.alipay.ams.api.response.alipay_response import AlipayResponse + +class AlipaySubscriptionCancelResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipaySubscriptionCancelResponse, self).__init__() + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AlipaySubscriptionCancelResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + return params - self.__parse_rsp_body(rsp_body) - def __parse_rsp_body(self, rsp_body): - rsp_dict = super(AlipaySubscriptionCancelResponse, self).parse_rsp_body(rsp_body) + def parse_rsp_body(self, response_body): + response_body = super(AlipaySubscriptionCancelResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) diff --git a/com/alipay/ams/api/response/subscription/alipay_subscription_change_response.py b/com/alipay/ams/api/response/subscription/alipay_subscription_change_response.py index 757a71b..1d45095 100644 --- a/com/alipay/ams/api/response/subscription/alipay_subscription_change_response.py +++ b/com/alipay/ams/api/response/subscription/alipay_subscription_change_response.py @@ -1,11 +1,41 @@ -from com.alipay.ams.api.response.alipay_response import AlipayResponse +import json +from com.alipay.ams.api.model.result import Result + + +from com.alipay.ams.api.response.alipay_response import AlipayResponse class AlipaySubscriptionChangeResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipaySubscriptionChangeResponse, self).__init__() + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AlipaySubscriptionChangeResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + return params - self.__parse_rsp_body(rsp_body) - def __parse_rsp_body(self, rsp_body): - rsp_dict = super(AlipaySubscriptionChangeResponse, self).parse_rsp_body(rsp_body) + def parse_rsp_body(self, response_body): + response_body = super(AlipaySubscriptionChangeResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) diff --git a/com/alipay/ams/api/response/subscription/alipay_subscription_create_response.py b/com/alipay/ams/api/response/subscription/alipay_subscription_create_response.py index 5bf399f..254c4ae 100644 --- a/com/alipay/ams/api/response/subscription/alipay_subscription_create_response.py +++ b/com/alipay/ams/api/response/subscription/alipay_subscription_create_response.py @@ -1,40 +1,101 @@ -from com.alipay.ams.api.response.alipay_response import AlipayResponse +import json +from com.alipay.ams.api.model.result import Result + + +from com.alipay.ams.api.response.alipay_response import AlipayResponse class AlipaySubscriptionCreateResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipaySubscriptionCreateResponse, self).__init__() - self.__scheme_url = None - self.__applink_url = None - self.__normal_url = None - self.__app_identifier = None - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.__scheme_url = None # type: str + self.__applink_url = None # type: str + self.__normal_url = None # type: str + self.__app_identifier = None # type: str + self.parse_rsp_body(rsp_body) + + @property + def result(self): + """Gets the result of this AlipaySubscriptionCreateResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value @property def scheme_url(self): + """ + The URL scheme that redirects users to open an app in an Android or iOS system when the target app is installed. Note: When the value of result.resultCode is S, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + """ return self.__scheme_url + @scheme_url.setter + def scheme_url(self, value): + self.__scheme_url = value @property def applink_url(self): + """ + The URL that redirects users to open an app when the target app is installed, or to open a WAP page when the target app is not installed. For Android, the URL is a Native App Link. For iOS, the URL is a Universal Link. Note: When the value of result.resultCode is S, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + """ return self.__applink_url + @applink_url.setter + def applink_url(self, value): + self.__applink_url = value @property def normal_url(self): + """ + The URL that redirects users to a WAP or Web page in the default browser or the embedded WebView. Note: When the value of result.resultCode is S, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + """ return self.__normal_url + @normal_url.setter + def normal_url(self, value): + self.__normal_url = value @property def app_identifier(self): + """ + An Android package name, which is used for Android app to open a cashier page. Note: This field is returned when result.resultCode is S and terminalType is APP or WAP. More information: Maximum length: 128 characters + """ return self.__app_identifier - def __parse_rsp_body(self, rsp_body): - rsp_dict = super(AlipaySubscriptionCreateResponse, self).parse_rsp_body(rsp_body) - if rsp_dict.get('schemeUrl'): - self.__scheme_url = rsp_dict.get('schemeUrl') - if rsp_dict.get('applinkUrl'): - self.__applink_url = rsp_dict.get('applinkUrl') - if rsp_dict.get('normalUrl'): - self.__normal_url = rsp_dict.get('normalUrl') - if rsp_dict.get('appIdentifier'): - self.__app_identifier = rsp_dict.get('appIdentifier') + @app_identifier.setter + def app_identifier(self, value): + self.__app_identifier = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + if hasattr(self, "scheme_url") and self.scheme_url is not None: + params['schemeUrl'] = self.scheme_url + if hasattr(self, "applink_url") and self.applink_url is not None: + params['applinkUrl'] = self.applink_url + if hasattr(self, "normal_url") and self.normal_url is not None: + params['normalUrl'] = self.normal_url + if hasattr(self, "app_identifier") and self.app_identifier is not None: + params['appIdentifier'] = self.app_identifier + return params + def parse_rsp_body(self, response_body): + response_body = super(AlipaySubscriptionCreateResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result']) + if 'schemeUrl' in response_body: + self.__scheme_url = response_body['schemeUrl'] + if 'applinkUrl' in response_body: + self.__applink_url = response_body['applinkUrl'] + if 'normalUrl' in response_body: + self.__normal_url = response_body['normalUrl'] + if 'appIdentifier' in response_body: + self.__app_identifier = response_body['appIdentifier'] diff --git a/com/alipay/ams/api/response/subscription/alipay_subscription_update_response.py b/com/alipay/ams/api/response/subscription/alipay_subscription_update_response.py index 83f8215..f23aaa8 100644 --- a/com/alipay/ams/api/response/subscription/alipay_subscription_update_response.py +++ b/com/alipay/ams/api/response/subscription/alipay_subscription_update_response.py @@ -1,11 +1,41 @@ -from com.alipay.ams.api.response.alipay_response import AlipayResponse +import json +from com.alipay.ams.api.model.result import Result + + +from com.alipay.ams.api.response.alipay_response import AlipayResponse class AlipaySubscriptionUpdateResponse(AlipayResponse): def __init__(self, rsp_body): - super(AlipaySubscriptionUpdateResponse, self).__init__() - self.__parse_rsp_body(rsp_body) + super(AlipayResponse, self).__init__() + + self.__result = None # type: Result + self.parse_rsp_body(rsp_body) + + + @property + def result(self): + """Gets the result of this AlipaySubscriptionUpdateResponse. + + """ + return self.__result + + @result.setter + def result(self, value): + self.__result = value + + + + + def to_ams_dict(self): + params = dict() + if hasattr(self, "result") and self.result is not None: + params['result'] = self.result + return params - def __parse_rsp_body(self, rsp_body): - rsp_dict = super(AlipaySubscriptionUpdateResponse, self).parse_rsp_body(rsp_body) + def parse_rsp_body(self, response_body): + response_body = super(AlipaySubscriptionUpdateResponse, self).parse_rsp_body(response_body) + if 'result' in response_body: + self.__result = Result() + self.__result.parse_rsp_body(response_body['result'])