├── com ├── __init__.py └── alipay │ ├── __init__.py │ └── ams │ ├── __init__.py │ └── api │ ├── __init__.py │ ├── net │ ├── __init__.py │ └── default_http_rpc.py │ ├── request │ ├── __init__.py │ ├── aba │ │ └── __init__.py │ ├── auth │ │ ├── __init__.py │ │ └── alipay_auth_query_token_request.py │ ├── pay │ │ ├── __init__.py │ │ ├── alipay_retrieve_payment_session_request.py │ │ ├── alipay_vaults_fetch_nonce_request.py │ │ └── alipay_refund_query_request.py │ ├── declare │ │ ├── __init__.py │ │ └── alipay_customs_query_request.py │ ├── dispute │ │ ├── __init__.py │ │ ├── alipay_accept_dispute_request.py │ │ └── alipay_supply_defense_document_request.py │ ├── merchant │ │ ├── __init__.py │ │ ├── alipay_merchant_registration_info_query_request.py │ │ └── alipay_merchant_registration_status_query_request.py │ ├── notify │ │ ├── __init__.py │ │ ├── alipay_notify.py │ │ ├── alipay_subscription_pay_notify.py │ │ └── alipay_vaulting_notify.py │ ├── risks │ │ ├── __init__.py │ │ ├── inquiry_risk_score_request.py │ │ └── risk_report_request.py │ ├── users │ │ ├── __init__.py │ │ ├── alipay_user_query_info_request.py │ │ └── alipay_verify_authentication_request.py │ ├── vaulting │ │ ├── __init__.py │ │ └── alipay_vaulting_query_request.py │ ├── marketplace │ │ ├── __init__.py │ │ └── alipay_inquire_balance_request.py │ ├── subscription │ │ └── __init__.py │ └── alipay_request.py │ ├── tools │ ├── __init__.py │ ├── constants.py │ ├── webhook_tool.py │ └── date_tools.py │ ├── exception │ ├── __init__.py │ └── exception.py │ ├── response │ ├── __init__.py │ ├── aba │ │ ├── __init__.py │ │ ├── AlipayInquiryStatementListResponse.py │ │ └── alipay_inquiry_statement_list_response.py │ ├── pay │ │ ├── __init__.py │ │ ├── alipay_upload_invoice_shipping_file_response.py │ │ ├── alipay_Inquire_exchange_rate_response.py │ │ ├── alipay_create_session_response.py │ │ ├── alipay_retrieve_payment_session_response.py │ │ ├── alipay_vaults_fetch_nonce_response.py │ │ ├── alipay_inquire_exchange_rate_response.py │ │ └── alipay_create_order_response.py │ ├── auth │ │ ├── __init__.py │ │ ├── alipay_auth_create_session_response.py │ │ ├── alipay_auth_revoke_token_response.py │ │ └── alipay_auth_query_token_response.py │ ├── declare │ │ ├── __init__.py │ │ └── alipay_customs_query_response.py │ ├── dispute │ │ └── __init__.py │ ├── merchant │ │ ├── __init__.py │ │ ├── alipay_merchant_registration_response.py │ │ ├── alipay_merchant_registration_info_query_response.py │ │ └── alipay_merchant_registration_status_query_response.py │ ├── risks │ │ ├── __init__.py │ │ ├── risk_report_response.py │ │ ├── send_refund_result_response.py │ │ ├── send_payment_result_response.py │ │ ├── risk_decide_response.py │ │ └── inquiry_risk_score_response.py │ ├── users │ │ ├── __init__.py │ │ ├── alipay_verify_authentication_response.py │ │ ├── alipay_init_authentication_response.py │ │ └── alipay_user_query_info_response.py │ ├── vaulting │ │ ├── __init__.py │ │ ├── alipay_vaulting_session_response.py │ │ ├── alipay_vaulting_payment_method_response.py │ │ └── alipay_vaulting_query_response.py │ ├── marketplace │ │ ├── __init__.py │ │ ├── alipay_settlement_info_update_response.py │ │ ├── alipay_register_response.py │ │ └── alipay_inquire_balance_response.py │ ├── subscription │ │ ├── __init__.py │ │ ├── alipay_subscription_cancel_response.py │ │ ├── alipay_subscription_change_response.py │ │ └── alipay_subscription_update_response.py │ └── alipay_response.py │ └── model │ ├── clearing_channel.py │ ├── http_method.py │ ├── cancellation_type.py │ ├── capture_mode.py │ ├── credential_type.py │ ├── delivery_method_type.py │ ├── subscription_status.py │ ├── identity_check_result.py │ ├── authentication_type.py │ ├── period_type.py │ ├── user_identity_type.py │ ├── authorization_phase.py │ ├── method_type.py │ ├── dispute_judged_result.py │ ├── authentication_channel_type.py │ ├── business_type.py │ ├── DisputeType.py │ ├── card_brand_type.py │ ├── subscription_notification_type.py │ ├── dispute_accept_reason_type.py │ ├── customer_id_type.py │ ├── DisputeJudgedResult.py │ ├── __init__.py │ ├── payment_method_type.py │ ├── credit_pay_fee_type.py │ ├── dispute_notification_type.py │ ├── os_type.py │ ├── wallet_payment_method_type.py │ ├── code_value_type.py │ ├── companyType.py │ ├── settle_to_type.py │ ├── account_type.py │ ├── merchant_type.py │ ├── company_unit_type.py │ ├── legal_entity_type.py │ ├── promotion_type.py │ ├── dispute_evidence_type.py │ ├── grant_type.py │ ├── account_holder_type.py │ ├── dispute_evidence_format_type.py │ ├── risk_score_type.py │ ├── challenge_trigger_source_type.py │ ├── result_status_type.py │ ├── declaration_biz_scene_type.py │ ├── disable_reason_type.py │ ├── class_type.py │ ├── presentment_mode.py │ ├── contact_type.py │ ├── extend_info.py │ ├── refund_from_type.py │ ├── terminal_type.py │ ├── challenge_type.py │ ├── transit_type.py │ ├── in_store_payment_scenario.py │ ├── product_code_type.py │ ├── customs_info.py │ ├── authorization_error.py │ ├── contact_info.py │ ├── display_type.py │ ├── payment_method_detail_type.py │ ├── funding_type.py │ ├── payment_detail.py │ ├── risk_env.py │ ├── merchant_customs_info.py │ ├── transaction_status_type.py │ ├── order_info.py │ ├── transaction_type.py │ ├── association_type.py │ ├── risk_score_detail.py │ ├── auth_code_form.py │ ├── interaction_type.py │ ├── settlement_strategy.py │ ├── scope_type.py │ ├── certificate_type.py │ ├── amount.py │ ├── payment_method_category_type.py │ ├── result_properties_result_code.py │ ├── result_properties_result_status.py │ ├── Statement.py │ ├── risk_order.py │ ├── risk_signal.py │ ├── currency_pair.py │ ├── logo.py │ ├── service.py │ ├── paymentOptionDetail.py │ ├── card_brand.py │ ├── fund_move_detail.py │ ├── support_card_brand.py │ ├── passenger_id_type.py │ ├── statement.py │ ├── payment_verification_data.py │ ├── stock_info.py │ ├── auth_meta_data.py │ ├── delivery_estimate.py │ ├── promotion_result.py │ ├── refund_detail.py │ ├── ancillary_data.py │ ├── settlement_detail.py │ ├── company_type.py │ ├── refund_record.py │ ├── risk_score_result.py │ ├── delivery_estimate_info.py │ ├── transfer_from_detail.py │ ├── declaration.py │ ├── installment.py │ ├── settlement_info.py │ ├── apple_pay_configuration.py │ ├── result.py │ └── available_payment_method.py ├── example └── __init__.py ├── templates ├── api.mustache ├── config.yaml └── enum.mustache ├── setup.cfg ├── LICENSE ├── .gitignore └── setup.py /com/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /com/alipay/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /templates/api.mustache: -------------------------------------------------------------------------------- 1 | {{!不实用API}} -------------------------------------------------------------------------------- /com/alipay/ams/api/net/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/tools/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/exception/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/aba/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/auth/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/pay/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/aba/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/pay/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/declare/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/dispute/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/merchant/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/notify/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/risks/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/users/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/vaulting/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/auth/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/declare/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/dispute/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/merchant/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/risks/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/users/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/vaulting/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/marketplace/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/subscription/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/marketplace/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/subscription/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /templates/config.yaml: -------------------------------------------------------------------------------- 1 | templateDir: ./templates 2 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = global-alipay-sdk-python 3 | version = 1.4.22 4 | 5 | [options] 6 | packages = find: 7 | -------------------------------------------------------------------------------- /com/alipay/ams/api/exception/exception.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | 5 | class AlipayApiException(ValueError): 6 | pass 7 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/clearing_channel.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class ClearingChannel(Enum): 5 | CUP = "1" 6 | NUCC = "2" 7 | OTHER = "3" 8 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/http_method.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | from enum import Enum, unique 4 | 5 | 6 | @unique 7 | class HttpMethod(Enum): 8 | POST = "POST" 9 | GET = "GET" 10 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/cancellation_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | class CancellationType(Enum): 5 | CANCEL = "CANCEL" 6 | TERMINATE = "TERMINATE" 7 | 8 | def to_ams_dict(self): 9 | return self.name 10 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/capture_mode.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class CaptureMode(Enum): 6 | AUTOMATIC = "AUTOMATIC" 7 | MANUAL = "MANUAL" 8 | 9 | def to_ams_dict(self): 10 | return self.name 11 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/credential_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class CredentialType(Enum): 6 | NETWORK_TOKEN = "NETWORK_TOKEN" 7 | PAN = "PAN" 8 | 9 | def to_ams_dict(self): 10 | return self.name 11 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/delivery_method_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class DeliveryMethodType(Enum): 6 | PHYSICAL = "PHYSICAL" 7 | DIGITAL = "DIGITAL" 8 | 9 | def to_ams_dict(self): 10 | return self.name 11 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/subscription_status.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class SubscriptionStatus(Enum): 6 | ACTIVE = "ACTIVE" 7 | TERMINATED = "TERMINATED" 8 | 9 | def to_ams_dict(self): 10 | return self.name 11 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/identity_check_result.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class IdentityCheckResult(Enum): 5 | CHECK_PASSED = "CHECK_PASSED" 6 | CHECK_NOT_PASSED = "CHECK_NOT_PASSED" 7 | 8 | def to_ams_dict(self): 9 | return self.name 10 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/authentication_type.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | from enum import Enum, unique 4 | 5 | 6 | @unique 7 | class AuthenticationType(Enum): 8 | OTP = "OTP" 9 | 10 | def to_ams_dict(self): 11 | return self.name 12 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/period_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class PeriodType(Enum): 6 | DAY = "DAY" 7 | WEEK = "WEEK" 8 | MONTH = "MONTH" 9 | YEAR = "YEAR" 10 | 11 | def to_ams_dict(self): 12 | return self.name 13 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/user_identity_type.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | from enum import Enum, unique 4 | 5 | 6 | @unique 7 | class UserIdentityType(Enum): 8 | WALLET_TOKEN = "WALLET_TOKEN" 9 | 10 | def to_ams_dict(self): 11 | return self.name 12 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/authorization_phase.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class AuthorizationPhase(Enum): 6 | PRE_AUTHORIZATION = "PRE_AUTHORIZATION" 7 | POST_AUTHORIZATION = "POST_AUTHORIZATION" 8 | 9 | def to_ams_dict(self): 10 | return self.name 11 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/method_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class MethodType(Enum): 6 | GET = "GET" 7 | POST = "POST" 8 | PUT = "PUT" 9 | DELETE = "DELETE" 10 | PATCH = "PATCH" 11 | 12 | def to_ams_dict(self): 13 | return self.name 14 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/dispute_judged_result.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class DisputeNotificationType(Enum): 6 | ACCEPT_BY_CUSTOMER = "ACCEPT_BY_CUSTOMER" 7 | ACCEPT_BY_MERCHANT = "ACCEPT_BY_MERCHANT" 8 | 9 | def to_ams_dict(self): 10 | return self.name 11 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/authentication_channel_type.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | from enum import Enum, unique 4 | 5 | 6 | @unique 7 | class AuthenticationChannelType(Enum): 8 | EMAIL = "EMAIL" 9 | SMS = "SMS" 10 | 11 | def to_ams_dict(self): 12 | return self.name 13 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/business_type.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | 5 | class BusinessType(object): 6 | HOTEL = "1" 7 | AIR_FLIGHT = "2" 8 | STUDAY_ABROAD = "3" 9 | TRADE = "4" 10 | OTHER = "5" 11 | 12 | def to_ams_dict(self): 13 | return self.name 14 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/DisputeType.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class DisputeJudgedResult(Enum): 6 | CHARGEBACK = "CHARGEBACK" 7 | RETRIEVAL_REQUEST = "RETRIEVAL_REQUEST" 8 | COMPLIANCE_REQUEST = "COMPLIANCE_REQUEST" 9 | 10 | 11 | def to_ams_dict(self): 12 | return self.name 13 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/card_brand_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class CardBrandType(Enum): 6 | VISA = "VISA" 7 | MASTERCARD = "MASTERCARD" 8 | AMEX = "AMEX" 9 | HIPERCARD = "HIPERCARD" 10 | ELO = "ELO" 11 | 12 | def to_ams_dict(self): 13 | return self.name 14 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/subscription_notification_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class SubscriptionNotificationType(Enum): 6 | CREATE = "CREATE" 7 | CHANGE = "CHANGE" 8 | CANCEL = "CANCEL" 9 | TERMINATE = "TERMINATE" 10 | 11 | def to_ams_dict(self): 12 | return self.name 13 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/dispute_accept_reason_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class DisputeAcceptReasonType(Enum): 6 | MERCHANT_ACCEPTED = "MERCHANT_ACCEPTED" 7 | TIMEOUT = "TIMEOUT" 8 | MANUAL_PROCESSING_ACCEPTED = "MANUAL_PROCESSING_ACCEPTED" 9 | 10 | def to_ams_dict(self): 11 | return self.name 12 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/customer_id_type.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | from enum import Enum, unique 4 | 5 | 6 | @unique 7 | class CustomerIdType(Enum): 8 | EMAIL = "EMAIL" 9 | USER_ID = "USER_ID" 10 | MOBILE_NO = "MOBILE_NO" 11 | AUTH_CODE = "AUTH_CODE" 12 | 13 | def to_ams_dict(self): 14 | return self.name 15 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/DisputeJudgedResult.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class DisputeJudgedResult(Enum): 6 | ACCEPT_BY_CUSTOMER = "ACCEPT_BY_CUSTOMER" 7 | ACCEPT_BY_MERCHANT = "ACCEPT_BY_MERCHANT" 8 | VALIDATE_SUCCESS = "VALIDATE_SUCCESS" 9 | VALIDATE_FAIL = "VALIDATE_FAIL" 10 | 11 | 12 | def to_ams_dict(self): 13 | return self.name 14 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/__init__.py: -------------------------------------------------------------------------------- 1 | # we can not import model classes here because that would create a circular 2 | # reference which would not work in python2 3 | # do not import all models into this module because that uses a lot of memory and stack frames 4 | # if you need the ability to import all models from one package, import them with 5 | # from openapi_client.models import ModelA, ModelB 6 | -------------------------------------------------------------------------------- /com/alipay/ams/api/tools/constants.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import sys 4 | 5 | IS_PYTHON_VERSION_3 = True 6 | if sys.version_info < (3, 0): 7 | IS_PYTHON_VERSION_3 = False 8 | 9 | IS_PYTHON_VERSION_cryptography = True 10 | if sys.version_info < (2.7, 0): 11 | IS_PYTHON_VERSION_3 = False 12 | 13 | DEFAULT_KEY_VERSION = "1" 14 | 15 | DEFAULT_CHARSET = "UTF-8" 16 | 17 | DEFAULT_TIMEOUT = 15 18 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/risks/risk_report_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 2 | 3 | 4 | class RiskReportResponse(AlipayResponse): 5 | def __init__(self, rsp_body): 6 | super(RiskReportResponse, self).__init__() 7 | self.__parse_rsp_body(rsp_body) 8 | 9 | def __parse_rsp_body(self, rsp_body): 10 | response = super(RiskReportResponse, self).parse_rsp_body(rsp_body) 11 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/payment_method_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class PaymentMethodType(Enum): 6 | DISCOUNT = "DISCOUNT" 7 | INTEREST_FREE = "INTEREST_FREE" 8 | BALANCE_ACCOUNT = "BALANCE_ACCOUNT" 9 | SETTLEMENT_CARD = "SETTLEMENT_CARD" 10 | APPLEPAY = "APPLEPAY" 11 | UPI = "UPI" 12 | ONLINEBANKING_NETBANKING = "ONLINEBANKING_NETBANKING" 13 | 14 | def to_ams_dict(self): 15 | return self.name 16 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/risks/send_refund_result_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 2 | 3 | 4 | class SendRefundResultResponse(AlipayResponse): 5 | def __init__(self, rsp_body): 6 | super(SendRefundResultResponse, self).__init__() 7 | self.__parse_rsp_body(rsp_body) 8 | 9 | def __parse_rsp_body(self, rsp_body): 10 | response = super(SendRefundResultResponse, self).parse_rsp_body(rsp_body) 11 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/risks/send_payment_result_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 2 | 3 | 4 | class SendPaymentResultResponse(AlipayResponse): 5 | 6 | def __init__(self, rsp_body): 7 | super(SendPaymentResultResponse, self).__init__() 8 | self.__parse_rsp_body(rsp_body) 9 | 10 | def __parse_rsp_body(self, rsp_body): 11 | response = super(SendPaymentResultResponse, self).parse_rsp_body(rsp_body) 12 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/credit_pay_fee_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class CreditPayFeeType(Enum): 4 | """CreditPayFeeType枚举类""" 5 | 6 | PERCENTAGE = "PERCENTAGE" 7 | 8 | def to_ams_dict(self) -> str: 9 | return self.name 10 | 11 | @staticmethod 12 | def value_of(value): 13 | if not value: 14 | return None 15 | 16 | if CreditPayFeeType.PERCENTAGE.value == value: 17 | return CreditPayFeeType.PERCENTAGE 18 | return None 19 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/dispute_notification_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class DisputeNotificationType(Enum): 6 | DISPUTE_CREATED = "DISPUTE_CREATED" 7 | DISPUTE_JUDGED = "DISPUTE_JUDGED" 8 | DISPUTE_CANCELLED = "DISPUTE_CANCELLED" 9 | DEFENSE_SUPPLIED = "DEFENSE_SUPPLIED" 10 | DEFENSE_DUE_ALERT = "DEFENSE_DUE_ALERT" 11 | DISPUTE_ACCEPTED = "DISPUTE_ACCEPTED" 12 | RDR_RESOLVED = "RDR_RESOLVED" 13 | 14 | def to_ams_dict(self): 15 | return self.name 16 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/os_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class OsType(Enum): 4 | """OsType枚举类""" 5 | 6 | IOS = "IOS" 7 | ANDROID = "ANDROID" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if OsType.IOS.value == value: 18 | return OsType.IOS 19 | if OsType.ANDROID.value == value: 20 | return OsType.ANDROID 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/wallet_payment_method_type.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | from enum import Enum, unique 4 | 5 | 6 | @unique 7 | class WalletPaymentMethodType(Enum): 8 | TRUEMONEY = "TRUEMONEY" 9 | ALIPAY_HK = "ALIPAY_HK" 10 | TNG = "TNG" 11 | ALIPAY_CN = "ALIPAY_CN" 12 | GCASH = "GCASH" 13 | DANA = "DANA" 14 | KAKAOPAY = "KAKAOPAY" 15 | BKASH = "BKASH" 16 | EASYPAISA = "EASYPAISA" 17 | CONNECT_WALLET = "CONNECT_WALLET" 18 | 19 | def to_ams_dict(self): 20 | return self.name 21 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/pay/alipay_upload_invoice_shipping_file_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 2 | 3 | 4 | class AlipayUploadInvoiceShippingFileResponse(AlipayResponse): 5 | def __init__(self, rsp_body): 6 | super(AlipayUploadInvoiceShippingFileResponse, self).__init__() 7 | self.__parse_rsp_body(rsp_body) 8 | 9 | def __parse_rsp_body(self, rsp_body): 10 | response = super(AlipayUploadInvoiceShippingFileResponse, self).parse_rsp_body( 11 | rsp_body 12 | ) 13 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/code_value_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class CodeValueType(Enum): 4 | """CodeValueType枚举类""" 5 | 6 | BARCODE = "BARCODE" 7 | QRCODE = "QRCODE" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if CodeValueType.BARCODE.value == value: 18 | return CodeValueType.BARCODE 19 | if CodeValueType.QRCODE.value == value: 20 | return CodeValueType.QRCODE 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/companyType.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class CompanyType(Enum): 6 | ENTERPRISE = "ENTERPRISE" 7 | PARTNERSHIP = "PARTNERSHIP" 8 | SOLE_PROPRIETORSHIP = "SOLE_PROPRIETORSHIP" 9 | STATE_OWNED_BUSINESS = "STATE_OWNED_BUSINESS" 10 | PRIVATELY_OWNED_BUSINESS = "PRIVATELY_OWNED_BUSINESS" 11 | PUBLICLY_LISTED_BUSINESS = "PUBLICLY_LISTED_BUSINESS" 12 | LTDA = "LTDA" 13 | SA = "SA" 14 | EIRELI = "EIRELI" 15 | BOFC = "BOFC" 16 | MEI = "MEI" 17 | EI = "EI" 18 | 19 | def to_ams_dict(self): 20 | return self.name 21 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/settle_to_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class SettleToType(Enum): 4 | """SettleToType枚举类""" 5 | 6 | SELLER = "SELLER" 7 | MARKETPLACE = "MARKETPLACE" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if SettleToType.SELLER.value == value: 18 | return SettleToType.SELLER 19 | if SettleToType.MARKETPLACE.value == value: 20 | return SettleToType.MARKETPLACE 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/account_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class AccountType(Enum): 4 | """AccountType枚举类""" 5 | 6 | CHECKING = "CHECKING" 7 | FIXED_DEPOSIT = "FIXED_DEPOSIT" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if AccountType.CHECKING.value == value: 18 | return AccountType.CHECKING 19 | if AccountType.FIXED_DEPOSIT.value == value: 20 | return AccountType.FIXED_DEPOSIT 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/merchant_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class MerchantType(Enum): 4 | """MerchantType枚举类""" 5 | 6 | INDIVIDUAL = "INDIVIDUAL" 7 | ENTERPRISE = "ENTERPRISE" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if MerchantType.INDIVIDUAL.value == value: 18 | return MerchantType.INDIVIDUAL 19 | if MerchantType.ENTERPRISE.value == value: 20 | return MerchantType.ENTERPRISE 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/company_unit_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class CompanyUnitType(Enum): 4 | """CompanyUnitType枚举类""" 5 | 6 | HEADQUARTER = "HEADQUARTER" 7 | BRANCH = "BRANCH" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if CompanyUnitType.HEADQUARTER.value == value: 18 | return CompanyUnitType.HEADQUARTER 19 | if CompanyUnitType.BRANCH.value == value: 20 | return CompanyUnitType.BRANCH 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/legal_entity_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class LegalEntityType(Enum): 4 | """LegalEntityType枚举类""" 5 | 6 | COMPANY = "COMPANY" 7 | INDIVIDUAL = "INDIVIDUAL" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if LegalEntityType.COMPANY.value == value: 18 | return LegalEntityType.COMPANY 19 | if LegalEntityType.INDIVIDUAL.value == value: 20 | return LegalEntityType.INDIVIDUAL 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/promotion_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class PromotionType(Enum): 4 | """PromotionType枚举类""" 5 | 6 | DISCOUNT = "DISCOUNT" 7 | INTEREST_FREE = "INTEREST_FREE" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if PromotionType.DISCOUNT.value == value: 18 | return PromotionType.DISCOUNT 19 | if PromotionType.INTEREST_FREE.value == value: 20 | return PromotionType.INTEREST_FREE 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/dispute_evidence_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class DisputeEvidenceType(Enum): 4 | """DisputeEvidenceType枚举类""" 5 | 6 | TEMPLATE = "TEMPLATE" 7 | FILE = "FILE" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if DisputeEvidenceType.TEMPLATE.value == value: 18 | return DisputeEvidenceType.TEMPLATE 19 | if DisputeEvidenceType.FILE.value == value: 20 | return DisputeEvidenceType.FILE 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/alipay_response.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import json 4 | 5 | from com.alipay.ams.api.model.result import Result 6 | 7 | 8 | class AlipayResponse(object): 9 | def __init__(self): 10 | self.__result = None 11 | 12 | @property 13 | def result(self): 14 | return self.__result 15 | 16 | def parse_rsp_body(self, rsp_body): 17 | response = json.loads(rsp_body) 18 | if "result" in response: 19 | result = Result() 20 | result.parse_rsp_body(response["result"]) 21 | self.__result = result 22 | return response 23 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/grant_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class GrantType(Enum): 4 | """GrantType枚举类""" 5 | 6 | AUTHORIZATION_CODE = "AUTHORIZATION_CODE" 7 | REFRESH_TOKEN = "REFRESH_TOKEN" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if GrantType.AUTHORIZATION_CODE.value == value: 18 | return GrantType.AUTHORIZATION_CODE 19 | if GrantType.REFRESH_TOKEN.value == value: 20 | return GrantType.REFRESH_TOKEN 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/account_holder_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class AccountHolderType(Enum): 4 | """AccountHolderType枚举类""" 5 | 6 | INDIVIDUAL = "INDIVIDUAL" 7 | ENTERPRISE = "ENTERPRISE" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if AccountHolderType.INDIVIDUAL.value == value: 18 | return AccountHolderType.INDIVIDUAL 19 | if AccountHolderType.ENTERPRISE.value == value: 20 | return AccountHolderType.ENTERPRISE 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/dispute_evidence_format_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class DisputeEvidenceFormatType(Enum): 4 | """DisputeEvidenceFormatType枚举类""" 5 | 6 | PDF = "PDF" 7 | WORD = "WORD" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if DisputeEvidenceFormatType.PDF.value == value: 18 | return DisputeEvidenceFormatType.PDF 19 | if DisputeEvidenceFormatType.WORD.value == value: 20 | return DisputeEvidenceFormatType.WORD 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/risk_score_type.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | from enum import Enum, unique 4 | 5 | 6 | @unique 7 | class RiskScoreType(Enum): 8 | NSF_SCORE = "NSF_SCORE" 9 | FRAUD_SCORE = "FRAUD_SCORE" 10 | 11 | def to_ams_dict(self): 12 | return self.name 13 | 14 | @staticmethod 15 | def value_of(value): 16 | if not value: 17 | return None 18 | 19 | if RiskScoreType.NSF_SCORE.value == value: 20 | return RiskScoreType.NSF_SCORE 21 | elif RiskScoreType.FRAUD_SCORE.value == value: 22 | return RiskScoreType.FRAUD_SCORE 23 | else: 24 | return None 25 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/challenge_trigger_source_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class ChallengeTriggerSourceType(Enum): 4 | """ChallengeTriggerSourceType枚举类""" 5 | 6 | AMS = "AMS" 7 | CHANNEL = "CHANNEL" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if ChallengeTriggerSourceType.AMS.value == value: 18 | return ChallengeTriggerSourceType.AMS 19 | if ChallengeTriggerSourceType.CHANNEL.value == value: 20 | return ChallengeTriggerSourceType.CHANNEL 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/result_status_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class ResultStatusType(Enum): 4 | """ResultStatusType枚举类""" 5 | 6 | S = "S" 7 | F = "F" 8 | U = "U" 9 | 10 | def to_ams_dict(self) -> str: 11 | return self.name 12 | 13 | @staticmethod 14 | def value_of(value): 15 | if not value: 16 | return None 17 | 18 | if ResultStatusType.S.value == value: 19 | return ResultStatusType.S 20 | if ResultStatusType.F.value == value: 21 | return ResultStatusType.F 22 | if ResultStatusType.U.value == value: 23 | return ResultStatusType.U 24 | return None 25 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/declaration_biz_scene_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class DeclarationBizSceneType(Enum): 4 | """申报时对应的行业分类。非OTA结汇场景不传,OTA场景必传,且与declarationBeneficiaryId需同时存在。""" 5 | 6 | AIRLINE = "AIRLINE" 7 | HOTEL = "HOTEL" 8 | 9 | def to_ams_dict(self) -> str: 10 | return self.name 11 | 12 | @staticmethod 13 | def value_of(value): 14 | if not value: 15 | return None 16 | 17 | if DeclarationBizSceneType.AIRLINE.value == value: 18 | return DeclarationBizSceneType.AIRLINE 19 | if DeclarationBizSceneType.HOTEL.value == value: 20 | return DeclarationBizSceneType.HOTEL 21 | return None 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/tools/webhook_tool.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.exception.exception import AlipayApiException 2 | 3 | from com.alipay.ams.api.tools.signature_tool import verify 4 | 5 | 6 | def check_signature( 7 | http_method, path, client_id, req_time_str, req_body, signature, alipay_public_key 8 | ): 9 | if signature and "signature=" in signature: 10 | signature = signature.split("signature=")[1] 11 | return verify( 12 | http_method, 13 | path, 14 | client_id, 15 | req_time_str, 16 | req_body, 17 | signature, 18 | alipay_public_key, 19 | ) 20 | raise AlipayApiException("signature invalid:" + str(signature)) 21 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/disable_reason_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class DisableReasonType(Enum): 6 | PAYMENT_ACCOUNT_NOT_AVAILABLE = "PAYMENT_ACCOUNT_NOT_AVAILABLE" 7 | EXCEED_CHANNEL_LIMIT_RULE = "EXCEED_CHANNEL_LIMIT_RULE" 8 | SERVICE_DEGRADE = "SERVICE_DEGRADE" 9 | CHANNEL_NOT_SUPPORT_CURRENCY = "CHANNEL_NOT_SUPPORT_CURRENCY" 10 | CHANNEL_DISABLE = "CHANNEL_DISABLE" 11 | CHANNEL_NOT_IN_SERVICE_TIME = "CHANNEL_NOT_IN_SERVICE_TIME" 12 | QUERY_IPP_INFO_FAILED = "QUERY_IPP_INFO_FAILED" 13 | LIMIT_CENTER_ACCESS_FAIL = "LIMIT_CENTER_ACCESS_FAIL" 14 | CURRENT_CHANNEL_NOT_EXIST = "CURRENT_CHANNEL_NOT_EXIST" 15 | 16 | def to_ams_dict(self): 17 | return self.name 18 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/class_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class ClassType(Enum): 4 | """ClassType枚举类""" 5 | 6 | FIRSTLEVEL = "FIRSTLEVEL" 7 | SECONDLEVEL = "SECONDLEVEL" 8 | THIRDLEVEL = "THIRDLEVEL" 9 | 10 | def to_ams_dict(self) -> str: 11 | return self.name 12 | 13 | @staticmethod 14 | def value_of(value): 15 | if not value: 16 | return None 17 | 18 | if ClassType.FIRSTLEVEL.value == value: 19 | return ClassType.FIRSTLEVEL 20 | if ClassType.SECONDLEVEL.value == value: 21 | return ClassType.SECONDLEVEL 22 | if ClassType.THIRDLEVEL.value == value: 23 | return ClassType.THIRDLEVEL 24 | return None 25 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/presentment_mode.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class PresentmentMode(Enum): 4 | """PresentmentMode枚举类""" 5 | 6 | BUNDLE = "BUNDLE" 7 | TILE = "TILE" 8 | UNIFIED = "UNIFIED" 9 | 10 | def to_ams_dict(self) -> str: 11 | return self.name 12 | 13 | @staticmethod 14 | def value_of(value): 15 | if not value: 16 | return None 17 | 18 | if PresentmentMode.BUNDLE.value == value: 19 | return PresentmentMode.BUNDLE 20 | if PresentmentMode.TILE.value == value: 21 | return PresentmentMode.TILE 22 | if PresentmentMode.UNIFIED.value == value: 23 | return PresentmentMode.UNIFIED 24 | return None 25 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/contact_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class ContactType(Enum): 4 | """ContactType枚举类""" 5 | 6 | EMAIL = "EMAIL" 7 | PHONE_NO = "PHONE_NO" 8 | COMMERCIAL_PHONE_NO = "COMMERCIAL_PHONE_NO" 9 | 10 | def to_ams_dict(self) -> str: 11 | return self.name 12 | 13 | @staticmethod 14 | def value_of(value): 15 | if not value: 16 | return None 17 | 18 | if ContactType.EMAIL.value == value: 19 | return ContactType.EMAIL 20 | if ContactType.PHONE_NO.value == value: 21 | return ContactType.PHONE_NO 22 | if ContactType.COMMERCIAL_PHONE_NO.value == value: 23 | return ContactType.COMMERCIAL_PHONE_NO 24 | return None 25 | -------------------------------------------------------------------------------- /templates/enum.mustache: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class {{classname}}(Enum): 4 | """{{#description}}{{description}}{{/description}}{{^description}}{{classname}}枚举类{{/description}}""" 5 | 6 | {{#allowableValues}} 7 | {{#enumVars}} 8 | {{name}} = "{{name}}" 9 | {{/enumVars}} 10 | {{/allowableValues}} 11 | 12 | def to_ams_dict(self) -> str: 13 | return self.name 14 | 15 | @staticmethod 16 | def value_of(value): 17 | if not value: 18 | return None 19 | 20 | {{#allowableValues}} 21 | {{#enumVars}} 22 | if {{classname}}.{{name}}.value == value: 23 | return {{classname}}.{{name}} 24 | {{/enumVars}} 25 | {{/allowableValues}} 26 | return None -------------------------------------------------------------------------------- /com/alipay/ams/api/tools/date_tools.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import time 5 | 6 | """ 7 | python3.2前版本中需要,时区支持 8 | """ 9 | try: 10 | import pytz 11 | except ImportError: 12 | pass 13 | 14 | from com.alipay.ams.api.tools.constants import * 15 | from datetime import datetime 16 | 17 | """ 18 | python version > 3.2有timezone模块 19 | """ 20 | try: 21 | from datetime import timezone 22 | except ImportError: 23 | pass 24 | 25 | 26 | def get_cur_iso8601_time(): 27 | if not IS_PYTHON_VERSION_3: 28 | return datetime.fromtimestamp( 29 | int(time.time()), tz=pytz.timezone("UTC") 30 | ).isoformat() 31 | else: 32 | return datetime.fromtimestamp(int(time.time()), tz=timezone.utc).isoformat() 33 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/extend_info.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.model.china_extra_trans_info import ChinaExtraTransInfo 2 | 3 | 4 | class ExtendInfo(object): 5 | def __init__(self): 6 | self.__china_extra_trans_info = None # type:ChinaExtraTransInfo 7 | 8 | @property 9 | def china_extra_trans_info(self): 10 | return self.__china_extra_trans_info 11 | 12 | @china_extra_trans_info.setter 13 | def china_extra_trans_info(self, value): 14 | self.__china_extra_trans_info = value 15 | 16 | def to_ams_dict(self): 17 | params = dict() 18 | if hasattr(self, "china_extra_trans_info") and self.china_extra_trans_info: 19 | params["chinaExtraTransInfo"] = self.china_extra_trans_info 20 | 21 | return params 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/refund_from_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class RefundFromType(Enum): 4 | """RefundFromType枚举类""" 5 | 6 | SELLER = "SELLER" 7 | MARKETPLACE = "MARKETPLACE" 8 | UNSETTLED_FUNDS = "UNSETTLED_FUNDS" 9 | 10 | def to_ams_dict(self) -> str: 11 | return self.name 12 | 13 | @staticmethod 14 | def value_of(value): 15 | if not value: 16 | return None 17 | 18 | if RefundFromType.SELLER.value == value: 19 | return RefundFromType.SELLER 20 | if RefundFromType.MARKETPLACE.value == value: 21 | return RefundFromType.MARKETPLACE 22 | if RefundFromType.UNSETTLED_FUNDS.value == value: 23 | return RefundFromType.UNSETTLED_FUNDS 24 | return None 25 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/terminal_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class TerminalType(Enum): 4 | """TerminalType枚举类""" 5 | 6 | WEB = "WEB" 7 | WAP = "WAP" 8 | APP = "APP" 9 | MINI_APP = "MINI_APP" 10 | 11 | def to_ams_dict(self) -> str: 12 | return self.name 13 | 14 | @staticmethod 15 | def value_of(value): 16 | if not value: 17 | return None 18 | 19 | if TerminalType.WEB.value == value: 20 | return TerminalType.WEB 21 | if TerminalType.WAP.value == value: 22 | return TerminalType.WAP 23 | if TerminalType.APP.value == value: 24 | return TerminalType.APP 25 | if TerminalType.MINI_APP.value == value: 26 | return TerminalType.MINI_APP 27 | return None 28 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/challenge_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class ChallengeType(Enum): 4 | """ChallengeType枚举类""" 5 | 6 | SMS_OTP = "SMS_OTP" 7 | PLAINTEXT_CARD_NO = "PLAINTEXT_CARD_NO" 8 | CARD_EXPIRE_DATE = "CARD_EXPIRE_DATE" 9 | 10 | def to_ams_dict(self) -> str: 11 | return self.name 12 | 13 | @staticmethod 14 | def value_of(value): 15 | if not value: 16 | return None 17 | 18 | if ChallengeType.SMS_OTP.value == value: 19 | return ChallengeType.SMS_OTP 20 | if ChallengeType.PLAINTEXT_CARD_NO.value == value: 21 | return ChallengeType.PLAINTEXT_CARD_NO 22 | if ChallengeType.CARD_EXPIRE_DATE.value == value: 23 | return ChallengeType.CARD_EXPIRE_DATE 24 | return None 25 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/pay/alipay_Inquire_exchange_rate_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.model.quote import Quote 2 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 3 | 4 | 5 | class AlipayInquireExchangeRateResponse(AlipayResponse): 6 | def __init__(self, rsp_body): 7 | super(AlipayInquireExchangeRateResponse, self).__init__() 8 | self.__quotes = None # type: list[Quote] 9 | self.__parse_rsp_body(rsp_body) 10 | 11 | @property 12 | def quotes(self): 13 | return self.__quotes 14 | 15 | def __parse_rsp_body(self, rsp_body): 16 | response = super(AlipayInquireExchangeRateResponse, self).parse_rsp_body( 17 | rsp_body 18 | ) 19 | if "quotes" in response: 20 | self.__quotes = response["quotes"] 21 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/transit_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class TransitType(Enum): 4 | """Type of transit""" 5 | 6 | FLIGHT = "FLIGHT" 7 | TRAIN = "TRAIN" 8 | CRUISE = "CRUISE" 9 | COACH = "COACH" 10 | 11 | def to_ams_dict(self) -> str: 12 | return self.name 13 | 14 | @staticmethod 15 | def value_of(value): 16 | if not value: 17 | return None 18 | 19 | if TransitType.FLIGHT.value == value: 20 | return TransitType.FLIGHT 21 | if TransitType.TRAIN.value == value: 22 | return TransitType.TRAIN 23 | if TransitType.CRUISE.value == value: 24 | return TransitType.CRUISE 25 | if TransitType.COACH.value == value: 26 | return TransitType.COACH 27 | return None 28 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/users/alipay_verify_authentication_response.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 5 | 6 | 7 | class AlipayVerifyAuthenticationResponse(AlipayResponse): 8 | 9 | def __init__(self, rsp_body): 10 | super(AlipayVerifyAuthenticationResponse, self).__init__() 11 | self.__is_passed = None 12 | self.__parse_rsp_body(rsp_body) 13 | 14 | @property 15 | def is_passed(self): 16 | return self.__is_passed 17 | 18 | def __parse_rsp_body(self, rsp_body): 19 | response = super(AlipayVerifyAuthenticationResponse, self).parse_rsp_body( 20 | rsp_body 21 | ) 22 | if "isPassed" in response: 23 | self.__is_passed = response["isPassed"] 24 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/notify/alipay_notify.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from com.alipay.ams.api.model.result import Result 4 | 5 | 6 | class AlipayNotify(object): 7 | 8 | def __init__(self): 9 | self.__notify_type = None 10 | self.__result = None # type: Result 11 | 12 | @property 13 | def notify_type(self): 14 | return self.__notify_type 15 | 16 | @property 17 | def result(self): 18 | return self.__result 19 | 20 | def parse_notify_body(self, notify_body): 21 | notify = json.loads(notify_body) 22 | if "notifyType" in notify: 23 | self.__notify_type = notify["notifyType"] 24 | if "result" in notify: 25 | result = Result() 26 | result.parse_rsp_body(notify["result"]) 27 | self.__result = result 28 | return notify 29 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/in_store_payment_scenario.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class InStorePaymentScenario(Enum): 4 | """InStorePaymentScenario枚举类""" 5 | 6 | PAYMENTCODE = "PAYMENTCODE" 7 | ORDERCODE = "ORDERCODE" 8 | ENTRYCODE = "ENTRYCODE" 9 | 10 | def to_ams_dict(self) -> str: 11 | return self.name 12 | 13 | @staticmethod 14 | def value_of(value): 15 | if not value: 16 | return None 17 | 18 | if InStorePaymentScenario.PAYMENTCODE.value == value: 19 | return InStorePaymentScenario.PAYMENTCODE 20 | if InStorePaymentScenario.ORDERCODE.value == value: 21 | return InStorePaymentScenario.ORDERCODE 22 | if InStorePaymentScenario.ENTRYCODE.value == value: 23 | return InStorePaymentScenario.ENTRYCODE 24 | return None 25 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/product_code_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class ProductCodeType(Enum): 4 | """ProductCodeType枚举类""" 5 | 6 | CASHIER_PAYMENT = "CASHIER_PAYMENT" 7 | AGREEMENT_PAYMENT = "AGREEMENT_PAYMENT" 8 | IN_STORE_PAYMENT = "IN_STORE_PAYMENT" 9 | 10 | def to_ams_dict(self) -> str: 11 | return self.name 12 | 13 | @staticmethod 14 | def value_of(value): 15 | if not value: 16 | return None 17 | 18 | if ProductCodeType.CASHIER_PAYMENT.value == value: 19 | return ProductCodeType.CASHIER_PAYMENT 20 | if ProductCodeType.AGREEMENT_PAYMENT.value == value: 21 | return ProductCodeType.AGREEMENT_PAYMENT 22 | if ProductCodeType.IN_STORE_PAYMENT.value == value: 23 | return ProductCodeType.IN_STORE_PAYMENT 24 | return None 25 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/customs_info.py: -------------------------------------------------------------------------------- 1 | class CustomsInfo(object): 2 | def __init__(self): 3 | self.__customs_code = None 4 | self.__region = None 5 | 6 | @property 7 | def customs_code(self): 8 | return self.__customs_code 9 | 10 | @customs_code.setter 11 | def customs_code(self, value): 12 | self.__customs_code = value 13 | 14 | @property 15 | def region(self): 16 | return self.__region 17 | 18 | @region.setter 19 | def region(self, value): 20 | self.__region = value 21 | 22 | def to_ams_dict(self): 23 | params = dict() 24 | if hasattr(self, "customs_code") and self.customs_code: 25 | params["customsCode"] = self.customs_code 26 | if hasattr(self, "region") and self.region: 27 | params["region"] = self.region 28 | return params 29 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/merchant/alipay_merchant_registration_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 2 | 3 | 4 | class AlipayMerchantRegistrationResponse(AlipayResponse): 5 | 6 | def __init__(self, rsp_body): 7 | super(AlipayMerchantRegistrationResponse, self).__init__() 8 | self.__pass_through_info = None 9 | self.__parse_rsp_body(rsp_body) 10 | 11 | @property 12 | def pass_through_info(self): 13 | return self.__pass_through_info 14 | 15 | def __parse_rsp_body(self, rsp_body): 16 | response = super(AlipayMerchantRegistrationResponse, self).parse_rsp_body( 17 | rsp_body 18 | ) 19 | 20 | if "passThroughInfo" in response: 21 | pass_through_info = response["passThroughInfo"] 22 | self.__pass_through_info = pass_through_info 23 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/authorization_error.py: -------------------------------------------------------------------------------- 1 | class AuthorizationError: 2 | def __init__(self): 3 | self.__error_code = None 4 | self.__error_message = None 5 | 6 | @property 7 | def error_code(self): 8 | return self.__error_code 9 | 10 | @error_code.setter 11 | def error_code(self, value): 12 | self.__error_code = value 13 | 14 | @property 15 | def error_message(self): 16 | return self.__error_message 17 | 18 | @error_message.setter 19 | def error_message(self, value): 20 | self.__error_message = value 21 | 22 | def to_ams_dict(self): 23 | params = dict() 24 | if self.error_code is not None: 25 | params["errorCode"] = self.error_code 26 | if self.error_message is not None: 27 | params["errorMessage"] = self.error_message 28 | return params 29 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/users/alipay_init_authentication_response.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 5 | 6 | 7 | class AlipayInitAuthenticationResponse(AlipayResponse): 8 | 9 | def __init__(self, rsp_body): 10 | super(AlipayInitAuthenticationResponse, self).__init__() 11 | self.__authentication_request_id = None 12 | self.__parse_rsp_body(rsp_body) 13 | 14 | @property 15 | def authentication_request_id(self): 16 | return self.__authentication_request_id 17 | 18 | def __parse_rsp_body(self, rsp_body): 19 | response = super(AlipayInitAuthenticationResponse, self).parse_rsp_body( 20 | rsp_body 21 | ) 22 | if "authenticationRequestId" in response: 23 | self.__authentication_request_id = response["authenticationRequestId"] 24 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/contact_info.py: -------------------------------------------------------------------------------- 1 | class ContactInfo(object): 2 | def __init__(self): 3 | self.__contact_no = None 4 | self.__contact_type = None 5 | 6 | @property 7 | def contact_no(self): 8 | return self.__contact_no 9 | 10 | @contact_no.setter 11 | def contact_no(self, value): 12 | self.__contact_no = value 13 | 14 | @property 15 | def contact_type(self): 16 | return self.__contact_type 17 | 18 | @contact_type.setter 19 | def contact_type(self, value): 20 | self.__contact_type = value 21 | 22 | def to_ams_dict(self): 23 | params = dict() 24 | if hasattr(self, "contact_no") and self.contact_no: 25 | params["contactNo"] = self.contact_no 26 | 27 | if hasattr(self, "contact_type") and self.contact_type: 28 | params["contactType"] = self.contact_type 29 | 30 | return params 31 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/display_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class DisplayType(Enum): 4 | """DisplayType枚举类""" 5 | 6 | TEXT = "TEXT" 7 | MIDDLEIMAGE = "MIDDLEIMAGE" 8 | SMALLIMAGE = "SMALLIMAGE" 9 | BIGIMAGE = "BIGIMAGE" 10 | IMAGE = "IMAGE" 11 | 12 | def to_ams_dict(self) -> str: 13 | return self.name 14 | 15 | @staticmethod 16 | def value_of(value): 17 | if not value: 18 | return None 19 | 20 | if DisplayType.TEXT.value == value: 21 | return DisplayType.TEXT 22 | if DisplayType.MIDDLEIMAGE.value == value: 23 | return DisplayType.MIDDLEIMAGE 24 | if DisplayType.SMALLIMAGE.value == value: 25 | return DisplayType.SMALLIMAGE 26 | if DisplayType.BIGIMAGE.value == value: 27 | return DisplayType.BIGIMAGE 28 | if DisplayType.IMAGE.value == value: 29 | return DisplayType.IMAGE 30 | return None 31 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/users/alipay_user_query_info_request.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import json 5 | 6 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 7 | 8 | 9 | class AlipayUserQueryInfoRequest(AlipayRequest): 10 | 11 | def __init__(self): 12 | super(AlipayUserQueryInfoRequest, self).__init__() 13 | self.__access_token = None 14 | 15 | @property 16 | def access_token(self): 17 | return self.__access_token 18 | 19 | @access_token.setter 20 | def access_token(self, value): 21 | self.__access_token = value 22 | 23 | def to_ams_json(self): 24 | json_str = json.dumps(obj=self.__to_ams_dict(), indent=3) 25 | return json_str 26 | 27 | def __to_ams_dict(self): 28 | params = dict() 29 | if hasattr(self, "access_token") and self.access_token: 30 | params["accessToken"] = self.access_token 31 | 32 | return params 33 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/aba/AlipayInquiryStatementListResponse.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.model.Statement import Statement 2 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 3 | 4 | 5 | class AlipayInquiryStatementListResponse(AlipayResponse): 6 | def __init__(self, rsp_body): 7 | super(AlipayInquiryStatementListResponse, self).__init__() 8 | self.__statement_list = None # type: list:Statement 9 | self.__parse_rsp_body(rsp_body) 10 | 11 | @property 12 | def statement_list(self): 13 | return self.__statement_list 14 | 15 | @statement_list.setter 16 | def statement_list(self, value): 17 | self.__statement_list = value 18 | 19 | def __parse_rsp_body(self, rsp_body): 20 | response = super(AlipayInquiryStatementListResponse, self).parse_rsp_body( 21 | rsp_body 22 | ) 23 | if "statementList" in response: 24 | self.__statement_list = response["statementList"] 25 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/payment_method_detail_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class PaymentMethodDetailType(Enum): 4 | """PaymentMethodDetailType枚举类""" 5 | 6 | CARD = "CARD" 7 | EXTERNALACCOUNT = "EXTERNALACCOUNT" 8 | COUPON = "COUPON" 9 | DISCOUNT = "DISCOUNT" 10 | 11 | def to_ams_dict(self) -> str: 12 | return self.name 13 | 14 | @staticmethod 15 | def value_of(value): 16 | if not value: 17 | return None 18 | 19 | if PaymentMethodDetailType.CARD.value == value: 20 | return PaymentMethodDetailType.CARD 21 | if PaymentMethodDetailType.EXTERNALACCOUNT.value == value: 22 | return PaymentMethodDetailType.EXTERNALACCOUNT 23 | if PaymentMethodDetailType.COUPON.value == value: 24 | return PaymentMethodDetailType.COUPON 25 | if PaymentMethodDetailType.DISCOUNT.value == value: 26 | return PaymentMethodDetailType.DISCOUNT 27 | return None 28 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/funding_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class FundingType(Enum): 4 | """The funding source type for the payment method""" 5 | 6 | CREDIT = "CREDIT" 7 | DEBIT = "DEBIT" 8 | PREPAID = "PREPAID" 9 | CHARGE = "CHARGE" 10 | DEFERRED_DEBIT = "DEFERRED_DEBIT" 11 | 12 | def to_ams_dict(self) -> str: 13 | return self.name 14 | 15 | @staticmethod 16 | def value_of(value): 17 | if not value: 18 | return None 19 | 20 | if FundingType.CREDIT.value == value: 21 | return FundingType.CREDIT 22 | if FundingType.DEBIT.value == value: 23 | return FundingType.DEBIT 24 | if FundingType.PREPAID.value == value: 25 | return FundingType.PREPAID 26 | if FundingType.CHARGE.value == value: 27 | return FundingType.CHARGE 28 | if FundingType.DEFERRED_DEBIT.value == value: 29 | return FundingType.DEFERRED_DEBIT 30 | return None 31 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/payment_detail.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.model.amount import Amount 2 | from com.alipay.ams.api.model.payment_method import PaymentMethod 3 | 4 | 5 | class PaymentDetail: 6 | def __init__(self): 7 | self.__amount = None # type: Amount 8 | self.__payment_method = None # type: PaymentMethod 9 | 10 | @property 11 | def amount(self): 12 | return self.__amount 13 | 14 | @amount.setter 15 | def amount(self, value): 16 | self.__amount = value 17 | 18 | @property 19 | def payment_method(self): 20 | return self.__payment_method 21 | 22 | @payment_method.setter 23 | def payment_method(self, value): 24 | self.__payment_method = value 25 | 26 | def to_ams_dict(self): 27 | params = dict() 28 | if self.amount: 29 | params["amount"] = self.amount.to_ams_dict() 30 | if self.payment_method: 31 | params["paymentMethod"] = self.payment_method.to_ams_dict() 32 | return params 33 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/risk_env.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class RiskEnv: 7 | def __init__(self): 8 | 9 | self.__ip_address_type = None # type: str 10 | 11 | 12 | @property 13 | def ip_address_type(self): 14 | """ 15 | The type of an IP address 16 | """ 17 | return self.__ip_address_type 18 | 19 | @ip_address_type.setter 20 | def ip_address_type(self, value): 21 | self.__ip_address_type = value 22 | 23 | 24 | 25 | 26 | def to_ams_dict(self): 27 | params = dict() 28 | if hasattr(self, "ip_address_type") and self.ip_address_type is not None: 29 | params['ipAddressType'] = self.ip_address_type 30 | return params 31 | 32 | 33 | def parse_rsp_body(self, response_body): 34 | if isinstance(response_body, str): 35 | response_body = json.loads(response_body) 36 | if 'ipAddressType' in response_body: 37 | self.__ip_address_type = response_body['ipAddressType'] 38 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/merchant_customs_info.py: -------------------------------------------------------------------------------- 1 | class MerchantCustomsInfo(object): 2 | def __init__(self): 3 | self.merchant_customs_code = None 4 | self.__merchant_customs_name = None 5 | 6 | @property 7 | def merchant_customs_code(self): 8 | return self.__merchant_customs_code 9 | 10 | @merchant_customs_code.setter 11 | def merchant_customs_code(self, value): 12 | self.__merchant_customs_code = value 13 | 14 | @property 15 | def merchant_customs_name(self): 16 | return self.__merchant_customs_name 17 | 18 | @merchant_customs_name.setter 19 | def merchant_customs_name(self, value): 20 | self.__merchant_customs_name = value 21 | 22 | def to_ams_dict(self): 23 | params = dict() 24 | if self.merchant_customs_code is not None: 25 | params["merchantCustomsCode"] = self.merchant_customs_code 26 | if self.merchant_customs_name is not None: 27 | params["merchantCustomsName"] = self.merchant_customs_name 28 | return params 29 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/merchant/alipay_merchant_registration_info_query_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 2 | 3 | 4 | class AlipayMerchantRegistrationInfoQueryResponse(AlipayResponse): 5 | 6 | def __init__(self, rsp_body): 7 | super(AlipayMerchantRegistrationInfoQueryResponse, self).__init__() 8 | self.__merchant_info = None 9 | self.__product_codes = None 10 | self.__parse_rsp_body(rsp_body) 11 | 12 | @property 13 | def merchant_info(self): 14 | return self.__merchant_info 15 | 16 | @property 17 | def product_codes(self): 18 | return self.__product_codes 19 | 20 | def __parse_rsp_body(self, rsp_body): 21 | response = super( 22 | AlipayMerchantRegistrationInfoQueryResponse, self 23 | ).parse_rsp_body(rsp_body) 24 | if "merchantInfo" in response: 25 | self.__merchant_info = response["merchantInfo"] 26 | if "productCodes" in response: 27 | self.__product_codes = response["productCodes"] 28 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/transaction_status_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class TransactionStatusType(Enum): 4 | """TransactionStatusType枚举类""" 5 | 6 | SUCCESS = "SUCCESS" 7 | FAIL = "FAIL" 8 | PROCESSING = "PROCESSING" 9 | CANCELLED = "CANCELLED" 10 | PENDING = "PENDING" 11 | 12 | def to_ams_dict(self) -> str: 13 | return self.name 14 | 15 | @staticmethod 16 | def value_of(value): 17 | if not value: 18 | return None 19 | 20 | if TransactionStatusType.SUCCESS.value == value: 21 | return TransactionStatusType.SUCCESS 22 | if TransactionStatusType.FAIL.value == value: 23 | return TransactionStatusType.FAIL 24 | if TransactionStatusType.PROCESSING.value == value: 25 | return TransactionStatusType.PROCESSING 26 | if TransactionStatusType.CANCELLED.value == value: 27 | return TransactionStatusType.CANCELLED 28 | if TransactionStatusType.PENDING.value == value: 29 | return TransactionStatusType.PENDING 30 | return None 31 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/auth/alipay_auth_query_token_request.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import json 5 | 6 | from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants 7 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 8 | 9 | 10 | class AlipayAuthQueryTokenRequest(AlipayRequest): 11 | 12 | def __init__(self): 13 | super(AlipayAuthQueryTokenRequest, self).__init__( 14 | AntomPathConstants.AUTH_QUERY_PATH 15 | ) 16 | self.__access_token = None 17 | 18 | @property 19 | def access_token(self): 20 | return self.__access_token 21 | 22 | @access_token.setter 23 | def access_token(self, value): 24 | self.__access_token = value 25 | 26 | def to_ams_json(self): 27 | json_str = json.dumps(obj=self.__to_ams_dict(), indent=3) 28 | return json_str 29 | 30 | def __to_ams_dict(self): 31 | params = dict() 32 | if hasattr(self, "access_token") and self.access_token: 33 | params["accessToken"] = self.access_token 34 | return params 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Alipay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/order_info.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.amount import Amount 3 | 4 | 5 | 6 | 7 | class OrderInfo: 8 | def __init__(self): 9 | 10 | self.__order_amount = None # type: Amount 11 | 12 | 13 | @property 14 | def order_amount(self): 15 | """Gets the order_amount of this OrderInfo. 16 | 17 | """ 18 | return self.__order_amount 19 | 20 | @order_amount.setter 21 | def order_amount(self, value): 22 | self.__order_amount = value 23 | 24 | 25 | 26 | 27 | def to_ams_dict(self): 28 | params = dict() 29 | if hasattr(self, "order_amount") and self.order_amount is not None: 30 | params['orderAmount'] = self.order_amount 31 | return params 32 | 33 | 34 | def parse_rsp_body(self, response_body): 35 | if isinstance(response_body, str): 36 | response_body = json.loads(response_body) 37 | if 'orderAmount' in response_body: 38 | self.__order_amount = Amount() 39 | self.__order_amount.parse_rsp_body(response_body['orderAmount']) 40 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/transaction_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class TransactionType(Enum): 4 | """TransactionType枚举类""" 5 | 6 | PAYMENT = "PAYMENT" 7 | REFUND = "REFUND" 8 | CAPTURE = "CAPTURE" 9 | CANCEL = "CANCEL" 10 | AUTHORIZATION = "AUTHORIZATION" 11 | VOID = "VOID" 12 | 13 | def to_ams_dict(self) -> str: 14 | return self.name 15 | 16 | @staticmethod 17 | def value_of(value): 18 | if not value: 19 | return None 20 | 21 | if TransactionType.PAYMENT.value == value: 22 | return TransactionType.PAYMENT 23 | if TransactionType.REFUND.value == value: 24 | return TransactionType.REFUND 25 | if TransactionType.CAPTURE.value == value: 26 | return TransactionType.CAPTURE 27 | if TransactionType.CANCEL.value == value: 28 | return TransactionType.CANCEL 29 | if TransactionType.AUTHORIZATION.value == value: 30 | return TransactionType.AUTHORIZATION 31 | if TransactionType.VOID.value == value: 32 | return TransactionType.VOID 33 | return None 34 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/vaulting/alipay_vaulting_query_request.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants 4 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 5 | 6 | 7 | class AlipayVaultingQueryRequest(AlipayRequest): 8 | 9 | def __init__(self): 10 | super(AlipayVaultingQueryRequest, self).__init__( 11 | AntomPathConstants.INQUIRE_VAULTING_PATH 12 | ) 13 | self.__vaulting_request_id = None 14 | 15 | @property 16 | def vaulting_request_id(self): 17 | return self.__vaulting_request_id 18 | 19 | @vaulting_request_id.setter 20 | def vaulting_request_id(self, value): 21 | self.__vaulting_request_id = value 22 | 23 | def to_ams_json(self): 24 | json_str = json.dumps( 25 | obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3 26 | ) 27 | return json_str 28 | 29 | def __to_ams_dict(self): 30 | params = dict() 31 | if self.__vaulting_request_id is not None: 32 | params["vaultingRequestId"] = self.__vaulting_request_id 33 | return params 34 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/merchant/alipay_merchant_registration_status_query_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 2 | 3 | 4 | class AlipayMerchantRegistrationStatusQueryResponse(AlipayResponse): 5 | def __init__(self, rsp_body): 6 | super(AlipayMerchantRegistrationStatusQueryResponse, self).__init__() 7 | self.__registration_result = None 8 | self.__psp_registration_result_list = None 9 | self.__parse_rsp_body(rsp_body) 10 | 11 | @property 12 | def registration_result(self): 13 | return self.__registration_result 14 | 15 | @property 16 | def psp_registration_result_list(self): 17 | return self.__psp_registration_result_list 18 | 19 | def __parse_rsp_body(self, rsp_body): 20 | response = super( 21 | AlipayMerchantRegistrationStatusQueryResponse, self 22 | ).parse_rsp_body(rsp_body) 23 | if "registrationResult" in response: 24 | self.__registration_result = response["registrationResult"] 25 | 26 | if "pspRegistrationResultList" in response: 27 | self.__psp_registration_result_list = response["pspRegistrationResultList"] 28 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/pay/alipay_retrieve_payment_session_request.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants 4 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 5 | 6 | 7 | class AlipayRetrievePaymentSessionRequest(AlipayRequest): 8 | 9 | def __init__(self): 10 | super(AlipayRetrievePaymentSessionRequest, self).__init__( 11 | AntomPathConstants.RETRIEVE_PATH 12 | ) 13 | self.__payment_request_id = None 14 | 15 | @property 16 | def payment_request_id(self): 17 | return self.__payment_request_id 18 | 19 | @payment_request_id.setter 20 | def payment_request_id(self, value): 21 | self.__payment_request_id = value 22 | 23 | def to_ams_json(self): 24 | json_str = json.dumps( 25 | obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3 26 | ) 27 | return json_str 28 | 29 | def __to_ams_dict(self): 30 | params = dict() 31 | if hasattr(self, "payment_request_id") and self.__payment_request_id: 32 | params["payment_request_id"] = self.__payment_request_id 33 | return params 34 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/association_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class AssociationType(Enum): 4 | """AssociationType枚举类""" 5 | 6 | LEGAL_REPRESENTATIVE = "LEGAL_REPRESENTATIVE" 7 | UBO = "UBO" 8 | CONTACT = "CONTACT" 9 | DIRECTOR = "DIRECTOR" 10 | AUTHORIZER = "AUTHORIZER" 11 | BOARD_MEMBER = "BOARD_MEMBER" 12 | 13 | def to_ams_dict(self) -> str: 14 | return self.name 15 | 16 | @staticmethod 17 | def value_of(value): 18 | if not value: 19 | return None 20 | 21 | if AssociationType.LEGAL_REPRESENTATIVE.value == value: 22 | return AssociationType.LEGAL_REPRESENTATIVE 23 | if AssociationType.UBO.value == value: 24 | return AssociationType.UBO 25 | if AssociationType.CONTACT.value == value: 26 | return AssociationType.CONTACT 27 | if AssociationType.DIRECTOR.value == value: 28 | return AssociationType.DIRECTOR 29 | if AssociationType.AUTHORIZER.value == value: 30 | return AssociationType.AUTHORIZER 31 | if AssociationType.BOARD_MEMBER.value == value: 32 | return AssociationType.BOARD_MEMBER 33 | return None 34 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/declare/alipay_customs_query_request.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants 4 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 5 | 6 | 7 | class AlipayCustomsQueryRequest(AlipayRequest): 8 | def __init__(self): 9 | super(AlipayCustomsQueryRequest, self).__init__( 10 | AntomPathConstants.INQUIRY_DECLARE_PATH 11 | ) 12 | self.__declaration_request_ids = None # type: list[str] 13 | 14 | @property 15 | def declaration_request_ids(self): 16 | return self.__declaration_request_ids 17 | 18 | @declaration_request_ids.setter 19 | def declaration_request_ids(self, value): 20 | self.__declaration_request_ids = value 21 | 22 | def to_ams_json(self): 23 | json_str = json.dumps( 24 | obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3 25 | ) 26 | return json_str 27 | 28 | def __to_ams_dict(self): 29 | params = dict() 30 | if self.__declaration_request_ids is not None: 31 | params["declarationRequestIds"] = self.__declaration_request_ids 32 | return params 33 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/risk_score_detail.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import json 5 | 6 | 7 | class RiskScoreDetail(object): 8 | 9 | def __init__(self): 10 | self.__risk_info_code = None 11 | self.__risk_info_code_result = None 12 | 13 | @property 14 | def risk_info_code(self): 15 | return self.__risk_info_code 16 | 17 | @risk_info_code.setter 18 | def risk_info_code(self, value): 19 | self.__risk_info_code = value 20 | 21 | @property 22 | def risk_info_code_result(self): 23 | return self.__risk_info_code_result 24 | 25 | @risk_info_code_result.setter 26 | def risk_info_code_result(self, value): 27 | self.__risk_info_code_result = value 28 | 29 | def parse_rsp_body(self, risk_score_detail_body): 30 | if type(risk_score_detail_body) == str: 31 | risk_score_detail_body = json.loads(risk_score_detail_body) 32 | 33 | if "riskInfoCode" in risk_score_detail_body: 34 | self.__risk_info_code = risk_score_detail_body["riskInfoCode"] 35 | 36 | if "riskInfoCodeResult" in risk_score_detail_body: 37 | self.__risk_info_code_result = risk_score_detail_body["riskInfoCodeResult"] 38 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/risks/risk_decide_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 2 | 3 | 4 | class RiskDecideResponse(AlipayResponse): 5 | def __init__(self, rsp_body): 6 | super(RiskDecideResponse, self).__init__() 7 | self.__decision = None 8 | self.__authentication_decision = None 9 | self.__parse_rsp_body(rsp_body) 10 | 11 | @property 12 | def decision(self): 13 | return self.__decision 14 | 15 | @decision.setter 16 | def decision(self, decision): 17 | self.__decision = decision 18 | 19 | @property 20 | def authentication_decision(self): 21 | return self.__authentication_decision 22 | 23 | @authentication_decision.setter 24 | def authentication_decision(self, authentication_decision): 25 | self.__authentication_decision = authentication_decision 26 | 27 | def __parse_rsp_body(self, rsp_body): 28 | response = super(RiskDecideResponse, self).parse_rsp_body(rsp_body) 29 | if "decision" in response: 30 | self.decision = response["decision"] 31 | if "authentication_decision" in response: 32 | self.authentication_decision = response["authenticationDecision"] 33 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/auth_code_form.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.code_detail import CodeDetail 3 | 4 | 5 | 6 | 7 | class AuthCodeForm: 8 | def __init__(self): 9 | 10 | self.__code_details = None # type: [CodeDetail] 11 | 12 | 13 | @property 14 | def code_details(self): 15 | """ 16 | A list of QR code information. 17 | """ 18 | return self.__code_details 19 | 20 | @code_details.setter 21 | def code_details(self, value): 22 | self.__code_details = value 23 | 24 | 25 | 26 | 27 | def to_ams_dict(self): 28 | params = dict() 29 | if hasattr(self, "code_details") and self.code_details is not None: 30 | params['codeDetails'] = self.code_details 31 | return params 32 | 33 | 34 | def parse_rsp_body(self, response_body): 35 | if isinstance(response_body, str): 36 | response_body = json.loads(response_body) 37 | if 'codeDetails' in response_body: 38 | self.__code_details = [] 39 | for item in response_body['codeDetails']: 40 | obj = CodeDetail() 41 | obj.parse_rsp_body(item) 42 | self.__code_details.append(obj) 43 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/interaction_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class InteractionType(Enum): 4 | """The interaction type for the payment method.""" 5 | 6 | QR = "QR" 7 | REDIRECT = "REDIRECT" 8 | PUSH = "PUSH" 9 | ATM = "ATM" 10 | IBANKING = "IBANKING" 11 | BANKCOUNTER = "BANKCOUNTER" 12 | OTC = "OTC" 13 | 14 | def to_ams_dict(self) -> str: 15 | return self.name 16 | 17 | @staticmethod 18 | def value_of(value): 19 | if not value: 20 | return None 21 | 22 | if InteractionType.QR.value == value: 23 | return InteractionType.QR 24 | if InteractionType.REDIRECT.value == value: 25 | return InteractionType.REDIRECT 26 | if InteractionType.PUSH.value == value: 27 | return InteractionType.PUSH 28 | if InteractionType.ATM.value == value: 29 | return InteractionType.ATM 30 | if InteractionType.IBANKING.value == value: 31 | return InteractionType.IBANKING 32 | if InteractionType.BANKCOUNTER.value == value: 33 | return InteractionType.BANKCOUNTER 34 | if InteractionType.OTC.value == value: 35 | return InteractionType.OTC 36 | return None 37 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/users/alipay_user_query_info_response.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 5 | 6 | 7 | class AlipayUserQueryInfoResponse(AlipayResponse): 8 | 9 | def __init__(self, rsp_body): 10 | super(AlipayUserQueryInfoResponse, self).__init__() 11 | self.__user_id = None 12 | self.__user_login_id = None 13 | self.__hash_user_login_id = None 14 | self.__parse_rsp_body(rsp_body) 15 | 16 | @property 17 | def user_id(self): 18 | return self.__user_id 19 | 20 | @property 21 | def user_login_id(self): 22 | return self.__user_login_id 23 | 24 | @property 25 | def hash_user_login_id(self): 26 | return self.__hash_user_login_id 27 | 28 | def __parse_rsp_body(self, rsp_body): 29 | response = super(AlipayUserQueryInfoResponse, self).parse_rsp_body(rsp_body) 30 | if "userId" in response: 31 | self.__user_id = response["userId"] 32 | 33 | if "userLoginId" in response: 34 | self.__user_login_id = response["userLoginId"] 35 | 36 | if "hashUserLoginId" in response: 37 | self.__hash_user_login_id = response["hashUserLoginId"] 38 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/merchant/alipay_merchant_registration_info_query_request.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants 4 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 5 | 6 | 7 | class AlipayMerchantRegistrationInfoQueryRequest(AlipayRequest): 8 | 9 | def __init__(self): 10 | super(AlipayMerchantRegistrationInfoQueryRequest, self).__init__( 11 | AntomPathConstants.MERCHANTS_INQUIRY_REGISTRATION_PATH 12 | ) 13 | self.__reference_merchant_id = None 14 | 15 | @property 16 | def reference_merchant_id(self): 17 | return self.__reference_merchant_id 18 | 19 | @reference_merchant_id.setter 20 | def reference_merchant_id(self, value): 21 | self.__reference_merchant_id = value 22 | 23 | def to_ams_json(self): 24 | json_str = json.dumps( 25 | obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3 26 | ) 27 | return json_str 28 | 29 | def __to_ams_dict(self): 30 | params = dict() 31 | if hasattr(self, "reference_merchant_id") and self.reference_merchant_id: 32 | params["referenceMerchantId"] = self.reference_merchant_id 33 | 34 | return params 35 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/settlement_strategy.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class SettlementStrategy: 7 | def __init__(self): 8 | 9 | self.__settlement_currency = None # type: str 10 | 11 | 12 | @property 13 | def settlement_currency(self): 14 | """ 15 | 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 16 | """ 17 | return self.__settlement_currency 18 | 19 | @settlement_currency.setter 20 | def settlement_currency(self, value): 21 | self.__settlement_currency = value 22 | 23 | 24 | 25 | 26 | def to_ams_dict(self): 27 | params = dict() 28 | if hasattr(self, "settlement_currency") and self.settlement_currency is not None: 29 | params['settlementCurrency'] = self.settlement_currency 30 | return params 31 | 32 | 33 | def parse_rsp_body(self, response_body): 34 | if isinstance(response_body, str): 35 | response_body = json.loads(response_body) 36 | if 'settlementCurrency' in response_body: 37 | self.__settlement_currency = response_body['settlementCurrency'] 38 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/scope_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class ScopeType(Enum): 4 | """ScopeType枚举类""" 5 | 6 | BASE_USER_INFO = "BASE_USER_INFO" 7 | AGREEMENT_PAY = "AGREEMENT_PAY" 8 | USER_INFO = "USER_INFO" 9 | USER_LOGIN_ID = "USER_LOGIN_ID" 10 | HASH_LOGIN_ID = "HASH_LOGIN_ID" 11 | SEND_OTP = "SEND_OTP" 12 | TAOBAO_REBIND = "TAOBAO_REBIND" 13 | 14 | def to_ams_dict(self) -> str: 15 | return self.name 16 | 17 | @staticmethod 18 | def value_of(value): 19 | if not value: 20 | return None 21 | 22 | if ScopeType.BASE_USER_INFO.value == value: 23 | return ScopeType.BASE_USER_INFO 24 | if ScopeType.AGREEMENT_PAY.value == value: 25 | return ScopeType.AGREEMENT_PAY 26 | if ScopeType.USER_INFO.value == value: 27 | return ScopeType.USER_INFO 28 | if ScopeType.USER_LOGIN_ID.value == value: 29 | return ScopeType.USER_LOGIN_ID 30 | if ScopeType.HASH_LOGIN_ID.value == value: 31 | return ScopeType.HASH_LOGIN_ID 32 | if ScopeType.SEND_OTP.value == value: 33 | return ScopeType.SEND_OTP 34 | if ScopeType.TAOBAO_REBIND.value == value: 35 | return ScopeType.TAOBAO_REBIND 36 | return None 37 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/subscription/alipay_subscription_cancel_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.result import Result 3 | 4 | 5 | 6 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 7 | 8 | class AlipaySubscriptionCancelResponse(AlipayResponse): 9 | def __init__(self, rsp_body): 10 | super(AlipayResponse, self).__init__() 11 | 12 | self.__result = None # type: Result 13 | self.parse_rsp_body(rsp_body) 14 | 15 | 16 | @property 17 | def result(self): 18 | """Gets the result of this AlipaySubscriptionCancelResponse. 19 | 20 | """ 21 | return self.__result 22 | 23 | @result.setter 24 | def result(self, value): 25 | self.__result = value 26 | 27 | 28 | 29 | 30 | def to_ams_dict(self): 31 | params = dict() 32 | if hasattr(self, "result") and self.result is not None: 33 | params['result'] = self.result 34 | return params 35 | 36 | 37 | def parse_rsp_body(self, response_body): 38 | response_body = super(AlipaySubscriptionCancelResponse, self).parse_rsp_body(response_body) 39 | if 'result' in response_body: 40 | self.__result = Result() 41 | self.__result.parse_rsp_body(response_body['result']) 42 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/subscription/alipay_subscription_change_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.result import Result 3 | 4 | 5 | 6 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 7 | 8 | class AlipaySubscriptionChangeResponse(AlipayResponse): 9 | def __init__(self, rsp_body): 10 | super(AlipayResponse, self).__init__() 11 | 12 | self.__result = None # type: Result 13 | self.parse_rsp_body(rsp_body) 14 | 15 | 16 | @property 17 | def result(self): 18 | """Gets the result of this AlipaySubscriptionChangeResponse. 19 | 20 | """ 21 | return self.__result 22 | 23 | @result.setter 24 | def result(self, value): 25 | self.__result = value 26 | 27 | 28 | 29 | 30 | def to_ams_dict(self): 31 | params = dict() 32 | if hasattr(self, "result") and self.result is not None: 33 | params['result'] = self.result 34 | return params 35 | 36 | 37 | def parse_rsp_body(self, response_body): 38 | response_body = super(AlipaySubscriptionChangeResponse, self).parse_rsp_body(response_body) 39 | if 'result' in response_body: 40 | self.__result = Result() 41 | self.__result.parse_rsp_body(response_body['result']) 42 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/subscription/alipay_subscription_update_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.result import Result 3 | 4 | 5 | 6 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 7 | 8 | class AlipaySubscriptionUpdateResponse(AlipayResponse): 9 | def __init__(self, rsp_body): 10 | super(AlipayResponse, self).__init__() 11 | 12 | self.__result = None # type: Result 13 | self.parse_rsp_body(rsp_body) 14 | 15 | 16 | @property 17 | def result(self): 18 | """Gets the result of this AlipaySubscriptionUpdateResponse. 19 | 20 | """ 21 | return self.__result 22 | 23 | @result.setter 24 | def result(self, value): 25 | self.__result = value 26 | 27 | 28 | 29 | 30 | def to_ams_dict(self): 31 | params = dict() 32 | if hasattr(self, "result") and self.result is not None: 33 | params['result'] = self.result 34 | return params 35 | 36 | 37 | def parse_rsp_body(self, response_body): 38 | response_body = super(AlipaySubscriptionUpdateResponse, self).parse_rsp_body(response_body) 39 | if 'result' in response_body: 40 | self.__result = Result() 41 | self.__result.parse_rsp_body(response_body['result']) 42 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/alipay_request.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from com.alipay.ams.api.model.http_method import HttpMethod 5 | 6 | 7 | class AlipayRequest(object): 8 | 9 | # def __init__(self, path): 10 | # self.__path = path 11 | # self.__key_version = None 12 | # self.__http_method = HttpMethod.POST 13 | 14 | def __init__(self, *args, **kwargs): 15 | if args[0] is not None and hasattr(args[0], "value"): 16 | self.__path = args[0].value if len(args) > 0 else None 17 | else: 18 | self.__path = args[0] if len(args) > 0 else None 19 | self.__key_version = kwargs.get("key_version", None) 20 | self.__http_method = kwargs.get("http_method", HttpMethod.POST) 21 | 22 | @property 23 | def path(self): 24 | return self.__path 25 | 26 | @path.setter 27 | def path(self, value): 28 | self.__path = value 29 | 30 | @property 31 | def key_version(self): 32 | return self.__key_version 33 | 34 | @key_version.setter 35 | def key_version(self, value): 36 | self.__key_version = value 37 | 38 | @property 39 | def http_method(self): 40 | return self.__http_method 41 | 42 | @http_method.setter 43 | def http_method(self, value): 44 | self.__http_method = value 45 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/pay/alipay_create_session_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 2 | 3 | 4 | class AlipayCreateSessionResponse(AlipayResponse): 5 | 6 | def __init__(self, rsp_body): 7 | super(AlipayCreateSessionResponse, self).__init__() 8 | self.__payment_session_data = None 9 | self.__payment_session_expiry_time = None 10 | self.__payment_session_id = None 11 | self.__parse_rsp_body(rsp_body) 12 | 13 | @property 14 | def payment_session_data(self): 15 | return self.__payment_session_data 16 | 17 | @property 18 | def payment_session_expiry_time(self): 19 | return self.__payment_session_expiry_time 20 | 21 | @property 22 | def payment_session_id(self): 23 | return self.__payment_session_id 24 | 25 | def __parse_rsp_body(self, rsp_body): 26 | rsp_json = super(AlipayCreateSessionResponse, self).parse_rsp_body(rsp_body) 27 | if "paymentSessionData" in rsp_json: 28 | self.__payment_session_data = rsp_json["paymentSessionData"] 29 | if "paymentSessionExpiryTime" in rsp_json: 30 | self.__payment_session_expiry_time = rsp_json["paymentSessionExpiryTime"] 31 | if "paymentSessionId" in rsp_json: 32 | self.__payment_session_id = rsp_json["paymentSessionId"] 33 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/certificate_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class CertificateType(Enum): 4 | """CertificateType枚举类""" 5 | 6 | ENTERPRISE_REGISTRATION = "ENTERPRISE_REGISTRATION" 7 | LICENSE_INFO = "LICENSE_INFO" 8 | ID_CARD = "ID_CARD" 9 | PASSPORT = "PASSPORT" 10 | DRIVING_LICENSE = "DRIVING_LICENSE" 11 | CPF = "CPF" 12 | CNPJ = "CNPJ" 13 | 14 | def to_ams_dict(self) -> str: 15 | return self.name 16 | 17 | @staticmethod 18 | def value_of(value): 19 | if not value: 20 | return None 21 | 22 | if CertificateType.ENTERPRISE_REGISTRATION.value == value: 23 | return CertificateType.ENTERPRISE_REGISTRATION 24 | if CertificateType.LICENSE_INFO.value == value: 25 | return CertificateType.LICENSE_INFO 26 | if CertificateType.ID_CARD.value == value: 27 | return CertificateType.ID_CARD 28 | if CertificateType.PASSPORT.value == value: 29 | return CertificateType.PASSPORT 30 | if CertificateType.DRIVING_LICENSE.value == value: 31 | return CertificateType.DRIVING_LICENSE 32 | if CertificateType.CPF.value == value: 33 | return CertificateType.CPF 34 | if CertificateType.CNPJ.value == value: 35 | return CertificateType.CNPJ 36 | return None 37 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/vaulting/alipay_vaulting_session_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 2 | 3 | 4 | class AlipayVaultingSessionResponse(AlipayResponse): 5 | def __init__(self, rsp_body): 6 | super(AlipayVaultingSessionResponse, self).__init__() 7 | self.__vaulting_session_data = None 8 | self.__vaulting_session_id = None 9 | self.__vaulting_session_expiry_time = None 10 | self.__parse_rsp_body(rsp_body) 11 | 12 | @property 13 | def vaulting_session_data(self): 14 | return self.__vaulting_session_data 15 | 16 | @property 17 | def vaulting_session_id(self): 18 | return self.__vaulting_session_id 19 | 20 | @property 21 | def vaulting_session_expiry_time(self): 22 | return self.__vaulting_session_expiry_time 23 | 24 | def __parse_rsp_body(self, rsp_body): 25 | rsp_dict = super(AlipayVaultingSessionResponse, self).parse_rsp_body(rsp_body) 26 | if "vaultingSessionData" in rsp_dict: 27 | self.__vaulting_session_data = rsp_dict["vaultingSessionData"] 28 | if "vaultingSessionId" in rsp_dict: 29 | self.__vaulting_session_id = rsp_dict["vaultingSessionId"] 30 | if "vaultingSessionExpiryTime" in rsp_dict: 31 | self.__vaulting_session_expiry_time = rsp_dict["vaultingSessionExpiryTime"] 32 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/auth/alipay_auth_create_session_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 2 | 3 | 4 | class AlipayAuthCreateSessionResponse(AlipayResponse): 5 | 6 | def __init__(self, rsp_body): 7 | super(AlipayAuthCreateSessionResponse, self).__init__() 8 | self.__payment_session_id = None 9 | self.__payment_session_data = None 10 | self.__payment_session_expiry_time = None 11 | self.__parse_rsp_body(rsp_body) 12 | 13 | @property 14 | def payment_session_id(self): 15 | return self.__payment_session_id 16 | 17 | @property 18 | def payment_session_data(self): 19 | return self.__payment_session_data 20 | 21 | @property 22 | def payment_session_expiry_time(self): 23 | return self.__payment_session_expiry_time 24 | 25 | def __parse_rsp_body(self, rsp_body): 26 | response = super(AlipayAuthCreateSessionResponse, self).parse_rsp_body(rsp_body) 27 | if "paymentSessionId" in response: 28 | self.__payment_session_id = response["paymentSessionId"] 29 | 30 | if "paymentSessionData" in response: 31 | self.__payment_session_data = response["paymentSessionData"] 32 | 33 | if "paymentSessionExpiryTime" in response: 34 | self.__payment_session_expiry_time = response["paymentSessionExpiryTime"] 35 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/pay/alipay_vaults_fetch_nonce_request.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.card import Card 3 | 4 | 5 | 6 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 7 | 8 | class AlipayVaultsFetchNonceRequest(AlipayRequest): 9 | def __init__(self): 10 | super(AlipayVaultsFetchNonceRequest, self).__init__("/ams/api/v1/vaults/fetchNonce") 11 | 12 | self.__card = None # type: Card 13 | 14 | 15 | @property 16 | def card(self): 17 | """Gets the card of this AlipayVaultsFetchNonceRequest. 18 | 19 | """ 20 | return self.__card 21 | 22 | @card.setter 23 | def card(self, value): 24 | self.__card = value 25 | 26 | 27 | def to_ams_json(self): 28 | json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) 29 | return json_str 30 | 31 | 32 | def to_ams_dict(self): 33 | params = dict() 34 | if hasattr(self, "card") and self.card is not None: 35 | params['card'] = self.card 36 | return params 37 | 38 | 39 | def parse_rsp_body(self, response_body): 40 | if isinstance(response_body, str): 41 | response_body = json.loads(response_body) 42 | if 'card' in response_body: 43 | self.__card = Card() 44 | self.__card.parse_rsp_body(response_body['card']) 45 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/dispute/alipay_accept_dispute_request.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 6 | 7 | class AlipayAcceptDisputeRequest(AlipayRequest): 8 | def __init__(self): 9 | super(AlipayAcceptDisputeRequest, self).__init__("/ams/api/v1/payments/acceptDispute") 10 | 11 | self.__dispute_id = None # type: str 12 | 13 | 14 | @property 15 | def dispute_id(self): 16 | """ 17 | The unique ID assigned by Antom to identify a dispute. More information: Maximum length: 64 characters 18 | """ 19 | return self.__dispute_id 20 | 21 | @dispute_id.setter 22 | def dispute_id(self, value): 23 | self.__dispute_id = value 24 | 25 | 26 | def to_ams_json(self): 27 | json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) 28 | return json_str 29 | 30 | 31 | def to_ams_dict(self): 32 | params = dict() 33 | if hasattr(self, "dispute_id") and self.dispute_id is not None: 34 | params['disputeId'] = self.dispute_id 35 | return params 36 | 37 | 38 | def parse_rsp_body(self, response_body): 39 | if isinstance(response_body, str): 40 | response_body = json.loads(response_body) 41 | if 'disputeId' in response_body: 42 | self.__dispute_id = response_body['disputeId'] 43 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/pay/alipay_retrieve_payment_session_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.model.order import Order 2 | from com.alipay.ams.api.model.promotion_result import PromotionResult 3 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 4 | 5 | 6 | class AlipayRetrievePaymentSessionResponse(AlipayResponse): 7 | 8 | def __init__(self, rsp_body): 9 | super(AlipayRetrievePaymentSessionResponse, self).__init__() 10 | self.__order = None # type: Order 11 | self.__promotion_results = None # type: List: PromotionResult 12 | self.__customized_Info = None 13 | 14 | self.__parse_rsp_body(rsp_body) 15 | 16 | @property 17 | def order(self): 18 | return self.__order 19 | 20 | @property 21 | def promotion_results(self): 22 | return self.__promotion_results 23 | 24 | @property 25 | def customized_info(self): 26 | return self.__customized_info 27 | 28 | def __parse_rsp_body(self, rsp_body): 29 | response = super(AlipayRetrievePaymentSessionResponse, self).parse_rsp_body( 30 | rsp_body 31 | ) 32 | if "order" in response: 33 | self.__order = response["order"] 34 | if "promotionResults" in response: 35 | self.__promotion_results = response["promotionResults"] 36 | if "customizedInfo" in response: 37 | self.__customized_info = response["customizedInfo"] 38 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/amount.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class Amount: 7 | def __init__(self, currency=None, value=None): 8 | 9 | self.__currency = currency # type: str 10 | self.__value = value # type: str 11 | 12 | 13 | @property 14 | def currency(self): 15 | """Gets the currency of this Amount. 16 | 17 | """ 18 | return self.__currency 19 | 20 | @currency.setter 21 | def currency(self, value): 22 | self.__currency = value 23 | @property 24 | def value(self): 25 | """Gets the value of this Amount. 26 | 27 | """ 28 | return self.__value 29 | 30 | @value.setter 31 | def value(self, value): 32 | self.__value = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "currency") and self.currency is not None: 40 | params['currency'] = self.currency 41 | if hasattr(self, "value") and self.value is not None: 42 | params['value'] = self.value 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'currency' in response_body: 50 | self.__currency = response_body['currency'] 51 | if 'value' in response_body: 52 | self.__value = response_body['value'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/payment_method_category_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class PaymentMethodCategoryType(Enum): 4 | """PaymentMethodCategoryType枚举类""" 5 | 6 | ALIPAY_PLUS = "ALIPAY_PLUS" 7 | WALLET = "WALLET" 8 | MOBILE_BANKING_APP = "MOBILE_BANKING_APP" 9 | BANK_TRANSFER = "BANK_TRANSFER" 10 | ONLINE_BANKING = "ONLINE_BANKING" 11 | CARD = "CARD" 12 | OTC = "OTC" 13 | 14 | def to_ams_dict(self) -> str: 15 | return self.name 16 | 17 | @staticmethod 18 | def value_of(value): 19 | if not value: 20 | return None 21 | 22 | if PaymentMethodCategoryType.ALIPAY_PLUS.value == value: 23 | return PaymentMethodCategoryType.ALIPAY_PLUS 24 | if PaymentMethodCategoryType.WALLET.value == value: 25 | return PaymentMethodCategoryType.WALLET 26 | if PaymentMethodCategoryType.MOBILE_BANKING_APP.value == value: 27 | return PaymentMethodCategoryType.MOBILE_BANKING_APP 28 | if PaymentMethodCategoryType.BANK_TRANSFER.value == value: 29 | return PaymentMethodCategoryType.BANK_TRANSFER 30 | if PaymentMethodCategoryType.ONLINE_BANKING.value == value: 31 | return PaymentMethodCategoryType.ONLINE_BANKING 32 | if PaymentMethodCategoryType.CARD.value == value: 33 | return PaymentMethodCategoryType.CARD 34 | if PaymentMethodCategoryType.OTC.value == value: 35 | return PaymentMethodCategoryType.OTC 36 | return None 37 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/risks/inquiry_risk_score_response.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from com.alipay.ams.api.model.risk_score_result import RiskScoreResult 5 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 6 | 7 | 8 | class InquiryRiskScoreResponse(AlipayResponse): 9 | 10 | def __init__(self, rsp_body): 11 | super(InquiryRiskScoreResponse, self).__init__() 12 | self.__result = None 13 | self.__risk_score_results = None 14 | self.__parse_rsp_body(rsp_body) 15 | 16 | @property 17 | def result(self): 18 | return self.__result 19 | 20 | @result.setter 21 | def result(self, value): 22 | self.__result = value 23 | 24 | @property 25 | def risk_score_results(self): 26 | return self.__risk_score_results 27 | 28 | @risk_score_results.setter 29 | def risk_score_results(self, value): 30 | self.__risk_score_results = value 31 | 32 | def __parse_rsp_body(self, rsp_body): 33 | response = super(InquiryRiskScoreResponse, self).parse_rsp_body(rsp_body) 34 | if "result" in response: 35 | self.__result = response["result"] 36 | 37 | if "risk_score_results" in response: 38 | self.__risk_score_results = [] 39 | for entry in response["risk_score_results"]: 40 | risk_score_result = RiskScoreResult() 41 | risk_score_result.parse_rsp_body(entry) 42 | self.__risk_score_results.append(risk_score_result) 43 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/declare/alipay_customs_query_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from com.alipay.ams.api.model.declaration_record import DeclarationRecord 4 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 5 | 6 | 7 | class AlipayCustomsQueryResponse(AlipayResponse): 8 | 9 | def __init__(self, rsp_body): 10 | super(AlipayCustomsQueryResponse, self).__init__() 11 | self.__declaration_requests_not_found = None # type: list[str] 12 | self.__declaration_records = None # type: list[DeclarationRecord] 13 | self.parse_rsp_body(rsp_body) 14 | 15 | @property 16 | def declaration_requests_not_found(self): 17 | return self.__declaration_requests_not_found 18 | 19 | @property 20 | def declaration_records(self): 21 | return self.__declaration_records 22 | 23 | def parse_rsp_body(self, rsp_body): 24 | rsp_dict = super(AlipayCustomsQueryResponse, self).parse_rsp_body(rsp_body) 25 | if "declarationRequestsNotFound" in rsp_dict: 26 | self.__declaration_requests_not_found = rsp_dict[ 27 | "declarationRequestsNotFound" 28 | ] 29 | if "declarationRecords" in rsp_dict: 30 | self.__declaration_records = [] 31 | for declaration_record_dict in rsp_dict["declarationRecords"]: 32 | declaration_record = DeclarationRecord() 33 | declaration_record.parse_rsp_body(declaration_record_dict) 34 | self.__declaration_records.append(declaration_record) 35 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/result_properties_result_code.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class ResultPropertiesResultCode: 7 | def __init__(self): 8 | 9 | self.__type = None # type: str 10 | self.__description = None # type: str 11 | 12 | 13 | @property 14 | def type(self): 15 | """Gets the type of this ResultPropertiesResultCode. 16 | 17 | """ 18 | return self.__type 19 | 20 | @type.setter 21 | def type(self, value): 22 | self.__type = value 23 | @property 24 | def description(self): 25 | """Gets the description of this ResultPropertiesResultCode. 26 | 27 | """ 28 | return self.__description 29 | 30 | @description.setter 31 | def description(self, value): 32 | self.__description = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "type") and self.type is not None: 40 | params['type'] = self.type 41 | if hasattr(self, "description") and self.description is not None: 42 | params['description'] = self.description 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'type' in response_body: 50 | self.__type = response_body['type'] 51 | if 'description' in response_body: 52 | self.__description = response_body['description'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/result_properties_result_status.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class ResultPropertiesResultStatus: 7 | def __init__(self): 8 | 9 | self.__description = None # type: str 10 | self.__ref = None # type: str 11 | 12 | 13 | @property 14 | def description(self): 15 | """Gets the description of this ResultPropertiesResultStatus. 16 | 17 | """ 18 | return self.__description 19 | 20 | @description.setter 21 | def description(self, value): 22 | self.__description = value 23 | @property 24 | def ref(self): 25 | """Gets the ref of this ResultPropertiesResultStatus. 26 | 27 | """ 28 | return self.__ref 29 | 30 | @ref.setter 31 | def ref(self, value): 32 | self.__ref = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "description") and self.description is not None: 40 | params['description'] = self.description 41 | if hasattr(self, "ref") and self.ref is not None: 42 | params['$ref'] = self.ref 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'description' in response_body: 50 | self.__description = response_body['description'] 51 | if '$ref' in response_body: 52 | self.__ref = response_body['$ref'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/Statement.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from com.alipay.ams.api.model.fund_move_detail import FundMoveDetail 4 | 5 | 6 | class Statement(object): 7 | def __init__(self): 8 | self.__statement_id = None 9 | self.__fund_move_detail = None # type: FundMoveDetail 10 | 11 | @property 12 | def StatementId(self): 13 | return self.__statement_id 14 | 15 | @StatementId.setter 16 | def StatementId(self, value): 17 | self.__statement_id = value 18 | 19 | @property 20 | def FundMoveDetail(self): 21 | return self.__fund_move_detail 22 | 23 | @FundMoveDetail.setter 24 | def FundMoveDetail(self, value): 25 | self.__fund_move_detail = value 26 | 27 | def to_ams_dict(self): 28 | params = dict() 29 | if hasattr(self, "statement_id") and self.statement_id: 30 | params["statementId"] = self.statement_id 31 | if hasattr(self, "fund_move_detail") and self.fund_move_detail: 32 | params["fundMoveDetail"] = self.fund_move_detail.to_ams_dict() 33 | return params 34 | 35 | def parse_rsp_body(self, statement_body): 36 | if type(statement_body) == str: 37 | statement_body = json.loads(statement_body) 38 | 39 | if "fundMoveDetail" in statement_body: 40 | self.__fund_move_detail = FundMoveDetail() 41 | self.__fund_move_detail.parse_rsp_body(statement_body["fundMoveDetail"]) 42 | 43 | if "statementId" in statement_body: 44 | self.__statement_id = statement_body["statementId"] 45 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/risk_order.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class RiskOrder: 7 | def __init__(self): 8 | 9 | self.__order_type = None # type: str 10 | self.__referring_site = None # type: str 11 | 12 | 13 | @property 14 | def order_type(self): 15 | """ 16 | The order type 17 | """ 18 | return self.__order_type 19 | 20 | @order_type.setter 21 | def order_type(self, value): 22 | self.__order_type = value 23 | @property 24 | def referring_site(self): 25 | """ 26 | The webpage where the buyer accessed the merchant. 27 | """ 28 | return self.__referring_site 29 | 30 | @referring_site.setter 31 | def referring_site(self, value): 32 | self.__referring_site = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "order_type") and self.order_type is not None: 40 | params['orderType'] = self.order_type 41 | if hasattr(self, "referring_site") and self.referring_site is not None: 42 | params['referringSite'] = self.referring_site 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'orderType' in response_body: 50 | self.__order_type = response_body['orderType'] 51 | if 'referringSite' in response_body: 52 | self.__referring_site = response_body['referringSite'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/risk_signal.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class RiskSignal: 7 | def __init__(self): 8 | 9 | self.__risk_code = None # type: str 10 | self.__risk_reason = None # type: str 11 | 12 | 13 | @property 14 | def risk_code(self): 15 | """ 16 | The tag assigned by a merchant to a risky transaction. 17 | """ 18 | return self.__risk_code 19 | 20 | @risk_code.setter 21 | def risk_code(self, value): 22 | self.__risk_code = value 23 | @property 24 | def risk_reason(self): 25 | """ 26 | The reason why a transaction is identified as risky provided by a merchant. 27 | """ 28 | return self.__risk_reason 29 | 30 | @risk_reason.setter 31 | def risk_reason(self, value): 32 | self.__risk_reason = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "risk_code") and self.risk_code is not None: 40 | params['riskCode'] = self.risk_code 41 | if hasattr(self, "risk_reason") and self.risk_reason is not None: 42 | params['riskReason'] = self.risk_reason 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'riskCode' in response_body: 50 | self.__risk_code = response_body['riskCode'] 51 | if 'riskReason' in response_body: 52 | self.__risk_reason = response_body['riskReason'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/currency_pair.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class CurrencyPair: 7 | def __init__(self): 8 | 9 | self.__sell_currency = None # type: str 10 | self.__buy_currency = None # type: str 11 | 12 | 13 | @property 14 | def sell_currency(self): 15 | """Gets the sell_currency of this CurrencyPair. 16 | 17 | """ 18 | return self.__sell_currency 19 | 20 | @sell_currency.setter 21 | def sell_currency(self, value): 22 | self.__sell_currency = value 23 | @property 24 | def buy_currency(self): 25 | """Gets the buy_currency of this CurrencyPair. 26 | 27 | """ 28 | return self.__buy_currency 29 | 30 | @buy_currency.setter 31 | def buy_currency(self, value): 32 | self.__buy_currency = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "sell_currency") and self.sell_currency is not None: 40 | params['sellCurrency'] = self.sell_currency 41 | if hasattr(self, "buy_currency") and self.buy_currency is not None: 42 | params['buyCurrency'] = self.buy_currency 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'sellCurrency' in response_body: 50 | self.__sell_currency = response_body['sellCurrency'] 51 | if 'buyCurrency' in response_body: 52 | self.__buy_currency = response_body['buyCurrency'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/logo.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class Logo: 7 | def __init__(self): 8 | 9 | self.__logo_name = None # type: str 10 | self.__logo_url = None # type: str 11 | 12 | 13 | @property 14 | def logo_name(self): 15 | """ 16 | The logo name of the card brand. See the Card brands to check the valid values. More information: Maximum length: 12 characters 17 | """ 18 | return self.__logo_name 19 | 20 | @logo_name.setter 21 | def logo_name(self, value): 22 | self.__logo_name = value 23 | @property 24 | def logo_url(self): 25 | """ 26 | The logo URL of the card brand. More information: Maximum length: 2048 characters 27 | """ 28 | return self.__logo_url 29 | 30 | @logo_url.setter 31 | def logo_url(self, value): 32 | self.__logo_url = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "logo_name") and self.logo_name is not None: 40 | params['logoName'] = self.logo_name 41 | if hasattr(self, "logo_url") and self.logo_url is not None: 42 | params['logoUrl'] = self.logo_url 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'logoName' in response_body: 50 | self.__logo_name = response_body['logoName'] 51 | if 'logoUrl' in response_body: 52 | self.__logo_url = response_body['logoUrl'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/service.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class Service: 7 | def __init__(self): 8 | 9 | self.__category_code = None # type: str 10 | self.__sub_category_code = None # type: str 11 | 12 | 13 | @property 14 | def category_code(self): 15 | """ 16 | Category code for the service 17 | """ 18 | return self.__category_code 19 | 20 | @category_code.setter 21 | def category_code(self, value): 22 | self.__category_code = value 23 | @property 24 | def sub_category_code(self): 25 | """ 26 | Sub-category code for the service 27 | """ 28 | return self.__sub_category_code 29 | 30 | @sub_category_code.setter 31 | def sub_category_code(self, value): 32 | self.__sub_category_code = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "category_code") and self.category_code is not None: 40 | params['categoryCode'] = self.category_code 41 | if hasattr(self, "sub_category_code") and self.sub_category_code is not None: 42 | params['subCategoryCode'] = self.sub_category_code 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'categoryCode' in response_body: 50 | self.__category_code = response_body['categoryCode'] 51 | if 'subCategoryCode' in response_body: 52 | self.__sub_category_code = response_body['subCategoryCode'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/paymentOptionDetail.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.model.funding_type import FundingType 2 | from com.alipay.ams.api.model.support_bank import SupportBank 3 | from com.alipay.ams.api.model.support_card_brand import SupportCardBrand 4 | 5 | 6 | class PaymentOptionDetail(object): 7 | 8 | def __init__(self): 9 | self.__support_card_brands = None # type:list[SupportCardBrand] 10 | self.__funding = None # type:list[FundingType] 11 | self.__support_banks = None # type:list[SupportBank] 12 | 13 | @property 14 | def support_card_brands(self): 15 | return self.__support_card_brands 16 | 17 | @support_card_brands.setter 18 | def support_card_brands(self, value): 19 | self.__support_card_brands = value 20 | 21 | @property 22 | def funding(self): 23 | return self.__funding 24 | 25 | @funding.setter 26 | def funding(self, value): 27 | self.__funding = value 28 | 29 | @property 30 | def support_banks(self): 31 | return self.__support_banks 32 | 33 | @support_banks.setter 34 | def support_banks(self, value): 35 | self.__support_banks = value 36 | 37 | def parse_rsp_body(self, payment_option_detail_body): 38 | if payment_option_detail_body.has_key("supportCardBrands"): 39 | self.support_card_brands = payment_option_detail_body["supportCardBrands"] 40 | if payment_option_detail_body.has_key("funding"): 41 | self.funding = payment_option_detail_body["funding"] 42 | if payment_option_detail_body.has_key("supportBanks "): 43 | self.support_banks = payment_option_detail_body["supportBanks"] 44 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/card_brand.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class CardBrand(Enum): 4 | """CardBrand枚举类""" 5 | 6 | VISA = "VISA" 7 | MASTERCARD = "MASTERCARD" 8 | MAESTRO = "MAESTRO" 9 | AMEX = "AMEX" 10 | JCB = "JCB" 11 | DINERS = "DINERS" 12 | DISCOVER = "DISCOVER" 13 | CUP = "CUP" 14 | MIR = "MIR" 15 | ELO = "ELO" 16 | HIPERCARD = "HIPERCARD" 17 | TROY = "TROY" 18 | 19 | def to_ams_dict(self) -> str: 20 | return self.name 21 | 22 | @staticmethod 23 | def value_of(value): 24 | if not value: 25 | return None 26 | 27 | if CardBrand.VISA.value == value: 28 | return CardBrand.VISA 29 | if CardBrand.MASTERCARD.value == value: 30 | return CardBrand.MASTERCARD 31 | if CardBrand.MAESTRO.value == value: 32 | return CardBrand.MAESTRO 33 | if CardBrand.AMEX.value == value: 34 | return CardBrand.AMEX 35 | if CardBrand.JCB.value == value: 36 | return CardBrand.JCB 37 | if CardBrand.DINERS.value == value: 38 | return CardBrand.DINERS 39 | if CardBrand.DISCOVER.value == value: 40 | return CardBrand.DISCOVER 41 | if CardBrand.CUP.value == value: 42 | return CardBrand.CUP 43 | if CardBrand.MIR.value == value: 44 | return CardBrand.MIR 45 | if CardBrand.ELO.value == value: 46 | return CardBrand.ELO 47 | if CardBrand.HIPERCARD.value == value: 48 | return CardBrand.HIPERCARD 49 | if CardBrand.TROY.value == value: 50 | return CardBrand.TROY 51 | return None 52 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/fund_move_detail.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class FundMoveDetail: 7 | def __init__(self): 8 | 9 | self.__memo = None # type: str 10 | self.__reference_transaction_id = None # type: str 11 | 12 | 13 | @property 14 | def memo(self): 15 | """Gets the memo of this FundMoveDetail. 16 | 17 | """ 18 | return self.__memo 19 | 20 | @memo.setter 21 | def memo(self, value): 22 | self.__memo = value 23 | @property 24 | def reference_transaction_id(self): 25 | """Gets the reference_transaction_id of this FundMoveDetail. 26 | 27 | """ 28 | return self.__reference_transaction_id 29 | 30 | @reference_transaction_id.setter 31 | def reference_transaction_id(self, value): 32 | self.__reference_transaction_id = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "memo") and self.memo is not None: 40 | params['memo'] = self.memo 41 | if hasattr(self, "reference_transaction_id") and self.reference_transaction_id is not None: 42 | params['referenceTransactionId'] = self.reference_transaction_id 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'memo' in response_body: 50 | self.__memo = response_body['memo'] 51 | if 'referenceTransactionId' in response_body: 52 | self.__reference_transaction_id = response_body['referenceTransactionId'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/support_card_brand.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.logo import Logo 3 | 4 | 5 | 6 | 7 | class SupportCardBrand: 8 | def __init__(self): 9 | 10 | self.__card_brand = None # type: str 11 | self.__logo = None # type: Logo 12 | 13 | 14 | @property 15 | def card_brand(self): 16 | """ 17 | 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. 18 | """ 19 | return self.__card_brand 20 | 21 | @card_brand.setter 22 | def card_brand(self, value): 23 | self.__card_brand = value 24 | @property 25 | def logo(self): 26 | """Gets the logo of this SupportCardBrand. 27 | 28 | """ 29 | return self.__logo 30 | 31 | @logo.setter 32 | def logo(self, value): 33 | self.__logo = value 34 | 35 | 36 | 37 | 38 | def to_ams_dict(self): 39 | params = dict() 40 | if hasattr(self, "card_brand") and self.card_brand is not None: 41 | params['cardBrand'] = self.card_brand 42 | if hasattr(self, "logo") and self.logo is not None: 43 | params['logo'] = self.logo 44 | return params 45 | 46 | 47 | def parse_rsp_body(self, response_body): 48 | if isinstance(response_body, str): 49 | response_body = json.loads(response_body) 50 | if 'cardBrand' in response_body: 51 | self.__card_brand = response_body['cardBrand'] 52 | if 'logo' in response_body: 53 | self.__logo = Logo() 54 | self.__logo.parse_rsp_body(response_body['logo']) 55 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/passenger_id_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class PassengerIdType(Enum): 4 | """Type of passenger identification""" 5 | 6 | PASSPORT = "PASSPORT" 7 | NATIONAL_ID_CARD = "NATIONAL_ID_CARD" 8 | DRIVER_LICENSE = "DRIVER_LICENSE" 9 | MILITARY_ID = "MILITARY_ID" 10 | GREEN_CARD = "GREEN_CARD" 11 | TRAVEL_DOCUMENT = "TRAVEL_DOCUMENT" 12 | ALIEN_REGISTRATION_CARD = "ALIEN_REGISTRATION_CARD" 13 | BIRTH_CERTIFICATE = "BIRTH_CERTIFICATE" 14 | OTHERS = "OTHERS" 15 | 16 | def to_ams_dict(self) -> str: 17 | return self.name 18 | 19 | @staticmethod 20 | def value_of(value): 21 | if not value: 22 | return None 23 | 24 | if PassengerIdType.PASSPORT.value == value: 25 | return PassengerIdType.PASSPORT 26 | if PassengerIdType.NATIONAL_ID_CARD.value == value: 27 | return PassengerIdType.NATIONAL_ID_CARD 28 | if PassengerIdType.DRIVER_LICENSE.value == value: 29 | return PassengerIdType.DRIVER_LICENSE 30 | if PassengerIdType.MILITARY_ID.value == value: 31 | return PassengerIdType.MILITARY_ID 32 | if PassengerIdType.GREEN_CARD.value == value: 33 | return PassengerIdType.GREEN_CARD 34 | if PassengerIdType.TRAVEL_DOCUMENT.value == value: 35 | return PassengerIdType.TRAVEL_DOCUMENT 36 | if PassengerIdType.ALIEN_REGISTRATION_CARD.value == value: 37 | return PassengerIdType.ALIEN_REGISTRATION_CARD 38 | if PassengerIdType.BIRTH_CERTIFICATE.value == value: 39 | return PassengerIdType.BIRTH_CERTIFICATE 40 | if PassengerIdType.OTHERS.value == value: 41 | return PassengerIdType.OTHERS 42 | return None 43 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/merchant/alipay_merchant_registration_status_query_request.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants 4 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 5 | 6 | 7 | class AlipayMerchantRegistrationStatusQueryRequest(AlipayRequest): 8 | 9 | def __init__(self): 10 | super(AlipayMerchantRegistrationStatusQueryRequest, self).__init__( 11 | AntomPathConstants.MERCHANTS_INQUIRY_REGISTRATION_STATUS_PATH 12 | ) 13 | self.__registration_request_id = None 14 | self.__reference_merchant_id = None 15 | 16 | @property 17 | def registration_request_id(self): 18 | return self.__registration_request_id 19 | 20 | @registration_request_id.setter 21 | def registration_request_id(self, value): 22 | self.__registration_request_id = value 23 | 24 | @property 25 | def reference_merchant_id(self): 26 | return self.__reference_merchant_id 27 | 28 | @reference_merchant_id.setter 29 | def reference_merchant_id(self, value): 30 | self.__reference_merchant_id = value 31 | 32 | def to_ams_json(self): 33 | json_str = json.dumps( 34 | obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3 35 | ) 36 | return json_str 37 | 38 | def __to_ams_dict(self): 39 | params = dict() 40 | if hasattr(self, "registration_request_id") and self.registration_request_id: 41 | params["registrationRequestId"] = self.registration_request_id 42 | 43 | if hasattr(self, "reference_merchant_id") and self.reference_merchant_id: 44 | params["referenceMerchantId"] = self.reference_merchant_id 45 | 46 | return params 47 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/statement.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.fund_move_detail import FundMoveDetail 3 | 4 | 5 | 6 | 7 | class Statement: 8 | def __init__(self): 9 | 10 | self.__statement_id = None # type: str 11 | self.__fund_move_detail = None # type: FundMoveDetail 12 | 13 | 14 | @property 15 | def statement_id(self): 16 | """Gets the statement_id of this Statement. 17 | 18 | """ 19 | return self.__statement_id 20 | 21 | @statement_id.setter 22 | def statement_id(self, value): 23 | self.__statement_id = value 24 | @property 25 | def fund_move_detail(self): 26 | """Gets the fund_move_detail of this Statement. 27 | 28 | """ 29 | return self.__fund_move_detail 30 | 31 | @fund_move_detail.setter 32 | def fund_move_detail(self, value): 33 | self.__fund_move_detail = value 34 | 35 | 36 | 37 | 38 | def to_ams_dict(self): 39 | params = dict() 40 | if hasattr(self, "statement_id") and self.statement_id is not None: 41 | params['statementId'] = self.statement_id 42 | if hasattr(self, "fund_move_detail") and self.fund_move_detail is not None: 43 | params['fundMoveDetail'] = self.fund_move_detail 44 | return params 45 | 46 | 47 | def parse_rsp_body(self, response_body): 48 | if isinstance(response_body, str): 49 | response_body = json.loads(response_body) 50 | if 'statementId' in response_body: 51 | self.__statement_id = response_body['statementId'] 52 | if 'fundMoveDetail' in response_body: 53 | self.__fund_move_detail = FundMoveDetail() 54 | self.__fund_move_detail.parse_rsp_body(response_body['fundMoveDetail']) 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | 106 | .iml 107 | .idea 108 | 109 | *.pem 110 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/payment_verification_data.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class PaymentVerificationData: 7 | def __init__(self): 8 | 9 | self.__verify_request_id = None # type: str 10 | self.__authentication_code = None # type: str 11 | 12 | 13 | @property 14 | def verify_request_id(self): 15 | """Gets the verify_request_id of this PaymentVerificationData. 16 | 17 | """ 18 | return self.__verify_request_id 19 | 20 | @verify_request_id.setter 21 | def verify_request_id(self, value): 22 | self.__verify_request_id = value 23 | @property 24 | def authentication_code(self): 25 | """Gets the authentication_code of this PaymentVerificationData. 26 | 27 | """ 28 | return self.__authentication_code 29 | 30 | @authentication_code.setter 31 | def authentication_code(self, value): 32 | self.__authentication_code = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "verify_request_id") and self.verify_request_id is not None: 40 | params['verifyRequestId'] = self.verify_request_id 41 | if hasattr(self, "authentication_code") and self.authentication_code is not None: 42 | params['authenticationCode'] = self.authentication_code 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'verifyRequestId' in response_body: 50 | self.__verify_request_id = response_body['verifyRequestId'] 51 | if 'authenticationCode' in response_body: 52 | self.__authentication_code = response_body['authenticationCode'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/stock_info.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class StockInfo: 7 | def __init__(self): 8 | 9 | self.__listed_region = None # type: str 10 | self.__ticker_symbol = None # type: str 11 | 12 | 13 | @property 14 | def listed_region(self): 15 | """ 16 | The region or country where the company is listed. More information: Maximum length: 2 characters 17 | """ 18 | return self.__listed_region 19 | 20 | @listed_region.setter 21 | def listed_region(self, value): 22 | self.__listed_region = value 23 | @property 24 | def ticker_symbol(self): 25 | """ 26 | 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 27 | """ 28 | return self.__ticker_symbol 29 | 30 | @ticker_symbol.setter 31 | def ticker_symbol(self, value): 32 | self.__ticker_symbol = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "listed_region") and self.listed_region is not None: 40 | params['listedRegion'] = self.listed_region 41 | if hasattr(self, "ticker_symbol") and self.ticker_symbol is not None: 42 | params['tickerSymbol'] = self.ticker_symbol 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'listedRegion' in response_body: 50 | self.__listed_region = response_body['listedRegion'] 51 | if 'tickerSymbol' in response_body: 52 | self.__ticker_symbol = response_body['tickerSymbol'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/marketplace/alipay_inquire_balance_request.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 6 | 7 | class AlipayInquireBalanceRequest(AlipayRequest): 8 | def __init__(self): 9 | super(AlipayInquireBalanceRequest, self).__init__("/ams/api/v1/accounts/inquireBalance") 10 | 11 | self.__reference_merchant_id = None # type: str 12 | 13 | 14 | @property 15 | def reference_merchant_id(self): 16 | """ 17 | 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 18 | """ 19 | return self.__reference_merchant_id 20 | 21 | @reference_merchant_id.setter 22 | def reference_merchant_id(self, value): 23 | self.__reference_merchant_id = value 24 | 25 | 26 | def to_ams_json(self): 27 | json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) 28 | return json_str 29 | 30 | 31 | def to_ams_dict(self): 32 | params = dict() 33 | if hasattr(self, "reference_merchant_id") and self.reference_merchant_id is not None: 34 | params['referenceMerchantId'] = self.reference_merchant_id 35 | return params 36 | 37 | 38 | def parse_rsp_body(self, response_body): 39 | if isinstance(response_body, str): 40 | response_body = json.loads(response_body) 41 | if 'referenceMerchantId' in response_body: 42 | self.__reference_merchant_id = response_body['referenceMerchantId'] 43 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from setuptools import setup, find_packages 4 | 5 | """ 6 | setup module for core. 7 | Created on 5/20/2020 8 | @author: songlin.xiesl、guangling.zgl 9 | """ 10 | NAME = "global-open-sdk-python" 11 | DESCRIPTION = "The global alipay gateway SDK for Python." 12 | AUTHOR = "guodong.wzj" 13 | AUTHOR_EMAIL = "wangzunjiao.wzj@digital-engine.com" 14 | URL = "https://github.com/alipay/global-open-sdk-python" 15 | VERSION = "1.4.22" 16 | """ 17 | only python2 need enum34、pytz 18 | """ 19 | requires = ["enum34", "pytz", "pycryptodome", "rsa", "cryptography"] 20 | 21 | setup( 22 | name=NAME, 23 | version=VERSION, 24 | description=DESCRIPTION, 25 | author=AUTHOR, 26 | author_email=AUTHOR_EMAIL, 27 | license="MIT", 28 | url=URL, 29 | keywords=["global", "alipay", "sdk"], 30 | packages=find_packages(exclude=["example"]), 31 | include_package_data=True, 32 | platforms="any", 33 | install_requires=requires, 34 | classifiers=[ 35 | "Intended Audience :: Developers", 36 | "License :: OSI Approved :: MIT License", 37 | "Programming Language :: Python", 38 | "Programming Language :: Python :: 2.7", 39 | "Programming Language :: Python :: 3.2", 40 | "Programming Language :: Python :: 3.3", 41 | "Programming Language :: Python :: 3.4", 42 | "Programming Language :: Python :: 3.5", 43 | "Programming Language :: Python :: 3.6", 44 | "Programming Language :: Python :: 3.7", 45 | "Programming Language :: Python :: 3.8", 46 | "Programming Language :: Python :: 3.9", 47 | "Programming Language :: Python :: 3.10", 48 | "Programming Language :: Python :: 3.11", 49 | "Programming Language :: Python :: 3.12", 50 | "Topic :: Software Development", 51 | ], 52 | ) 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/auth_meta_data.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class AuthMetaData: 7 | def __init__(self): 8 | 9 | self.__account_holder_name = None # type: str 10 | self.__account_holder_cert_no = None # type: str 11 | 12 | 13 | @property 14 | def account_holder_name(self): 15 | """Gets the account_holder_name of this AuthMetaData. 16 | 17 | """ 18 | return self.__account_holder_name 19 | 20 | @account_holder_name.setter 21 | def account_holder_name(self, value): 22 | self.__account_holder_name = value 23 | @property 24 | def account_holder_cert_no(self): 25 | """Gets the account_holder_cert_no of this AuthMetaData. 26 | 27 | """ 28 | return self.__account_holder_cert_no 29 | 30 | @account_holder_cert_no.setter 31 | def account_holder_cert_no(self, value): 32 | self.__account_holder_cert_no = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "account_holder_name") and self.account_holder_name is not None: 40 | params['accountHolderName'] = self.account_holder_name 41 | if hasattr(self, "account_holder_cert_no") and self.account_holder_cert_no is not None: 42 | params['accountHolderCertNo'] = self.account_holder_cert_no 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'accountHolderName' in response_body: 50 | self.__account_holder_name = response_body['accountHolderName'] 51 | if 'accountHolderCertNo' in response_body: 52 | self.__account_holder_cert_no = response_body['accountHolderCertNo'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/delivery_estimate.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.delivery_estimate_info import DeliveryEstimateInfo 3 | from com.alipay.ams.api.model.delivery_estimate_info import DeliveryEstimateInfo 4 | 5 | 6 | 7 | 8 | class DeliveryEstimate: 9 | def __init__(self): 10 | 11 | self.__minimum = None # type: DeliveryEstimateInfo 12 | self.__maximum = None # type: DeliveryEstimateInfo 13 | 14 | 15 | @property 16 | def minimum(self): 17 | """Gets the minimum of this DeliveryEstimate. 18 | 19 | """ 20 | return self.__minimum 21 | 22 | @minimum.setter 23 | def minimum(self, value): 24 | self.__minimum = value 25 | @property 26 | def maximum(self): 27 | """Gets the maximum of this DeliveryEstimate. 28 | 29 | """ 30 | return self.__maximum 31 | 32 | @maximum.setter 33 | def maximum(self, value): 34 | self.__maximum = value 35 | 36 | 37 | 38 | 39 | def to_ams_dict(self): 40 | params = dict() 41 | if hasattr(self, "minimum") and self.minimum is not None: 42 | params['minimum'] = self.minimum 43 | if hasattr(self, "maximum") and self.maximum is not None: 44 | params['maximum'] = self.maximum 45 | return params 46 | 47 | 48 | def parse_rsp_body(self, response_body): 49 | if isinstance(response_body, str): 50 | response_body = json.loads(response_body) 51 | if 'minimum' in response_body: 52 | self.__minimum = DeliveryEstimateInfo() 53 | self.__minimum.parse_rsp_body(response_body['minimum']) 54 | if 'maximum' in response_body: 55 | self.__maximum = DeliveryEstimateInfo() 56 | self.__maximum.parse_rsp_body(response_body['maximum']) 57 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/pay/alipay_vaults_fetch_nonce_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.result import Result 3 | 4 | 5 | 6 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 7 | 8 | class AlipayVaultsFetchNonceResponse(AlipayResponse): 9 | def __init__(self, rsp_body): 10 | super(AlipayResponse, self).__init__() 11 | 12 | self.__card_token = None # type: str 13 | self.__result = None # type: Result 14 | self.parse_rsp_body(rsp_body) 15 | 16 | 17 | @property 18 | def card_token(self): 19 | """Gets the card_token of this AlipayVaultsFetchNonceResponse. 20 | 21 | """ 22 | return self.__card_token 23 | 24 | @card_token.setter 25 | def card_token(self, value): 26 | self.__card_token = value 27 | @property 28 | def result(self): 29 | """Gets the result of this AlipayVaultsFetchNonceResponse. 30 | 31 | """ 32 | return self.__result 33 | 34 | @result.setter 35 | def result(self, value): 36 | self.__result = value 37 | 38 | 39 | 40 | 41 | def to_ams_dict(self): 42 | params = dict() 43 | if hasattr(self, "card_token") and self.card_token is not None: 44 | params['cardToken'] = self.card_token 45 | if hasattr(self, "result") and self.result is not None: 46 | params['result'] = self.result 47 | return params 48 | 49 | 50 | def parse_rsp_body(self, response_body): 51 | response_body = super(AlipayVaultsFetchNonceResponse, self).parse_rsp_body(response_body) 52 | if 'cardToken' in response_body: 53 | self.__card_token = response_body['cardToken'] 54 | if 'result' in response_body: 55 | self.__result = Result() 56 | self.__result.parse_rsp_body(response_body['result']) 57 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/promotion_result.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.promotion_type import PromotionType 3 | from com.alipay.ams.api.model.discount import Discount 4 | 5 | 6 | 7 | 8 | class PromotionResult: 9 | def __init__(self): 10 | 11 | self.__promotion_type = None # type: PromotionType 12 | self.__discount = None # type: Discount 13 | 14 | 15 | @property 16 | def promotion_type(self): 17 | """Gets the promotion_type of this PromotionResult. 18 | 19 | """ 20 | return self.__promotion_type 21 | 22 | @promotion_type.setter 23 | def promotion_type(self, value): 24 | self.__promotion_type = value 25 | @property 26 | def discount(self): 27 | """Gets the discount of this PromotionResult. 28 | 29 | """ 30 | return self.__discount 31 | 32 | @discount.setter 33 | def discount(self, value): 34 | self.__discount = value 35 | 36 | 37 | 38 | 39 | def to_ams_dict(self): 40 | params = dict() 41 | if hasattr(self, "promotion_type") and self.promotion_type is not None: 42 | params['promotionType'] = self.promotion_type 43 | if hasattr(self, "discount") and self.discount is not None: 44 | params['discount'] = self.discount 45 | return params 46 | 47 | 48 | def parse_rsp_body(self, response_body): 49 | if isinstance(response_body, str): 50 | response_body = json.loads(response_body) 51 | if 'promotionType' in response_body: 52 | promotion_type_temp = PromotionType.value_of(response_body['promotionType']) 53 | self.__promotion_type = promotion_type_temp 54 | if 'discount' in response_body: 55 | self.__discount = Discount() 56 | self.__discount.parse_rsp_body(response_body['discount']) 57 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/auth/alipay_auth_revoke_token_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.result import Result 3 | 4 | 5 | 6 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 7 | 8 | class AlipayAuthRevokeTokenResponse(AlipayResponse): 9 | def __init__(self, rsp_body): 10 | super(AlipayResponse, self).__init__() 11 | 12 | self.__result = None # type: Result 13 | self.__extend_info = None # type: str 14 | self.parse_rsp_body(rsp_body) 15 | 16 | 17 | @property 18 | def result(self): 19 | """Gets the result of this AlipayAuthRevokeTokenResponse. 20 | 21 | """ 22 | return self.__result 23 | 24 | @result.setter 25 | def result(self, value): 26 | self.__result = value 27 | @property 28 | def extend_info(self): 29 | """Gets the extend_info of this AlipayAuthRevokeTokenResponse. 30 | 31 | """ 32 | return self.__extend_info 33 | 34 | @extend_info.setter 35 | def extend_info(self, value): 36 | self.__extend_info = value 37 | 38 | 39 | 40 | 41 | def to_ams_dict(self): 42 | params = dict() 43 | if hasattr(self, "result") and self.result is not None: 44 | params['result'] = self.result 45 | if hasattr(self, "extend_info") and self.extend_info is not None: 46 | params['extendInfo'] = self.extend_info 47 | return params 48 | 49 | 50 | def parse_rsp_body(self, response_body): 51 | response_body = super(AlipayAuthRevokeTokenResponse, self).parse_rsp_body(response_body) 52 | if 'result' in response_body: 53 | self.__result = Result() 54 | self.__result.parse_rsp_body(response_body['result']) 55 | if 'extendInfo' in response_body: 56 | self.__extend_info = response_body['extendInfo'] 57 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/refund_detail.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.amount import Amount 3 | from com.alipay.ams.api.model.refund_from_type import RefundFromType 4 | 5 | 6 | 7 | 8 | class RefundDetail: 9 | def __init__(self): 10 | 11 | self.__refund_amount = None # type: Amount 12 | self.__refund_from = None # type: RefundFromType 13 | 14 | 15 | @property 16 | def refund_amount(self): 17 | """Gets the refund_amount of this RefundDetail. 18 | 19 | """ 20 | return self.__refund_amount 21 | 22 | @refund_amount.setter 23 | def refund_amount(self, value): 24 | self.__refund_amount = value 25 | @property 26 | def refund_from(self): 27 | """Gets the refund_from of this RefundDetail. 28 | 29 | """ 30 | return self.__refund_from 31 | 32 | @refund_from.setter 33 | def refund_from(self, value): 34 | self.__refund_from = value 35 | 36 | 37 | 38 | 39 | def to_ams_dict(self): 40 | params = dict() 41 | if hasattr(self, "refund_amount") and self.refund_amount is not None: 42 | params['refundAmount'] = self.refund_amount 43 | if hasattr(self, "refund_from") and self.refund_from is not None: 44 | params['refundFrom'] = self.refund_from 45 | return params 46 | 47 | 48 | def parse_rsp_body(self, response_body): 49 | if isinstance(response_body, str): 50 | response_body = json.loads(response_body) 51 | if 'refundAmount' in response_body: 52 | self.__refund_amount = Amount() 53 | self.__refund_amount.parse_rsp_body(response_body['refundAmount']) 54 | if 'refundFrom' in response_body: 55 | refund_from_temp = RefundFromType.value_of(response_body['refundFrom']) 56 | self.__refund_from = refund_from_temp 57 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/notify/alipay_subscription_pay_notify.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.request.notify.alipay_notify import AlipayNotify 2 | from com.alipay.ams.api.request.notify.alipay_pay_result_notify import ( 3 | AlipayPayResultNotify, 4 | ) 5 | 6 | 7 | class AlipaySubscriptionPayNotify(AlipayPayResultNotify): 8 | 9 | def __init__(self, notify_body): 10 | super(AlipaySubscriptionPayNotify, self).__init__(notify_body) 11 | self.__subscription_request_id = None 12 | self.__subscription_id = None 13 | self.__period_start_time = None 14 | self.__period_end_time = None 15 | self.__phase_no = None 16 | self.__parse_notify_body(notify_body) 17 | 18 | @property 19 | def subscription_request_id(self): 20 | return self.__subscription_request_id 21 | 22 | @property 23 | def subscription_id(self): 24 | return self.__subscription_id 25 | 26 | @property 27 | def period_start_time(self): 28 | return self.__period_start_time 29 | 30 | @property 31 | def period_end_time(self): 32 | return self.__period_end_time 33 | 34 | @property 35 | def phase_no(self): 36 | return self.__phase_no 37 | 38 | def __parse_notify_body(self, notify_body): 39 | notify = super(AlipaySubscriptionPayNotify, self).parse_notify_body(notify_body) 40 | if "subscriptionRequestId" in notify: 41 | self.__subscription_request_id = notify["subscriptionRequestId"] 42 | if "subscriptionId" in notify: 43 | self.__subscription_id = notify["subscriptionId"] 44 | if "periodStartTime" in notify: 45 | self.__period_start_time = notify["periodStartTime"] 46 | if "periodEndTime" in notify: 47 | self.__period_end_time = notify["periodEndTime"] 48 | if "phaseNo" in notify: 49 | self.__phase_no = notify["phaseNo"] 50 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/ancillary_data.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.service import Service 3 | 4 | 5 | 6 | 7 | class AncillaryData: 8 | def __init__(self): 9 | 10 | self.__services = None # type: [Service] 11 | self.__connected_ticket_number = None # type: str 12 | 13 | 14 | @property 15 | def services(self): 16 | """ 17 | List of services for ancillary data 18 | """ 19 | return self.__services 20 | 21 | @services.setter 22 | def services(self, value): 23 | self.__services = value 24 | @property 25 | def connected_ticket_number(self): 26 | """ 27 | Connected ticket number 28 | """ 29 | return self.__connected_ticket_number 30 | 31 | @connected_ticket_number.setter 32 | def connected_ticket_number(self, value): 33 | self.__connected_ticket_number = value 34 | 35 | 36 | 37 | 38 | def to_ams_dict(self): 39 | params = dict() 40 | if hasattr(self, "services") and self.services is not None: 41 | params['services'] = self.services 42 | if hasattr(self, "connected_ticket_number") and self.connected_ticket_number is not None: 43 | params['connectedTicketNumber'] = self.connected_ticket_number 44 | return params 45 | 46 | 47 | def parse_rsp_body(self, response_body): 48 | if isinstance(response_body, str): 49 | response_body = json.loads(response_body) 50 | if 'services' in response_body: 51 | self.__services = [] 52 | for item in response_body['services']: 53 | obj = Service() 54 | obj.parse_rsp_body(item) 55 | self.__services.append(obj) 56 | if 'connectedTicketNumber' in response_body: 57 | self.__connected_ticket_number = response_body['connectedTicketNumber'] 58 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/auth/alipay_auth_query_token_response.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 5 | 6 | 7 | class AlipayAuthQueryTokenResponse(AlipayResponse): 8 | 9 | def __init__(self, rsp_body): 10 | super(AlipayAuthQueryTokenResponse, self).__init__() 11 | self.__access_token = None 12 | self.__access_token_expiry_time = None 13 | self.__refresh_token = None 14 | self.__refresh_token_expiry_time = None 15 | self.__token_status_type = None 16 | self.__parse_rsp_body(rsp_body) 17 | 18 | @property 19 | def access_token(self): 20 | return self.__access_token 21 | 22 | @property 23 | def access_token_expiry_time(self): 24 | return self.__access_token_expiry_time 25 | 26 | @property 27 | def refresh_token(self): 28 | return self.__refresh_token 29 | 30 | @property 31 | def refresh_token_expiry_time(self): 32 | return self.__refresh_token_expiry_time 33 | 34 | @property 35 | def token_status_type(self): 36 | return self.__token_status_type 37 | 38 | def __parse_rsp_body(self, rsp_body): 39 | response = super(AlipayAuthQueryTokenResponse, self).parse_rsp_body(rsp_body) 40 | if "accessToken" in response: 41 | self.__access_token = response["accessToken"] 42 | if "accessTokenExpiryTime" in response: 43 | self.__access_token_expiry_time = response["accessTokenExpiryTime"] 44 | if "refreshToken" in response: 45 | self.__refresh_token = response["refreshToken"] 46 | if "refreshTokenExpiryTime" in response: 47 | self.__refresh_token_expiry_time = response["refreshTokenExpiryTime"] 48 | if "tokenStatusType" in response: 49 | self.__token_status_type = response["tokenStatusType"] 50 | -------------------------------------------------------------------------------- /com/alipay/ams/api/net/default_http_rpc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import ssl 5 | 6 | """ 7 | python2中是httplib,python3中是http.client 8 | """ 9 | try: 10 | import http.client as http_client 11 | except ImportError: 12 | import httplib as http_client 13 | 14 | """ 15 | python2中是urlparse,python3中是urllib.parse 16 | """ 17 | try: 18 | import urllib.parse as url_parse 19 | except ImportError: 20 | import urlparse as url_parse 21 | 22 | from com.alipay.ams.api.tools.constants import * 23 | from com.alipay.ams.api.exception.exception import AlipayApiException 24 | 25 | 26 | def __get_http_connection(url, timeout=DEFAULT_TIMEOUT): 27 | url_parse_result = url_parse.urlparse(url) 28 | host_name = url_parse_result.hostname 29 | port = 443 30 | context = ssl._create_unverified_context() 31 | connection = http_client.HTTPSConnection( 32 | host=host_name, port=port, timeout=timeout, context=context 33 | ) 34 | return connection 35 | 36 | 37 | def do_post(url, headers=None, req_body=None, charset=DEFAULT_CHARSET): 38 | connection = __get_http_connection(url) 39 | try: 40 | connection.connect() 41 | except Exception as e: 42 | raise AlipayApiException("connect failed. " + str(e)) 43 | 44 | try: 45 | connection.request("POST", url, body=req_body.encode(charset), headers=headers) 46 | except Exception as e: 47 | raise AlipayApiException("request failed. " + str(e)) 48 | 49 | response = connection.getresponse() 50 | if response.status != 200: 51 | raise AlipayApiException("invalid http status " + str(response.status)) 52 | headers = response.getheaders() 53 | result = response.read() 54 | try: 55 | response.close() 56 | connection.close() 57 | except Exception as e: 58 | raise AlipayApiException("close failed. " + str(e)) 59 | 60 | return headers, result 61 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/settlement_detail.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.settle_to_type import SettleToType 3 | from com.alipay.ams.api.model.amount import Amount 4 | 5 | 6 | 7 | 8 | class SettlementDetail: 9 | def __init__(self): 10 | 11 | self.__settle_to = None # type: SettleToType 12 | self.__settlement_amount = None # type: Amount 13 | 14 | 15 | @property 16 | def settle_to(self): 17 | """Gets the settle_to of this SettlementDetail. 18 | 19 | """ 20 | return self.__settle_to 21 | 22 | @settle_to.setter 23 | def settle_to(self, value): 24 | self.__settle_to = value 25 | @property 26 | def settlement_amount(self): 27 | """Gets the settlement_amount of this SettlementDetail. 28 | 29 | """ 30 | return self.__settlement_amount 31 | 32 | @settlement_amount.setter 33 | def settlement_amount(self, value): 34 | self.__settlement_amount = value 35 | 36 | 37 | 38 | 39 | def to_ams_dict(self): 40 | params = dict() 41 | if hasattr(self, "settle_to") and self.settle_to is not None: 42 | params['settleTo'] = self.settle_to 43 | if hasattr(self, "settlement_amount") and self.settlement_amount is not None: 44 | params['settlementAmount'] = self.settlement_amount 45 | return params 46 | 47 | 48 | def parse_rsp_body(self, response_body): 49 | if isinstance(response_body, str): 50 | response_body = json.loads(response_body) 51 | if 'settleTo' in response_body: 52 | settle_to_temp = SettleToType.value_of(response_body['settleTo']) 53 | self.__settle_to = settle_to_temp 54 | if 'settlementAmount' in response_body: 55 | self.__settlement_amount = Amount() 56 | self.__settlement_amount.parse_rsp_body(response_body['settlementAmount']) 57 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/pay/alipay_refund_query_request.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants 4 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 5 | 6 | 7 | class AlipayRefundQueryRequest(AlipayRequest): 8 | 9 | def __init__(self): 10 | super(AlipayRefundQueryRequest, self).__init__( 11 | AntomPathConstants.INQUIRY_REFUND_PATH 12 | ) 13 | self.__refund_request_id = None 14 | self.__refund_id = None 15 | self.__merchant_account_id = None 16 | 17 | @property 18 | def refund_request_id(self): 19 | return self.__refund_request_id 20 | 21 | @refund_request_id.setter 22 | def refund_request_id(self, value): 23 | self.__refund_request_id = value 24 | 25 | @property 26 | def refund_id(self): 27 | return self.__refund_id 28 | 29 | @refund_id.setter 30 | def refund_id(self, value): 31 | self.__refund_id = value 32 | 33 | @property 34 | def merchant_account_id(self): 35 | return self.__merchant_account_id 36 | 37 | @merchant_account_id.setter 38 | def merchant_account_id(self, value): 39 | self.__merchant_account_id = value 40 | 41 | def to_ams_json(self): 42 | json_str = json.dumps( 43 | obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3 44 | ) 45 | return json_str 46 | 47 | def __to_ams_dict(self): 48 | params = dict() 49 | if hasattr(self, "refund_request_id") and self.refund_request_id: 50 | params["refundRequestId"] = self.refund_request_id 51 | if hasattr(self, "refund_id") and self.refund_id: 52 | params["refundId"] = self.refund_id 53 | if hasattr(self, "merchant_account_id") and self.merchant_account_id: 54 | params["merchantAccountId"] = self.merchant_account_id 55 | return params 56 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/company_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | @unique 3 | class CompanyType(Enum): 4 | """CompanyType枚举类""" 5 | 6 | ENTERPRISE = "ENTERPRISE" 7 | PARTNERSHIP = "PARTNERSHIP" 8 | SOLE_PROPRIETORSHIP = "SOLE_PROPRIETORSHIP" 9 | STATE_OWNED_BUSINESS = "STATE_OWNED_BUSINESS" 10 | PRIVATELY_OWNED_BUSINESS = "PRIVATELY_OWNED_BUSINESS" 11 | PUBLICLY_LISTED_BUSINESS = "PUBLICLY_LISTED_BUSINESS" 12 | LTDA = "LTDA" 13 | SA = "SA" 14 | EIRELI = "EIRELI" 15 | BOFC = "BOFC" 16 | MEI = "MEI" 17 | EI = "EI" 18 | 19 | def to_ams_dict(self) -> str: 20 | return self.name 21 | 22 | @staticmethod 23 | def value_of(value): 24 | if not value: 25 | return None 26 | 27 | if CompanyType.ENTERPRISE.value == value: 28 | return CompanyType.ENTERPRISE 29 | if CompanyType.PARTNERSHIP.value == value: 30 | return CompanyType.PARTNERSHIP 31 | if CompanyType.SOLE_PROPRIETORSHIP.value == value: 32 | return CompanyType.SOLE_PROPRIETORSHIP 33 | if CompanyType.STATE_OWNED_BUSINESS.value == value: 34 | return CompanyType.STATE_OWNED_BUSINESS 35 | if CompanyType.PRIVATELY_OWNED_BUSINESS.value == value: 36 | return CompanyType.PRIVATELY_OWNED_BUSINESS 37 | if CompanyType.PUBLICLY_LISTED_BUSINESS.value == value: 38 | return CompanyType.PUBLICLY_LISTED_BUSINESS 39 | if CompanyType.LTDA.value == value: 40 | return CompanyType.LTDA 41 | if CompanyType.SA.value == value: 42 | return CompanyType.SA 43 | if CompanyType.EIRELI.value == value: 44 | return CompanyType.EIRELI 45 | if CompanyType.BOFC.value == value: 46 | return CompanyType.BOFC 47 | if CompanyType.MEI.value == value: 48 | return CompanyType.MEI 49 | if CompanyType.EI.value == value: 50 | return CompanyType.EI 51 | return None 52 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/pay/alipay_inquire_exchange_rate_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.quote import Quote 3 | from com.alipay.ams.api.model.result import Result 4 | 5 | 6 | 7 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 8 | 9 | class AlipayInquireExchangeRateResponse(AlipayResponse): 10 | def __init__(self, rsp_body): 11 | super(AlipayResponse, self).__init__() 12 | 13 | self.__quotes = None # type: [Quote] 14 | self.__result = None # type: Result 15 | self.parse_rsp_body(rsp_body) 16 | 17 | 18 | @property 19 | def quotes(self): 20 | """Gets the quotes of this AlipayInquireExchangeRateResponse. 21 | 22 | """ 23 | return self.__quotes 24 | 25 | @quotes.setter 26 | def quotes(self, value): 27 | self.__quotes = value 28 | @property 29 | def result(self): 30 | """Gets the result of this AlipayInquireExchangeRateResponse. 31 | 32 | """ 33 | return self.__result 34 | 35 | @result.setter 36 | def result(self, value): 37 | self.__result = value 38 | 39 | 40 | 41 | 42 | def to_ams_dict(self): 43 | params = dict() 44 | if hasattr(self, "quotes") and self.quotes is not None: 45 | params['quotes'] = self.quotes 46 | if hasattr(self, "result") and self.result is not None: 47 | params['result'] = self.result 48 | return params 49 | 50 | 51 | def parse_rsp_body(self, response_body): 52 | response_body = super(AlipayInquireExchangeRateResponse, self).parse_rsp_body(response_body) 53 | if 'quotes' in response_body: 54 | self.__quotes = [] 55 | for item in response_body['quotes']: 56 | obj = Quote() 57 | obj.parse_rsp_body(item) 58 | self.__quotes.append(obj) 59 | if 'result' in response_body: 60 | self.__result = Result() 61 | self.__result.parse_rsp_body(response_body['result']) 62 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/vaulting/alipay_vaulting_payment_method_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from com.alipay.ams.api.model.payment_method_detail import PaymentMethodDetail 4 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 5 | 6 | 7 | class AlipayVaultingPaymentMethodResponse(AlipayResponse): 8 | 9 | def __init__(self, rsp_body): 10 | super(AlipayVaultingPaymentMethodResponse, self).__init__() 11 | self.__vaulting_request_id = None 12 | self.__payment_method_detail = None # type: PaymentMethodDetail 13 | self.__normal_url = None 14 | self.__scheme_url = None 15 | self.__applink_url = None 16 | self.__parse_rsp_body(rsp_body) 17 | 18 | @property 19 | def vaulting_request_id(self): 20 | return self.__vaulting_request_id 21 | 22 | @property 23 | def payment_method_detail(self): 24 | return self.__payment_method_detail 25 | 26 | @property 27 | def normal_url(self): 28 | return self.__normal_url 29 | 30 | @property 31 | def scheme_url(self): 32 | return self.__scheme_url 33 | 34 | @property 35 | def applink_url(self): 36 | return self.__applink_url 37 | 38 | def __parse_rsp_body(self, rsp_body): 39 | rsp_dict = super(AlipayVaultingPaymentMethodResponse, self).parse_rsp_body( 40 | rsp_body 41 | ) 42 | if "vaultingRequestId" in rsp_dict: 43 | self.__vaulting_request_id = rsp_dict["vaultingRequestId"] 44 | if "paymentMethodDetail" in rsp_dict: 45 | payment_method_detail = PaymentMethodDetail() 46 | self.__payment_method_detail = payment_method_detail.parse_rsp_body( 47 | rsp_dict["paymentMethodDetail"] 48 | ) 49 | if "normalUrl" in rsp_dict: 50 | self.__normal_url = rsp_dict["normalUrl"] 51 | if "schemeUrl" in rsp_dict: 52 | self.__scheme_url = rsp_dict["schemeUrl"] 53 | if "applinkUrl" in rsp_dict: 54 | self.__applink_url = rsp_dict["applinkUrl"] 55 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/refund_record.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.model.amount import Amount 2 | 3 | 4 | class RefundRecord: 5 | def __init__(self): 6 | self.__reference_order_id = None 7 | self.__reference_goods_id = None 8 | self.__amount = None # type: Amount 9 | self.__refund_reason = None 10 | self.__refund_time = None 11 | 12 | @property 13 | def reference_order_id(self): 14 | return self.__reference_order_id 15 | 16 | @reference_order_id.setter 17 | def reference_order_id(self, value): 18 | self.__reference_order_id = value 19 | 20 | @property 21 | def reference_goods_id(self): 22 | return self.__reference_goods_id 23 | 24 | @reference_goods_id.setter 25 | def reference_goods_id(self, value): 26 | self.__reference_goods_id = value 27 | 28 | @property 29 | def amount(self): 30 | return self.__amount 31 | 32 | @amount.setter 33 | def amount(self, value): 34 | self.__amount = value 35 | 36 | @property 37 | def refund_reason(self): 38 | return self.__refund_reason 39 | 40 | @refund_reason.setter 41 | def refund_reason(self, value): 42 | self.__refund_reason = value 43 | 44 | @property 45 | def refund_time(self): 46 | return self.__refund_time 47 | 48 | @refund_time.setter 49 | def refund_time(self, value): 50 | self.__refund_time = value 51 | 52 | def to_ams_dict(self): 53 | params = dict() 54 | if self.__reference_order_id is not None: 55 | params["referenceOrderId"] = self.__reference_order_id 56 | if self.__reference_goods_id is not None: 57 | params["referenceGoodsId"] = self.__reference_goods_id 58 | if self.__amount is not None: 59 | params["amount"] = self.__amount.to_ams_dict() 60 | if self.__refund_reason is not None: 61 | params["refundReason"] = self.__refund_reason 62 | if self.__refund_time is not None: 63 | params["refundTime"] = self.__refund_time 64 | 65 | return params 66 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/risk_score_result.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import json 5 | 6 | from com.alipay.ams.api.model.risk_score_detail import RiskScoreDetail 7 | from com.alipay.ams.api.model.risk_score_type import RiskScoreType 8 | 9 | 10 | class RiskScoreResult(object): 11 | 12 | def __init__(self): 13 | self.__risk_score_type = None # type: RiskScoreType 14 | self.__risk_score = None 15 | self.__risk_score_details = None # type: list[RiskScoreDetail] 16 | 17 | @property 18 | def risk_score_type(self): 19 | return self.__risk_score_type 20 | 21 | @risk_score_type.setter 22 | def risk_score_type(self, value): 23 | self.__risk_score_type = value 24 | 25 | @property 26 | def risk_score(self): 27 | return self.__risk_score 28 | 29 | @risk_score.setter 30 | def risk_score(self, value): 31 | self.__risk_score = value 32 | 33 | @property 34 | def risk_score_details(self): 35 | return self.__risk_score_details 36 | 37 | @risk_score_details.setter 38 | def risk_score_details(self, value): 39 | self.__risk_score_details = value 40 | 41 | def parse_rsp_body(self, risk_score_result_body): 42 | if type(risk_score_result_body) == str: 43 | risk_score_result_body = json.loads(risk_score_result_body) 44 | 45 | if "riskScoreType" in risk_score_result_body: 46 | risk_score_type = RiskScoreType.value_of( 47 | risk_score_result_body["riskScoreType"] 48 | ) 49 | self.__risk_score_type = risk_score_type 50 | 51 | if "riskScore" in risk_score_result_body: 52 | self.__risk_score = risk_score_result_body["riskScore"] 53 | 54 | if "riskScoreDetails" in risk_score_result_body: 55 | self.__risk_score_details = [] 56 | for entry in risk_score_result_body["riskScoreDetails"]: 57 | risk_score_detail = RiskScoreDetail() 58 | risk_score_detail.parse_rsp_body(entry) 59 | self.__risk_score_details.append(risk_score_detail) 60 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/delivery_estimate_info.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | 6 | class DeliveryEstimateInfo: 7 | def __init__(self): 8 | 9 | self.__unit = None # type: str 10 | self.__value = None # type: int 11 | 12 | 13 | @property 14 | def unit(self): 15 | """ 16 | 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 17 | """ 18 | return self.__unit 19 | 20 | @unit.setter 21 | def unit(self, value): 22 | self.__unit = value 23 | @property 24 | def value(self): 25 | """ 26 | Estimated value for the longest shipping time of logistics services. More information: Value range: [0, +∞) 27 | """ 28 | return self.__value 29 | 30 | @value.setter 31 | def value(self, value): 32 | self.__value = value 33 | 34 | 35 | 36 | 37 | def to_ams_dict(self): 38 | params = dict() 39 | if hasattr(self, "unit") and self.unit is not None: 40 | params['unit'] = self.unit 41 | if hasattr(self, "value") and self.value is not None: 42 | params['value'] = self.value 43 | return params 44 | 45 | 46 | def parse_rsp_body(self, response_body): 47 | if isinstance(response_body, str): 48 | response_body = json.loads(response_body) 49 | if 'unit' in response_body: 50 | self.__unit = response_body['unit'] 51 | if 'value' in response_body: 52 | self.__value = response_body['value'] 53 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/transfer_from_detail.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.payment_method import PaymentMethod 3 | from com.alipay.ams.api.model.amount import Amount 4 | 5 | 6 | 7 | 8 | class TransferFromDetail: 9 | def __init__(self): 10 | 11 | self.__transfer_from_method = None # type: PaymentMethod 12 | self.__transfer_from_amount = None # type: Amount 13 | 14 | 15 | @property 16 | def transfer_from_method(self): 17 | """Gets the transfer_from_method of this TransferFromDetail. 18 | 19 | """ 20 | return self.__transfer_from_method 21 | 22 | @transfer_from_method.setter 23 | def transfer_from_method(self, value): 24 | self.__transfer_from_method = value 25 | @property 26 | def transfer_from_amount(self): 27 | """Gets the transfer_from_amount of this TransferFromDetail. 28 | 29 | """ 30 | return self.__transfer_from_amount 31 | 32 | @transfer_from_amount.setter 33 | def transfer_from_amount(self, value): 34 | self.__transfer_from_amount = value 35 | 36 | 37 | 38 | 39 | def to_ams_dict(self): 40 | params = dict() 41 | if hasattr(self, "transfer_from_method") and self.transfer_from_method is not None: 42 | params['transferFromMethod'] = self.transfer_from_method 43 | if hasattr(self, "transfer_from_amount") and self.transfer_from_amount is not None: 44 | params['transferFromAmount'] = self.transfer_from_amount 45 | return params 46 | 47 | 48 | def parse_rsp_body(self, response_body): 49 | if isinstance(response_body, str): 50 | response_body = json.loads(response_body) 51 | if 'transferFromMethod' in response_body: 52 | self.__transfer_from_method = PaymentMethod() 53 | self.__transfer_from_method.parse_rsp_body(response_body['transferFromMethod']) 54 | if 'transferFromAmount' in response_body: 55 | self.__transfer_from_amount = Amount() 56 | self.__transfer_from_amount.parse_rsp_body(response_body['transferFromAmount']) 57 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/users/alipay_verify_authentication_request.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import json 5 | 6 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 7 | 8 | 9 | class AlipayVerifyAuthenticationRequest(AlipayRequest): 10 | 11 | def __init__(self): 12 | super(AlipayVerifyAuthenticationRequest, self).__init__() 13 | self.__authentication_type = None 14 | self.__authentication_request_id = None 15 | self.__authentication_value = None 16 | 17 | @property 18 | def authentication_type(self): 19 | return self.__authentication_type 20 | 21 | @authentication_type.setter 22 | def authentication_type(self, value): 23 | self.__authentication_type = value 24 | 25 | @property 26 | def authentication_request_id(self): 27 | return self.__authentication_request_id 28 | 29 | @authentication_request_id.setter 30 | def authentication_request_id(self, value): 31 | self.__authentication_request_id = value 32 | 33 | @property 34 | def authentication_value(self): 35 | return self.__authentication_value 36 | 37 | @authentication_value.setter 38 | def authentication_value(self, value): 39 | self.__authentication_value = value 40 | 41 | def to_ams_json(self): 42 | json_str = json.dumps( 43 | obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3 44 | ) 45 | return json_str 46 | 47 | def __to_ams_dict(self): 48 | params = dict() 49 | if hasattr(self, "authentication_type") and self.authentication_type: 50 | params["authenticationType"] = self.authentication_type 51 | 52 | if ( 53 | hasattr(self, "authentication_request_id") 54 | and self.authentication_request_id 55 | ): 56 | params["authenticationRequestId"] = self.authentication_request_id 57 | 58 | if hasattr(self, "authentication_value") and self.authentication_value: 59 | params["authenticationValue"] = self.authentication_value 60 | 61 | return params 62 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/declaration.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.declaration_biz_scene_type import DeclarationBizSceneType 3 | 4 | 5 | 6 | 7 | class Declaration: 8 | def __init__(self): 9 | 10 | self.__declaration_biz_scene = None # type: DeclarationBizSceneType 11 | self.__declaration_beneficiary_id = None # type: str 12 | 13 | 14 | @property 15 | def declaration_biz_scene(self): 16 | """Gets the declaration_biz_scene of this Declaration. 17 | 18 | """ 19 | return self.__declaration_biz_scene 20 | 21 | @declaration_biz_scene.setter 22 | def declaration_biz_scene(self, value): 23 | self.__declaration_biz_scene = value 24 | @property 25 | def declaration_beneficiary_id(self): 26 | """ 27 | 用于唯一标识用于申报额度累计的三方收款人Id。非OTA结汇场景不传,OTA场景必传,且与declarationBizScene需同时存在。 28 | """ 29 | return self.__declaration_beneficiary_id 30 | 31 | @declaration_beneficiary_id.setter 32 | def declaration_beneficiary_id(self, value): 33 | self.__declaration_beneficiary_id = value 34 | 35 | 36 | 37 | 38 | def to_ams_dict(self): 39 | params = dict() 40 | if hasattr(self, "declaration_biz_scene") and self.declaration_biz_scene is not None: 41 | params['declarationBizScene'] = self.declaration_biz_scene 42 | if hasattr(self, "declaration_beneficiary_id") and self.declaration_beneficiary_id is not None: 43 | params['declarationBeneficiaryId'] = self.declaration_beneficiary_id 44 | return params 45 | 46 | 47 | def parse_rsp_body(self, response_body): 48 | if isinstance(response_body, str): 49 | response_body = json.loads(response_body) 50 | if 'declarationBizScene' in response_body: 51 | declaration_biz_scene_temp = DeclarationBizSceneType.value_of(response_body['declarationBizScene']) 52 | self.__declaration_biz_scene = declaration_biz_scene_temp 53 | if 'declarationBeneficiaryId' in response_body: 54 | self.__declaration_beneficiary_id = response_body['declarationBeneficiaryId'] 55 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/aba/alipay_inquiry_statement_list_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.statement import Statement 3 | from com.alipay.ams.api.model.result import Result 4 | 5 | 6 | 7 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 8 | 9 | class AlipayInquiryStatementListResponse(AlipayResponse): 10 | def __init__(self, rsp_body): 11 | super(AlipayResponse, self).__init__() 12 | 13 | self.__statement_list = None # type: [Statement] 14 | self.__result = None # type: Result 15 | self.parse_rsp_body(rsp_body) 16 | 17 | 18 | @property 19 | def statement_list(self): 20 | """Gets the statement_list of this AlipayInquiryStatementListResponse. 21 | 22 | """ 23 | return self.__statement_list 24 | 25 | @statement_list.setter 26 | def statement_list(self, value): 27 | self.__statement_list = value 28 | @property 29 | def result(self): 30 | """Gets the result of this AlipayInquiryStatementListResponse. 31 | 32 | """ 33 | return self.__result 34 | 35 | @result.setter 36 | def result(self, value): 37 | self.__result = value 38 | 39 | 40 | 41 | 42 | def to_ams_dict(self): 43 | params = dict() 44 | if hasattr(self, "statement_list") and self.statement_list is not None: 45 | params['statementList'] = self.statement_list 46 | if hasattr(self, "result") and self.result is not None: 47 | params['result'] = self.result 48 | return params 49 | 50 | 51 | def parse_rsp_body(self, response_body): 52 | response_body = super(AlipayInquiryStatementListResponse, self).parse_rsp_body(response_body) 53 | if 'statementList' in response_body: 54 | self.__statement_list = [] 55 | for item in response_body['statementList']: 56 | obj = Statement() 57 | obj.parse_rsp_body(item) 58 | self.__statement_list.append(obj) 59 | if 'result' in response_body: 60 | self.__result = Result() 61 | self.__result.parse_rsp_body(response_body['result']) 62 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/marketplace/alipay_settlement_info_update_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.result import Result 3 | 4 | 5 | 6 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 7 | 8 | class AlipaySettlementInfoUpdateResponse(AlipayResponse): 9 | def __init__(self, rsp_body): 10 | super(AlipayResponse, self).__init__() 11 | 12 | self.__result = None # type: Result 13 | self.__update_status = None # type: str 14 | self.parse_rsp_body(rsp_body) 15 | 16 | 17 | @property 18 | def result(self): 19 | """Gets the result of this AlipaySettlementInfoUpdateResponse. 20 | 21 | """ 22 | return self.__result 23 | 24 | @result.setter 25 | def result(self, value): 26 | self.__result = value 27 | @property 28 | def update_status(self): 29 | """ 30 | 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 31 | """ 32 | return self.__update_status 33 | 34 | @update_status.setter 35 | def update_status(self, value): 36 | self.__update_status = value 37 | 38 | 39 | 40 | 41 | def to_ams_dict(self): 42 | params = dict() 43 | if hasattr(self, "result") and self.result is not None: 44 | params['result'] = self.result 45 | if hasattr(self, "update_status") and self.update_status is not None: 46 | params['updateStatus'] = self.update_status 47 | return params 48 | 49 | 50 | def parse_rsp_body(self, response_body): 51 | response_body = super(AlipaySettlementInfoUpdateResponse, self).parse_rsp_body(response_body) 52 | if 'result' in response_body: 53 | self.__result = Result() 54 | self.__result.parse_rsp_body(response_body['result']) 55 | if 'updateStatus' in response_body: 56 | self.__update_status = response_body['updateStatus'] 57 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/notify/alipay_vaulting_notify.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.model.acquirer_info import AcquirerInfo 2 | from com.alipay.ams.api.model.payment_method_detail import PaymentMethodDetail 3 | from com.alipay.ams.api.request.notify.alipay_notify import AlipayNotify 4 | 5 | 6 | class AlipayVaultingNotify(AlipayNotify): 7 | 8 | def __init__(self, notify_body): 9 | super(AlipayVaultingNotify, self).__init__() 10 | self.__vaulting_request_id = None 11 | self.__payment_method_detail = None # type: PaymentMethodDetail 12 | self.__vaulting_create_time = None 13 | self.__acquirer_info = None # type: AcquirerInfo 14 | self.__metadata = None # type: str 15 | self.__parse_notify_body(notify_body) 16 | 17 | @property 18 | def vaulting_request_id(self): 19 | return self.__vaulting_request_id 20 | 21 | @property 22 | def payment_method_detail(self): 23 | return self.__payment_method_detail 24 | 25 | @property 26 | def vaulting_create_time(self): 27 | return self.__vaulting_create_time 28 | @property 29 | def metadata(self): 30 | return self.__metadata 31 | 32 | @property 33 | def acquirer_info(self): 34 | return self.__acquirer_info 35 | 36 | def __parse_notify_body(self, notify_body): 37 | notify = super(AlipayVaultingNotify, self).parse_notify_body(notify_body) 38 | if "vaultingRequestId" in notify: 39 | self.__vaulting_request_id = notify["vaultingRequestId"] 40 | if "paymentMethodDetail" in notify: 41 | payment_method_detail = PaymentMethodDetail() 42 | payment_method_detail.parse_rsp_body(notify["paymentMethodDetail"]) 43 | self.__payment_method_detail = payment_method_detail 44 | if "vaultingCreateTime" in notify: 45 | self.__vaulting_create_time = notify["vaultingCreateTime"] 46 | if "acquirerInfo" in notify: 47 | acquirer_info = AcquirerInfo() 48 | acquirer_info.parse_rsp_body(notify["acquirerInfo"]) 49 | self.__acquirer_info = acquirer_info 50 | if "metadata" in notify: 51 | self.__metadata = notify["metadata"] -------------------------------------------------------------------------------- /com/alipay/ams/api/response/marketplace/alipay_register_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.result import Result 3 | 4 | 5 | 6 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 7 | 8 | class AlipayRegisterResponse(AlipayResponse): 9 | def __init__(self, rsp_body): 10 | super(AlipayResponse, self).__init__() 11 | 12 | self.__result = None # type: Result 13 | self.__registration_status = None # type: str 14 | self.parse_rsp_body(rsp_body) 15 | 16 | 17 | @property 18 | def result(self): 19 | """Gets the result of this AlipayRegisterResponse. 20 | 21 | """ 22 | return self.__result 23 | 24 | @result.setter 25 | def result(self, value): 26 | self.__result = value 27 | @property 28 | def registration_status(self): 29 | """ 30 | 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 31 | """ 32 | return self.__registration_status 33 | 34 | @registration_status.setter 35 | def registration_status(self, value): 36 | self.__registration_status = value 37 | 38 | 39 | 40 | 41 | def to_ams_dict(self): 42 | params = dict() 43 | if hasattr(self, "result") and self.result is not None: 44 | params['result'] = self.result 45 | if hasattr(self, "registration_status") and self.registration_status is not None: 46 | params['registrationStatus'] = self.registration_status 47 | return params 48 | 49 | 50 | def parse_rsp_body(self, response_body): 51 | response_body = super(AlipayRegisterResponse, self).parse_rsp_body(response_body) 52 | if 'result' in response_body: 53 | self.__result = Result() 54 | self.__result.parse_rsp_body(response_body['result']) 55 | if 'registrationStatus' in response_body: 56 | self.__registration_status = response_body['registrationStatus'] 57 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/installment.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.support_card_brand import SupportCardBrand 3 | from com.alipay.ams.api.model.plan import Plan 4 | 5 | 6 | 7 | 8 | class Installment: 9 | def __init__(self): 10 | 11 | self.__support_card_brands = None # type: [SupportCardBrand] 12 | self.__plans = None # type: [Plan] 13 | 14 | 15 | @property 16 | def support_card_brands(self): 17 | """ 18 | The list of card brands that support the installment plans. This parameter is returned when the value of paymentMethodType is CARD. 19 | """ 20 | return self.__support_card_brands 21 | 22 | @support_card_brands.setter 23 | def support_card_brands(self, value): 24 | self.__support_card_brands = value 25 | @property 26 | def plans(self): 27 | """ 28 | The list of installment plans for payment methods that support installments. 29 | """ 30 | return self.__plans 31 | 32 | @plans.setter 33 | def plans(self, value): 34 | self.__plans = value 35 | 36 | 37 | 38 | 39 | def to_ams_dict(self): 40 | params = dict() 41 | if hasattr(self, "support_card_brands") and self.support_card_brands is not None: 42 | params['supportCardBrands'] = self.support_card_brands 43 | if hasattr(self, "plans") and self.plans is not None: 44 | params['plans'] = self.plans 45 | return params 46 | 47 | 48 | def parse_rsp_body(self, response_body): 49 | if isinstance(response_body, str): 50 | response_body = json.loads(response_body) 51 | if 'supportCardBrands' in response_body: 52 | self.__support_card_brands = [] 53 | for item in response_body['supportCardBrands']: 54 | obj = SupportCardBrand() 55 | obj.parse_rsp_body(item) 56 | self.__support_card_brands.append(obj) 57 | if 'plans' in response_body: 58 | self.__plans = [] 59 | for item in response_body['plans']: 60 | obj = Plan() 61 | obj.parse_rsp_body(item) 62 | self.__plans.append(obj) 63 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/dispute/alipay_supply_defense_document_request.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | 5 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 6 | 7 | class AlipaySupplyDefenseDocumentRequest(AlipayRequest): 8 | def __init__(self): 9 | super(AlipaySupplyDefenseDocumentRequest, self).__init__("/ams/api/v1/payments/supplyDefenseDocument") 10 | 11 | self.__dispute_id = None # type: str 12 | self.__dispute_evidence = None # type: str 13 | 14 | 15 | @property 16 | def dispute_id(self): 17 | """ 18 | The unique ID assigned by Antom to identify a dispute. More information: Maximum length: 64 characters 19 | """ 20 | return self.__dispute_id 21 | 22 | @dispute_id.setter 23 | def dispute_id(self, value): 24 | self.__dispute_id = value 25 | @property 26 | def dispute_evidence(self): 27 | """ 28 | The dispute defense document that you prepare for defending the dispute, which is encoded in the Base64 format. More information: Maximum length: 1000000 characters 29 | """ 30 | return self.__dispute_evidence 31 | 32 | @dispute_evidence.setter 33 | def dispute_evidence(self, value): 34 | self.__dispute_evidence = value 35 | 36 | 37 | def to_ams_json(self): 38 | json_str = json.dumps(obj=self.to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3) 39 | return json_str 40 | 41 | 42 | def to_ams_dict(self): 43 | params = dict() 44 | if hasattr(self, "dispute_id") and self.dispute_id is not None: 45 | params['disputeId'] = self.dispute_id 46 | if hasattr(self, "dispute_evidence") and self.dispute_evidence is not None: 47 | params['disputeEvidence'] = self.dispute_evidence 48 | return params 49 | 50 | 51 | def parse_rsp_body(self, response_body): 52 | if isinstance(response_body, str): 53 | response_body = json.loads(response_body) 54 | if 'disputeId' in response_body: 55 | self.__dispute_id = response_body['disputeId'] 56 | if 'disputeEvidence' in response_body: 57 | self.__dispute_evidence = response_body['disputeEvidence'] 58 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/settlement_info.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.settlement_bank_account import SettlementBankAccount 3 | 4 | 5 | 6 | 7 | class SettlementInfo: 8 | def __init__(self): 9 | 10 | self.__settlement_currency = None # type: str 11 | self.__settlement_bank_account = None # type: SettlementBankAccount 12 | 13 | 14 | @property 15 | def settlement_currency(self): 16 | """ 17 | 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 18 | """ 19 | return self.__settlement_currency 20 | 21 | @settlement_currency.setter 22 | def settlement_currency(self, value): 23 | self.__settlement_currency = value 24 | @property 25 | def settlement_bank_account(self): 26 | """Gets the settlement_bank_account of this SettlementInfo. 27 | 28 | """ 29 | return self.__settlement_bank_account 30 | 31 | @settlement_bank_account.setter 32 | def settlement_bank_account(self, value): 33 | self.__settlement_bank_account = value 34 | 35 | 36 | 37 | 38 | def to_ams_dict(self): 39 | params = dict() 40 | if hasattr(self, "settlement_currency") and self.settlement_currency is not None: 41 | params['settlementCurrency'] = self.settlement_currency 42 | if hasattr(self, "settlement_bank_account") and self.settlement_bank_account is not None: 43 | params['settlementBankAccount'] = self.settlement_bank_account 44 | return params 45 | 46 | 47 | def parse_rsp_body(self, response_body): 48 | if isinstance(response_body, str): 49 | response_body = json.loads(response_body) 50 | if 'settlementCurrency' in response_body: 51 | self.__settlement_currency = response_body['settlementCurrency'] 52 | if 'settlementBankAccount' in response_body: 53 | self.__settlement_bank_account = SettlementBankAccount() 54 | self.__settlement_bank_account.parse_rsp_body(response_body['settlementBankAccount']) 55 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/pay/alipay_create_order_response.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from com.alipay.ams.api.model.amount import Amount 5 | from com.alipay.ams.api.model.redirect_action_form import RedirectActionForm 6 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 7 | 8 | 9 | class AlipayCreateOrderResponse(AlipayResponse): 10 | 11 | def __init__(self, rsp_body): 12 | super(AlipayCreateOrderResponse, self).__init__() 13 | self.__payment_request_id = None 14 | self.__payment_id = None 15 | self.__client_payment_token = None 16 | self.__payment_amount = None # type: Amount 17 | self.__redirect_action_form = None 18 | self.__parse_rsp_body(rsp_body) 19 | 20 | @property 21 | def payment_request_id(self): 22 | return self.__payment_request_id 23 | 24 | @property 25 | def payment_id(self): 26 | return self.__payment_id 27 | 28 | @property 29 | def client_payment_token(self): 30 | return self.__client_payment_token 31 | 32 | @property 33 | def payment_amount(self): 34 | return self.__payment_amount 35 | 36 | @property 37 | def redirect_action_form(self): 38 | return self.__redirect_action_form 39 | 40 | def __parse_rsp_body(self, rsp_body): 41 | response = super(AlipayCreateOrderResponse, self).parse_rsp_body(rsp_body) 42 | if "paymentRequestId" in response: 43 | self.__payment_request_id = response["paymentRequestId"] 44 | if "paymentId" in response: 45 | self.__payment_id = response["paymentId"] 46 | if "paymentAmount" in response: 47 | payment_amount = Amount() 48 | payment_amount.parse_rsp_body(response["paymentAmount"]) 49 | self.__payment_amount = payment_amount 50 | if "clientPaymentToken" in response: 51 | self.__client_payment_token = response["clientPaymentToken"] 52 | if "redirectActionForm" in response: 53 | redirect_action_form = RedirectActionForm() 54 | redirect_action_form.parse_rsp_body(response["redirectActionForm"]) 55 | self.__redirect_action_form = redirect_action_form 56 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/vaulting/alipay_vaulting_query_response.py: -------------------------------------------------------------------------------- 1 | from com.alipay.ams.api.model.payment_method_detail import PaymentMethodDetail 2 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 3 | 4 | 5 | class AlipayVaultingQueryResponse(AlipayResponse): 6 | def __init__(self, rsp_body): 7 | super(AlipayVaultingQueryResponse, self).__init__() 8 | self.__vaulting_request_id = None 9 | self.__normal_url = None 10 | self.__scheme_url = None 11 | self.__applink_url = None 12 | self.__vaulting_status = None 13 | self.__payment_method_detail = None # type: PaymentMethodDetail 14 | self.__parse_rsp_body(rsp_body) 15 | 16 | @property 17 | def vaulting_request_id(self): 18 | return self.__vaulting_request_id 19 | 20 | @property 21 | def normal_url(self): 22 | return self.__normal_url 23 | 24 | @property 25 | def scheme_url(self): 26 | return self.__scheme_url 27 | 28 | @property 29 | def applink_url(self): 30 | return self.__applink_url 31 | 32 | @property 33 | def vaulting_status(self): 34 | return self.__vaulting_status 35 | 36 | @property 37 | def payment_method_detail(self): 38 | return self.__payment_method_detail 39 | 40 | def __parse_rsp_body(self, rsp_body): 41 | rsp_dict = super(AlipayVaultingQueryResponse, self).parse_rsp_body(rsp_body) 42 | if "vaultingRequestId" in rsp_dict: 43 | self.__vaulting_request_id = rsp_dict["vaultingRequestId"] 44 | if "normalUrl" in rsp_dict: 45 | self.__normal_url = rsp_dict["normalUrl"] 46 | if "schemeUrl" in rsp_dict: 47 | self.__scheme_url = rsp_dict["schemeUrl"] 48 | if "applinkUrl" in rsp_dict: 49 | self.__applink_url = rsp_dict["applinkUrl"] 50 | if "vaultingStatus" in rsp_dict: 51 | self.__vaulting_status = rsp_dict["vaultingStatus"] 52 | if "paymentMethodDetail" in rsp_dict: 53 | payment_method_detail = PaymentMethodDetail() 54 | self.__payment_method_detail = payment_method_detail.parse_rsp_body( 55 | rsp_dict["paymentMethodDetail"] 56 | ) 57 | -------------------------------------------------------------------------------- /com/alipay/ams/api/response/marketplace/alipay_inquire_balance_response.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.result import Result 3 | from com.alipay.ams.api.model.account_balance import AccountBalance 4 | 5 | 6 | 7 | from com.alipay.ams.api.response.alipay_response import AlipayResponse 8 | 9 | class AlipayInquireBalanceResponse(AlipayResponse): 10 | def __init__(self, rsp_body): 11 | super(AlipayResponse, self).__init__() 12 | 13 | self.__result = None # type: Result 14 | self.__account_balances = None # type: [AccountBalance] 15 | self.parse_rsp_body(rsp_body) 16 | 17 | 18 | @property 19 | def result(self): 20 | """Gets the result of this AlipayInquireBalanceResponse. 21 | 22 | """ 23 | return self.__result 24 | 25 | @result.setter 26 | def result(self, value): 27 | self.__result = value 28 | @property 29 | def account_balances(self): 30 | """ 31 | The list of balance accounts assigned by Alipay. More information:Maximum length: 64 characters 32 | """ 33 | return self.__account_balances 34 | 35 | @account_balances.setter 36 | def account_balances(self, value): 37 | self.__account_balances = value 38 | 39 | 40 | 41 | 42 | def to_ams_dict(self): 43 | params = dict() 44 | if hasattr(self, "result") and self.result is not None: 45 | params['result'] = self.result 46 | if hasattr(self, "account_balances") and self.account_balances is not None: 47 | params['accountBalances'] = self.account_balances 48 | return params 49 | 50 | 51 | def parse_rsp_body(self, response_body): 52 | response_body = super(AlipayInquireBalanceResponse, self).parse_rsp_body(response_body) 53 | if 'result' in response_body: 54 | self.__result = Result() 55 | self.__result.parse_rsp_body(response_body['result']) 56 | if 'accountBalances' in response_body: 57 | self.__account_balances = [] 58 | for item in response_body['accountBalances']: 59 | obj = AccountBalance() 60 | obj.parse_rsp_body(item) 61 | self.__account_balances.append(obj) 62 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/risks/inquiry_risk_score_request.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import json 5 | 6 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 7 | 8 | 9 | class InquiryRiskScoreRequest(AlipayRequest): 10 | 11 | def __init__(self): 12 | super(InquiryRiskScoreRequest, self).__init__() 13 | self.__customer_belongs_to = None 14 | self.__customer_id_type = None 15 | self.__customer_id = None 16 | self.__risk_score_types = None 17 | 18 | @property 19 | def customer_belongs_to(self): 20 | return self.__customer_belongs_to 21 | 22 | @customer_belongs_to.setter 23 | def customer_belongs_to(self, value): 24 | self.__customer_belongs_to = value 25 | 26 | @property 27 | def customer_id_type(self): 28 | return self.__customer_id_type 29 | 30 | @customer_id_type.setter 31 | def customer_id_type(self, value): 32 | self.__customer_id_type = value 33 | 34 | @property 35 | def customer_id(self): 36 | return self.__customer_id 37 | 38 | @customer_id.setter 39 | def customer_id(self, value): 40 | self.__customer_id = value 41 | 42 | @property 43 | def risk_score_types(self): 44 | return self.__risk_score_types 45 | 46 | @risk_score_types.setter 47 | def risk_score_types(self, value): 48 | self.__risk_score_types = value 49 | 50 | def to_ams_json(self): 51 | json_str = json.dumps( 52 | obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3 53 | ) 54 | return json_str 55 | 56 | def __to_ams_dict(self): 57 | params = dict() 58 | if hasattr(self, "customer_belongs_to") and self.customer_belongs_to: 59 | params["customerBelongsTo"] = self.customer_belongs_to 60 | 61 | if hasattr(self, "customer_id_type") and self.customer_id_type: 62 | params["customerIdType"] = self.customer_id_type 63 | 64 | if hasattr(self, "customer_id") and self.customer_id: 65 | params["customer_id"] = self.customer_id 66 | 67 | if hasattr(self, "risk_score_types") and self.risk_score_types: 68 | params["riskScoreTypes"] = self.risk_score_types 69 | 70 | return params 71 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/apple_pay_configuration.py: -------------------------------------------------------------------------------- 1 | import string 2 | 3 | 4 | class ApplePayConfiguration: 5 | def __init__(self): 6 | self.__required_billing_contact_fields = None # type: list[string] 7 | self.__required_shipping_contact_fields = None # type: list[string] 8 | self.__buttons_bundled = None # type: bool 9 | self.__apple_pay_token = None # type: string 10 | 11 | @property 12 | def required_billing_contact_fields(self): 13 | return self.__required_billing_contact_fields 14 | 15 | @required_billing_contact_fields.setter 16 | def required_billing_contact_fields(self, value): 17 | self.__required_billing_contact_fields = value 18 | 19 | @property 20 | def required_shipping_contact_fields(self): 21 | return self.__required_shipping_contact_fields 22 | 23 | @required_shipping_contact_fields.setter 24 | def required_shipping_contact_fields(self, value): 25 | self.__required_shipping_contact_fields = value 26 | 27 | @property 28 | def buttons_bundled(self): 29 | return self.__buttons_bundled 30 | 31 | @buttons_bundled.setter 32 | def buttons_bundled(self, value: bool): 33 | self.__buttons_bundled = value 34 | 35 | @property 36 | def apple_pay_token(self): 37 | return self.__apple_pay_token 38 | 39 | @apple_pay_token.setter 40 | def apple_pay_token(self, value: str): 41 | self.__apple_pay_token = value 42 | 43 | def to_ams_dict(self): 44 | params = dict() 45 | if ( 46 | hasattr(self, "required_billing_contact_fields") 47 | and self.required_billing_contact_fields 48 | ): 49 | params["referenceBuyerId"] = self.required_shipping_contact_fields 50 | if ( 51 | hasattr(self, "required_shipping_contact_fields") 52 | and self.required_shipping_contact_fields 53 | ): 54 | params["referenceBuyerId"] = self.required_shipping_contact_fields 55 | if hasattr(self, "buttons_bundled") and self.buttons_bundled: 56 | params["referenceBuyerId"] = self.buttons_bundled 57 | if hasattr(self, "apple_pay_token") and self.apple_pay_token: 58 | params["referenceBuyerId"] = self.apple_pay_token 59 | return params 60 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/result.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.result_status_type import ResultStatusType 3 | 4 | 5 | 6 | 7 | class Result: 8 | def __init__(self): 9 | 10 | self.__result_code = None # type: str 11 | self.__result_status = None # type: ResultStatusType 12 | self.__result_message = None # type: str 13 | 14 | 15 | @property 16 | def result_code(self): 17 | """ 18 | The result code. 19 | """ 20 | return self.__result_code 21 | 22 | @result_code.setter 23 | def result_code(self, value): 24 | self.__result_code = value 25 | @property 26 | def result_status(self): 27 | """Gets the result_status of this Result. 28 | 29 | """ 30 | return self.__result_status 31 | 32 | @result_status.setter 33 | def result_status(self, value): 34 | self.__result_status = value 35 | @property 36 | def result_message(self): 37 | """ 38 | The result message. 39 | """ 40 | return self.__result_message 41 | 42 | @result_message.setter 43 | def result_message(self, value): 44 | self.__result_message = value 45 | 46 | 47 | 48 | 49 | def to_ams_dict(self): 50 | params = dict() 51 | if hasattr(self, "result_code") and self.result_code is not None: 52 | params['resultCode'] = self.result_code 53 | if hasattr(self, "result_status") and self.result_status is not None: 54 | params['resultStatus'] = self.result_status 55 | if hasattr(self, "result_message") and self.result_message is not None: 56 | params['resultMessage'] = self.result_message 57 | return params 58 | 59 | 60 | def parse_rsp_body(self, response_body): 61 | if isinstance(response_body, str): 62 | response_body = json.loads(response_body) 63 | if 'resultCode' in response_body: 64 | self.__result_code = response_body['resultCode'] 65 | if 'resultStatus' in response_body: 66 | result_status_temp = ResultStatusType.value_of(response_body['resultStatus']) 67 | self.__result_status = result_status_temp 68 | if 'resultMessage' in response_body: 69 | self.__result_message = response_body['resultMessage'] 70 | -------------------------------------------------------------------------------- /com/alipay/ams/api/model/available_payment_method.py: -------------------------------------------------------------------------------- 1 | import json 2 | from com.alipay.ams.api.model.payment_method_type_item import PaymentMethodTypeItem 3 | 4 | 5 | 6 | 7 | class AvailablePaymentMethod: 8 | def __init__(self): 9 | 10 | self.__payment_method_meta_data = None # type: {str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},)} 11 | self.__payment_method_type_list = None # type: [PaymentMethodTypeItem] 12 | 13 | 14 | @property 15 | def payment_method_meta_data(self): 16 | """ 17 | Additional information required for some specific payment methods. 18 | """ 19 | return self.__payment_method_meta_data 20 | 21 | @payment_method_meta_data.setter 22 | def payment_method_meta_data(self, value): 23 | self.__payment_method_meta_data = value 24 | @property 25 | def payment_method_type_list(self): 26 | """Gets the payment_method_type_list of this AvailablePaymentMethod. 27 | 28 | """ 29 | return self.__payment_method_type_list 30 | 31 | @payment_method_type_list.setter 32 | def payment_method_type_list(self, value): 33 | self.__payment_method_type_list = value 34 | 35 | 36 | 37 | 38 | def to_ams_dict(self): 39 | params = dict() 40 | if hasattr(self, "payment_method_meta_data") and self.payment_method_meta_data is not None: 41 | params['paymentMethodMetaData'] = self.payment_method_meta_data 42 | if hasattr(self, "payment_method_type_list") and self.payment_method_type_list is not None: 43 | params['paymentMethodTypeList'] = self.payment_method_type_list 44 | return params 45 | 46 | 47 | def parse_rsp_body(self, response_body): 48 | if isinstance(response_body, str): 49 | response_body = json.loads(response_body) 50 | if 'paymentMethodMetaData' in response_body: 51 | self.__payment_method_meta_data = response_body['paymentMethodMetaData'] 52 | if 'paymentMethodTypeList' in response_body: 53 | self.__payment_method_type_list = [] 54 | for item in response_body['paymentMethodTypeList']: 55 | obj = PaymentMethodTypeItem() 56 | obj.parse_rsp_body(item) 57 | self.__payment_method_type_list.append(obj) 58 | -------------------------------------------------------------------------------- /com/alipay/ams/api/request/risks/risk_report_request.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants 4 | from com.alipay.ams.api.request.alipay_request import AlipayRequest 5 | 6 | 7 | class RiskReportRequest(AlipayRequest): 8 | 9 | def __init__(self): 10 | super(RiskReportRequest, self).__init__(AntomPathConstants.RISK_REPORT_PATH) 11 | self.__reference_transaction_id = None 12 | self.__report_reason = None 13 | self.__risk_type = None 14 | self.__risk_occurrence_time = None 15 | 16 | @property 17 | def reference_transaction_id(self): 18 | return self.__reference_transaction_id 19 | 20 | @reference_transaction_id.setter 21 | def reference_transaction_id(self, value): 22 | self.__reference_transaction_id = value 23 | 24 | @property 25 | def report_reason(self): 26 | return self.__report_reason 27 | 28 | @report_reason.setter 29 | def report_reason(self, value): 30 | self.__report_reason = value 31 | 32 | @property 33 | def risk_type(self): 34 | return self.__risk_type 35 | 36 | @risk_type.setter 37 | def risk_type(self, value): 38 | self.__risk_type = value 39 | 40 | @property 41 | def risk_occurrence_time(self): 42 | return self.__risk_occurrence_time 43 | 44 | @risk_occurrence_time.setter 45 | def risk_occurrence_time(self, value): 46 | self.__risk_occurrence_time = value 47 | 48 | def to_ams_dict(self): 49 | ams_dict = super(RiskReportRequest, self) 50 | 51 | def to_ams_json(self): 52 | json_str = json.dumps( 53 | obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3 54 | ) 55 | return json_str 56 | 57 | def __to_ams_dict(self): 58 | params = dict() 59 | if self.__reference_transaction_id is not None: 60 | params["referenceTransactionId"] = self.__reference_transaction_id 61 | if self.__report_reason is not None: 62 | params["reportReason"] = self.__report_reason 63 | if self.__risk_type is not None: 64 | params["riskType"] = self.__risk_type 65 | if self.__risk_occurrence_time is not None: 66 | params["riskOccurrenceTime"] = self.__risk_occurrence_time 67 | return params 68 | --------------------------------------------------------------------------------