def individual_identification(self, params, files):
     self.__individual_identification_schema(params)
     # 校验数据
     return KeyVariables(params=params,
                         url='account/individual/identification',
                         method='POST',
                         files=files)
 def company_reidentification(self, params, files):
     self.__company_identification_schema(params)
     # 校验数据
     return KeyVariables(params=params,
                         url='account/company/identification',
                         method='PUT',
                         files=files)
 def get_balance(self, params):
     # 校验数据
     return KeyVariables(
         params=params,
         url='account/wallet/balance',
         method='GET',
     )
    def get_iats(self, params):

        param_schema = Schema(
            {
                'from_created_at': {
                    'type': basestring,
                    'required': False
                },
                'to_created_at': {
                    'type': basestring,
                    'required': False
                },
                'send_currency': {
                    'type': basestring,
                    'required': False
                },
            },
            strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=params,
            url='iats',
            method='GET',
        )
    def create_transfer(self, params):

        beneficiary_schema = Schema({
            'bank_account_number': {'type': basestring, 'required': True},
            'amount': {'type': numbers.Number, 'required': True},
            'currency': {'type': basestring, 'required': True},
        }, strict=False)

        param_schema = Schema({
            'send_amount': {'type': numbers.Number, 'required': True},
            'send_currency': {'type': basestring, 'required': True},
            'beneficiaries': {'type': Array(beneficiary_schema), 'required': True},
            'purpose': {'type': basestring, 'required': True},
            'memo': {'type': basestring, 'required': False},
        }, strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=json.dumps(params),
            url='transfer',
            method='POST',
        )
Exemplo n.º 6
0
    def get_deposits(self, params):
        param_schema = Schema(
            {
                'from_created_at': {
                    'type': basestring,
                    'required': True
                },
                'to_created_at': {
                    'type': basestring,
                    'required': True
                },
                'currency': {
                    'type': basestring,
                    'required': True
                },
                'status': {
                    'type': basestring,
                    'required': True,
                    'validates': one_of('CREDITED', 'PROCESSING', 'CANCELED')
                },
            },
            strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        return KeyVariables(
            params=params,
            url='deposits',
            method='GET',
        )
    def get_bacc(self, params):
        param_schema = Schema(
            {
                'bank_account_number': {
                    'type': basestring,
                    'required': True
                },
                'purpose': {
                    'type': basestring,
                    'required': True,
                    'validates': one_of('PAYER', 'BENEFICIARY')
                },
                'currency': {
                    'type': basestring,
                    'required': True
                },
            },
            strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        return KeyVariables(
            params=params,
            url='account/bank_account',
            method='GET',
        )
    def create_exchange(self, params):

        param_schema = Schema(
            {
                'sell_amount': {
                    'type': numbers.Number,
                    'required': True
                },
                'sell_currency': {
                    'type': basestring,
                    'required': True
                },
                'buy_amount': {
                    'type': numbers.Number,
                    'required': True
                },
                'buy_currency': {
                    'type': basestring,
                    'required': True
                },
            },
            strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=json.dumps(params),
            url='exchange',
            method='POST',
        )
    def update_invoice(self, params):
        address_schema = Schema({
            'line1': {'type': basestring, 'required': True},
            'city': {'type': basestring, 'required': False},
            'state': {'type': basestring, 'required': False},
            'postal_code': {'type': basestring, 'required': False},
            'country': {'type': basestring, 'required': False},
        })

        recipient_schema = Schema({
            'dob': {'type': basestring, 'required': True},
            'entity_type': {'type': basestring, 'required': True, 'validates': one_of('INDIVIDUAL', 'COMPANY')},
            'first_name': {'type': basestring, 'required': True},
            'last_name': {'type': basestring, 'required': True},
            'document_type': {'type': basestring, 'required': True},
            'document_number': {'type': basestring, 'required': True},
            'email': {'type': basestring, 'required': False},
            'mobile': {'type': basestring, 'required': False},
            'address': {'type': address_schema, 'required': False},
            'bank_account_number': {'type': basestring, 'required': False},
            'bank_name': {'type': basestring, 'required': False},
        }, strict=False)

        unit_price_schema = Schema({
            'currency': {'type': basestring, 'required': True},
            'amount': {'type': numbers.Number, 'required': True},
        })

        products_schema = Schema({
            'name': {'type': basestring, 'required': True},
            'quantity': {'type': int, 'required': True},
            'unit_price': {'type': unit_price_schema, 'required': True}
        })

        param_schema = Schema({
            'recipient': {'type': recipient_schema, 'required': True},
            'products': {'type': Array(products_schema), 'required': True},
            'memo': {'type': basestring, 'required': False},
            'out_trade_id': {'type': basestring, 'required': False},
            'currency': {'type': basestring, 'required': True},
            'amount': {'type': numbers.Number, 'required': True},
            'ex_invoice_no': {'type': basestring, 'required': True},
        }, strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=json.dumps(params),
            url='invoice',
            method='PUT',
        )
    def get_transfer(self, params):

        param_schema = Schema({
            'no': {'type': basestring, 'required': True},
        }, strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=params,
            url='transfer',
            method='GET',
        )
    def cancel_invoice(self, params):

        param_schema = Schema({
            'no': {'type': basestring, 'required': True},
        }, strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=params,
            url='invoice',
            method='DELETE',
        )
Exemplo n.º 12
0
    def get_rate(self, params):

        param_schema = Schema({
            'sell_currency': {'type': basestring, 'required': True},
            'buy_currency': {'type': basestring, 'required': True},
        }, strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=params,
            url='rate',
            method='GET',
        )
    def get_transfers(self, params):

        param_schema = Schema({
            'from_created_at': {'type': basestring, 'required': False},
            'to_created_at': {'type': basestring, 'required': False},
            'send_currency': {'type': basestring, 'required': False},
            'receive_currency': {'type': basestring, 'required': False},
            'status': {'type': basestring, 'required': False, 'validates': one_of('RISK', 'PAYMENT', 'CONVERSION', 'DELIVERY')},
        }, strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=params,
            url='transfers',
            method='GET',
        )
    def payment(self, params):

        param_schema = Schema({
            'no': {
                'type': basestring,
                'required': True
            },
        },
                              strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=params,
            url='exchange/payment',
            method='POST',
        )
    def create_acc(self, params):
        param_schema = Schema(
            {
                'account': {
                    'type': basestring,
                    'required': False
                },
                'password': {
                    'type': basestring,
                    'required': False
                },
                'entity_type': {
                    'type': basestring,
                    'required': True,
                    'validates': one_of('COMPANY', 'INDIVIDUAL')
                },
                'secret': {
                    'type': basestring,
                    'required': False
                },
                'partner': {
                    'type': basestring,
                    'required': True
                },
                'callback_url': {
                    'type': basestring,
                    'required': False
                },
            },
            strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=params,
            url='account',
            method='POST',
        )
Exemplo n.º 16
0
    def create_deposit(self, params):
        param_schema = Schema(
            {
                'payer_bank_acc_number': {
                    'type': basestring,
                    'required': False
                },
                'payer_bank_acc_no': {
                    'type': basestring,
                    'required': False
                },
                'escrow_bank_acc_number': {
                    'type': basestring,
                    'required': False
                },
                'currency': {
                    'type': basestring,
                    'required': True
                },
                'amount': {
                    'type': basestring,
                    'required': True
                },
                'out_trade_id': {
                    'type': basestring,
                    'required': False
                },
            },
            strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=params,
            url='deposit',
            method='POST',
        )
    def download(self, params):

        param_schema = Schema(
            {
                'from_created_at': {
                    'type': basestring,
                    'required': True
                },
                'to_created_at': {
                    'type': basestring,
                    'required': True
                },
            },
            strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=params,
            url='statement',
            method='GET',
        )
    def get_baccs(self, params):
        param_schema = Schema(
            {
                'purpose': {
                    'type': basestring,
                    'required': False,
                    'validates': one_of('PAYER', 'BENEFICIARY')
                },
                'status': {
                    'type': basestring,
                    'required': False,
                    'validates': one_of('NEW', 'APPROVED', 'PENDING', 'DENIED')
                },
            },
            strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        return KeyVariables(
            params=params,
            url='account/bank_accounts',
            method='GET',
        )
    def escrow_accounts(self, params):

        param_schema = Schema(
            {
                'currency': {
                    'type': basestring,
                    'required': True
                },
                'country': {
                    'type': basestring,
                    'required': True
                },
            },
            strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=params,
            url='escrow_accounts',
            method='GET',
        )
 def get_acc(self):
     return KeyVariables(
         params={},
         url='account',
         method='GET',
     )
    def create_baccs(self, params):
        bank_schema = Schema(
            {
                'name': {
                    'type': basestring,
                    'required': True
                },
                'branch': {
                    'type': basestring,
                    'required': False
                },
                'swift_code': {
                    'type': basestring,
                    'required': True
                },
                'routing_number': {
                    'type': basestring,
                    'required': False
                },
                'bsb_code': {
                    'type': basestring,
                    'required': False
                },
            },
            strict=False)

        holder_schema = Schema(
            {
                'name': {
                    'type': basestring,
                    'required': True
                },
                'doc_type': {
                    'type':
                    basestring,
                    'required':
                    False,
                    'validates':
                    one_of('ID', 'PASSPORT', 'DRIVER_LICENSE', 'CI', 'BR')
                },
                'doc_number': {
                    'type': basestring,
                    'required': False
                },
                'contact': {
                    'type': basestring,
                    'required': False
                },
                'type': {
                    'type': basestring,
                    'required': True,
                    'validates': one_of('COMPANY', 'INDIVIDUAL')
                },
                'dob': {
                    'type': basestring,
                    'required': False
                },
                'country': {
                    'type': basestring,
                    'required': False
                },
                'address': {
                    'type': basestring,
                    'required': False
                },
            },
            strict=False)

        param_schema = Schema(
            {
                'bank': {
                    'type': bank_schema,
                    'required': True
                },
                'country': {
                    'type': basestring,
                    'required': True
                },
                'currency': {
                    'type': basestring,
                    'required': True
                },
                'bank_account_number': {
                    'type': basestring,
                    'required': True
                },
                'holder': {
                    'type': holder_schema,
                    'required': True
                },
                'purpose': {
                    'type': basestring,
                    'required': True,
                    'validates': one_of('PAYER', 'BENEFICIARY')
                },
                'iban': {
                    'type': basestring,
                    'required': False
                },
            },
            strict=False)

        for bacc in params:
            param_schema.validate(bacc)  # 检测不通过直接抛异常
            param_schema.apply_defaults(bacc)  # attach 默认值

        return KeyVariables(
            params=json.dumps(params),
            url='account/bank_accounts',
            method='POST',
        )
    def evidence(self, params):

        param_schema = Schema(
            {
                'file_name': {
                    'type': basestring,
                    'required': True
                },
                'memo': {
                    'type': basestring,
                    'required': True
                },
                'transfer_no': {
                    'type': basestring,
                    'required': False
                },
                'exchange_no': {
                    'type': basestring,
                    'required': False
                },
                'deposit_no': {
                    'type': basestring,
                    'required': False
                },
                'invoice_no': {
                    'type': basestring,
                    'required': False
                },
                'iat_no': {
                    'type': basestring,
                    'required': False
                },
                'out_transfer_id': {
                    'type': basestring,
                    'required': False
                },
                'out_exchange_id': {
                    'type': basestring,
                    'required': False
                },
                'out_deposit_id': {
                    'type': basestring,
                    'required': False
                },
                'out_invoice_id': {
                    'type': basestring,
                    'required': False
                },
                'out_iat_id': {
                    'type': basestring,
                    'required': False
                },
            },
            strict=False)

        param_schema.validate(params)  # 检测不通过直接抛异常
        param_schema.apply_defaults(params)  # attach 默认值

        # 校验数据
        return KeyVariables(
            params=params,
            url='evidence',
            method='POST',
        )
 def development(self, params):
     return KeyVariables(
         params=params,
         url='development',
         method='POST',
     )