コード例 #1
0
    def get_banks(*, for_user_id=None, x_api_version=None, **kwargs):
        """Get available banks (API Reference: Virtual Account/Get Virtual Account Banks)

        Args:
          - **for_user_id (str) (XenPlatforms only)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          List of VirtualAccountBank

        Raises:
          XenditError

        """
        url = "/available_virtual_account_banks"
        headers, _ = _extract_params(
            locals(),
            func_object=VirtualAccount.get_banks,
            headers_params=["for_user_id", "x_api_version"],
            ignore_params=["id"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            virtual_account_banks = []
            for bank in resp.body:
                virtual_account_banks.append(VirtualAccountBank(**bank))
            return virtual_account_banks
        else:
            raise XenditError(resp)
コード例 #2
0
    def get(
        *,
        id,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Get payout (API Reference: Payout/Get Payout)

        Args:
          - id (str)
          - **for_user_id (str) (XenPlatform only)
          - **x_api_version (str)

        Returns
          Payout

        Raises
          XenditError

        """
        url = f"/payouts/{id}"
        headers, _ = _extract_params(
            locals(),
            func_object=Payout.get,
            headers_params=["for_user_id", "x_api_version"],
            ignore_params=["id"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return Payout(**resp.body)
        else:
            raise XenditError(resp)
コード例 #3
0
ファイル: retail_outlet.py プロジェクト: xendit/xendit-python
    def get_fixed_payment_code(*,
                               fixed_payment_code_id,
                               for_user_id=None,
                               x_api_version=None,
                               **kwargs):
        """Get the detail of given Fixed Payment Code (API Reference: Retail Outlets/Get Fixed Payment Code)

        Args:
          - fixed_payment_code_id (str)
          - **for_user_id (str) (XenPlatforms only)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          RetailOutlet

        Raises:
          XenditError

        """
        url = f"/fixed_payment_code/{fixed_payment_code_id}"
        headers, _ = _extract_params(
            locals(),
            func_object=RetailOutlet.update_fixed_payment_code,
            headers_params=["for_user_id", "x_api_version"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return RetailOutlet(**resp.body)
        else:
            raise XenditError(resp)
コード例 #4
0
    def get_available_banks(*, for_user_id=None, x_api_version=None, **kwargs):
        """Get Available Banks (API Reference: Disbursement/Get Available Banks)

        Args:
          - **for_user_id (str)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          List of DisbursementBank

        Raises:
          XenditError

        """
        url = "/available_disbursements_banks"
        headers, _ = _extract_params(
            locals(),
            func_object=Disbursement.get_available_banks,
            headers_params=["for_user_id", "x_api_version"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            disbursement_banks = []
            for bank in resp.body:
                disbursement_banks.append(DisbursementBank(**bank))
            return disbursement_banks
        else:
            raise XenditError(resp)
コード例 #5
0
    def get(
        *, id, for_user_id=None, x_api_version=None, **kwargs,
    ):
        """Get Recurring Payment by ID (API Reference: Recurring Payment/Get Recurring Payment)

        Args:
          - id (str)
          - **for_user_id (str)
          - **x_api_version (str)

        Returns:
          RecurringPayment

        Raises:
          XenditError

        """
        url = f"/recurring_payments/{id}"
        headers, _ = _extract_params(
            locals(),
            func_object=RecurringPayment.get,
            headers_params=["for_user_id", "x_api_version"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return RecurringPayment(**resp.body)
        else:
            raise XenditError(resp)
コード例 #6
0
    def get_by_ext_id(
        *,
        external_id,
        for_user_id=None,
        x_idempotency_key=None,
        x_api_version=None,
        **kwargs,
    ):
        """Get QR Codes by external_id (API Reference: QR Code/Get QR Code by External ID)

        Args:
          - external_id (str)
          - **for_user_id (str) (XenPlatforms only)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          QRCode

        Raises:
          XenditError

        """
        url = f"/qr_codes/{external_id}"
        headers, _ = _extract_params(
            locals(),
            func_object=QRCode.get_by_ext_id,
            headers_params=["for_user_id", "x_api_version"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return QRCode(**resp.body)
        else:
            raise XenditError(resp)
コード例 #7
0
    def get_by_ext_id(*, external_id, for_user_id=None, x_api_version=None, **kwargs):
        """Get Disbursement detail by external ID (API Reference: Disbursement/Get Disbursement by External ID)

        Args:
          - external_id (str)
          - **for_user_id (str)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          Disbursement

        Raises:
          XenditError

        """
        url = f"/disbursements?external_id={external_id}"
        headers, _ = _extract_params(
            locals(),
            func_object=Disbursement.get_by_ext_id,
            headers_params=["for_user_id", "x_api_version"],
            ignore_params=["external_id"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            disbursements = []
            for disbursement in resp.body:
                disbursements.append(Disbursement(**disbursement))
            return disbursements
        else:
            raise XenditError(resp)
コード例 #8
0
    def get_charge(
        *, credit_card_charge_id, for_user_id=None, x_api_version=None, **kwargs,
    ):
        """Get Detail of Credit Card Charge (API Reference: Credit Card/Get Charge)

        Args:
          - credit_card_charge_id (str)
          - **for_user_id (str)
          - **x_api_version (str)

        Returns:
          CreditCardCharge

        Raises:
          XenditError

        """
        url = f"/credit_card_charges/{credit_card_charge_id}"
        headers, _ = _extract_params(
            locals(),
            func_object=CreditCard.get_charge,
            headers_params=["for_user_id", "x_idempotency_key", "x_api_version"],
            ignore_params=["credit_card_charge_id"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return CreditCardCharge(**resp.body)
        else:
            raise XenditError(resp)
コード例 #9
0
    def resume(
        *, id, x_idempotency_key=None, for_user_id=None, x_api_version=None, **kwargs,
    ):
        """Pause Recurring Payment (API Reference: Recurring Payment/Pause Recurring Payment)

        Args:
          - id (str)
          - **x_idempotency_key (str)
          - **for_user_id (str)
          - **x_api_version (str)

        Returns:
          RecurringPayment

        Raises:
          XenditError

        """
        url = f"/recurring_payments/{id}/resume!"
        headers, body = _extract_params(
            locals(),
            func_object=RecurringPayment.stop,
            headers_params=["for_user_id", "x_idempotency_key", "x_api_version"],
            ignore_params=["id"],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return RecurringPayment(**resp.body)
        else:
            raise XenditError(resp)
コード例 #10
0
    def get_payment(*,
                    payment_id,
                    for_user_id=None,
                    x_api_version=None,
                    **kwargs):
        """Get payment from virtual account (API Reference: Virtual Account/Get Virtual Account Payment

        Args:
          - payment_id (str)

        Returns:
          VirtualAccountPayment

        Raises:
          XenditError
        """
        url = f"/callback_virtual_account_payments/payment_id={payment_id}"
        headers, _ = _extract_params(
            locals(),
            func_object=VirtualAccount.get_payment,
            headers_params=["for_user_id", "x_api_version"],
            ignore_params=["payment_id"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return VirtualAccountPayment(**resp.body)
        else:
            raise XenditError(resp)
コード例 #11
0
    def get(
        *, invoice_id, for_user_id=None, x_api_version=None, **kwargs,
    ):
        """Get Invoice (API Reference: Invoice/Get Invoice)

        Args:
          - invoice_id (str)
          - **for_user_id (str)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          Invoice

        Raises:
          XenditError

        """
        url = f"/v2/invoices/{invoice_id}"
        headers, _ = _extract_params(
            locals(),
            func_object=Invoice.get,
            headers_params=["for_user_id", "x_api_version"],
            ignore_params=["invoice_id"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return Invoice(**resp.body)
        else:
            raise XenditError(resp)
コード例 #12
0
    def get(*, id, for_user_id=None, x_api_version=None, **kwargs):
        """Get the detail of Virtual Account (API Reference: Virtual Account/Get Virtual Account

        Args:
          - id (str)
          - **for_user_id (str) (XenPlatforms only)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          VirtualAccount

        Raises:
          XenditError
        """
        url = f"/callback_virtual_accounts/{id}"
        headers, _ = _extract_params(
            locals(),
            func_object=VirtualAccount.get,
            headers_params=["for_user_id", "x_api_version"],
            ignore_params=["id"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return VirtualAccount(**resp.body)
        else:
            raise XenditError(resp)
コード例 #13
0
ファイル: ewallet.py プロジェクト: xendit/xendit-python
    def get_ewallet_charge_status(
        *,
        charge_id: str,
        for_user_id: str = None,
        **kwargs,
    ):
        """Get ewallet charge status of given charge id (API Reference: eWallets/Get E-Wallet Charge Status)

        Args:
          - charge_id (str)
          - **for_user_id (str) (XenPlatforms only)

        Returns:
          - EWalletCharge

        Raises:
          XenditError

        """
        url = f"/ewallets/charges/{charge_id}"
        headers, body = _extract_params(
            locals(),
            func_object=EWallet.get_ewallet_charge_status,
            headers_params=["for_user_id"],
        )
        kwargs["headers"] = headers

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return EWalletCharge(**resp.body)
        else:
            raise XenditError(resp)
コード例 #14
0
ファイル: balance.py プロジェクト: xendit/xendit-python
    def get(
        *,
        account_type=BalanceAccountType.CASH,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Send GET request to retrieve balance (API Reference: Balance/Get Balance)

        Args:
          - account_type (BalanceAccountType)
          - **for_user_id (str) (XenPlatform only)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns
          Balance

        Raises
          XenditError
        """
        headers, _ = _extract_params(
            locals(),
            func_object=Balance.get,
            headers_params=["for_user_id", "x_api_version"],
        )
        kwargs["headers"] = headers
        account_type = Balance._parse_value(account_type)
        url = f"/balance?account_type={account_type}"

        resp = _APIRequestor.get(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return Balance(**resp.body)
        else:
            raise XenditError(resp)
コード例 #15
0
    def create_promotion(
        *,
        reference_id,
        description,
        start_time,
        end_time,
        promo_code=None,
        bin_list=None,
        channel_code=None,
        discount_percent=None,
        discount_amount=None,
        currency=None,
        max_discount_amount=None,
        min_original_amount=None,
        x_idempotency_key=None,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Send POST Request to create new Promotion (API Reference: Credit Card/Create Promotion)

        Args:
          - reference_id (str)
          - description (str)
          - start_time (str)
          - end_time (str)
          - **promo_code (str)
          - **bin_list (str[])
          - **channel_code (str)
          - **discount_percent (float)
          - **discount_amount (float)
          - **max_discount_amount (float)
          - **min_original_amount (float)
          - **currency (str)
          - **x_idempotency_key (str)
          - **for_user_id (str)
          - **x_api_version (str)

        Returns:
          CreditCardPromotion

        Raises:
          XenditError

        """
        url = "/promotions"
        headers, body = _extract_params(
            locals(),
            func_object=CreditCard.create_promotion,
            headers_params=["for_user_id", "x_idempotency_key", "x_api_version"],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return CreditCardPromotion(**resp.body)
        else:
            raise XenditError(resp)
コード例 #16
0
    def create_charge(
        *,
        token_id,
        external_id,
        amount,
        capture=True,
        authentication_id=None,
        card_cvn=None,
        descriptor=None,
        currency=None,
        mid_label=None,
        billing_details=None,
        promotion=None,
        installment=None,
        x_idempotency_key=None,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Send POST Request to create Credit Card Charge (API Reference: Credit Card/Create Charge)

        Args:
          - token_id (str)
          - external_id (str)
          - amount (float)
          - authentication_id (str)
          - card_cvn (str)
          - **capture (bool)
          - **descriptor (str)
          - **currency (str)
          - **mid_label (str)
          - **billing_details (CreditCardCharge.BillingDetails.Query)
          - **promotion (CreditCardCharge.Promotion.Query)
          - **installment (CreditCardCharge.Installment.Query)
          - **x_idempotency_key (str)
          - **for_user_id (str)
          - **x_api_version (str)

        Returns:
          CreditCardCharge

        Raises:
          XenditError

        """
        url = "/credit_card_charges"
        headers, body = _extract_params(
            locals(),
            func_object=CreditCard.create_charge,
            headers_params=["for_user_id", "x_idempotency_key", "x_api_version"],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return CreditCardCharge(**resp.body)
        else:
            raise XenditError(resp)
コード例 #17
0
    def edit_recurring_payment(
        *,
        id,
        amount=None,
        credit_card_token=None,
        interval=None,
        interval_count=None,
        should_send_email=None,
        invoice_duration=None,
        missed_payment_action=None,
        payment_method_id=None,
        customer_id=None,
        x_idempotency_key=None,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Edit Recurring Payment Data (API Reference: Recurring Payment/Edit Recurring Payment)

        Args:
          - id (str)
          - **amount (int)
          - **credit_card_token (str)
          - **interval (str)
          - **interval_count (int)
          - **should_send_email (bool)
          - **invoice_duration (int)
          - **missed_payment_action (str)
          - **payment_method_id (str)
          - **customer_id (str)
          - **x_idempotency_key (str)
          - **for_user_id (str)
          - **x_api_version (str)

        Returns:
          RecurringPayment

        Raises:
          XenditError

        """
        url = f"/recurring_payments/{id}"
        headers, body = _extract_params(
            locals(),
            func_object=RecurringPayment.edit_recurring_payment,
            headers_params=[
                "for_user_id", "x_idempotency_key", "x_api_version"
            ],
            ignore_params=["id"],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.patch(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return RecurringPayment(**resp.body)
        else:
            raise XenditError(resp)
コード例 #18
0
    def create_payment(
        *,
        cardless_credit_type,
        external_id,
        amount,
        payment_type,
        items,
        customer_details,
        shipping_address,
        redirect_url,
        callback_url,
        x_idempotency_key=None,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Create a cardless credit payment (API Reference: Cardless Credit/Create Payment or Generate Checkout URL)

        Args:
          - cardless_credit_type (CardlessCreditType)
          - external_id (str)
          - amount (int)
          - payment_type (str)
          - items (CardlessCreditItem[])
          - customer_details (CardlessCreditCustomerDetails)
          - shipping_address (CardlessCreditShippingAddress)
          - redirect_url (str)
          - callback_url (str)
          - **for_user_id (str) (XenPlatform only)
          - **x_idempotency_key (str)
          - **x_api_version (str)

        Returns
          CardlessCredit

        Raises
          XenditError

        """
        cardless_credit_type = CardlessCredit._parse_cardless_credit_type(
            cardless_credit_type)
        url = "/cardless-credit"
        headers, body = _extract_params(
            locals(),
            func_object=CardlessCredit.create_payment,
            headers_params=[
                "for_user_id", "x_idempotency_key", "x_api_version"
            ],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return CardlessCreditPayment(**resp.body)
        else:
            raise XenditError(resp)
コード例 #19
0
    def create(
        *,
        external_id,
        bank_code,
        name,
        virtual_account_number=None,
        suggested_amount=None,
        is_closed=None,
        expected_amount=None,
        expiration_date=None,
        is_single_use=None,
        description=None,
        for_user_id=None,
        x_idempotency_key=None,
        x_api_version=None,
        **kwargs,
    ):
        """Send POST Request to create VirtualAccount (API Reference: Virtual Account/Create Virtual Account)

        Args:
          - external_id (str)
          - bank_code (str)
          - name (str)
          - **virtual_account_number (str)
          - **suggested_amount (int)
          - **is_closed (bool)
          - **expected_amount (int)
          - **expiration_date (str) (ISO 8601 Date)
          - **is_single_use (bool)
          - **description (str)
          - **for_user_id (str) (XenPlatforms only)
          - **x_idempotency_key (str)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          VirtualAccount

        Raises:
          XenditError

        """
        url = "/callback_virtual_accounts"
        headers, body = _extract_params(
            locals(),
            func_object=VirtualAccount.create,
            headers_params=[
                "for_user_id", "x_idempotency_key", "x_api_version"
            ],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return VirtualAccount(**resp.body)
        else:
            raise XenditError(resp)
コード例 #20
0
ファイル: direct_debit.py プロジェクト: xendit/xendit-python
    def create_payment(
        *,
        reference_id,
        payment_method_id,
        currency,
        amount,
        callback_url,
        idempotency_key,
        enable_otp=None,
        description=None,
        basket=None,
        metadata=None,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Create a debit to pull funds from the end customer's account
        (API Reference: Direct Debit/Create Direct Debit Payment)

        Args:
          - reference_id (str)
          - payment_method_id (str)
          - currency (str)
          - amount (int)
          - callback_url (str)
          - idempotency_key (str)
          - **enable_otp (bool)
          - **description (str)
          - **basket (DirectDebitBasket[])
          - **metadata (dict)
          - **for_user_id (str)
          - **x_api_version (str)

        Returns:
          DirectDebitPayment

        Raises:
          XenditError

        """
        url = "/direct_debits"
        headers, body = _extract_params(
            locals(),
            func_object=DirectDebit.create_payment,
            headers_params=["for_user_id", "idempotency_key", "x_api_version"],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return DirectDebitPayment(**resp.body)
        else:
            raise XenditError(resp)
コード例 #21
0
    def create(
        *,
        external_id,
        bank_code,
        account_holder_name,
        account_number,
        description,
        amount,
        email_to=[],
        email_cc=[],
        email_bcc=[],
        x_idempotency_key=None,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Send POST Request to create Disbursement (API Reference: Disbursement/Create Disbursement)

        Args:
          - external_id (str)
          - bank_code (str)
          - account_holder_name (str)
          - account_number (str)
          - description (str)
          - amount (int)
          - **email_to (str[])
          - **email_cc (str[])
          - **email_bcc (str[])
          - **for_user_id (str)
          - **x_idempotency_key (str)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          Disbursement

        Raises:
          XenditError

        """
        url = "/disbursements"
        headers, body = _extract_params(
            locals(),
            func_object=Disbursement.create,
            headers_params=["for_user_id", "x_idempotency_key", "x_api_version"],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return Disbursement(**resp.body)
        else:
            raise XenditError(resp)
コード例 #22
0
ファイル: retail_outlet.py プロジェクト: xendit/xendit-python
    def create_fixed_payment_code(
        *,
        external_id,
        retail_outlet_name,
        name,
        expected_amount,
        payment_code=None,
        expiration_date=None,
        is_single_use=None,
        for_user_id=None,
        x_idempotency_key=None,
        x_api_version=None,
        **kwargs,
    ):
        """Send POST Request to create fixed payment code (API Reference: Retail Outlets/Create Fixed Payment Code)

        Args:
          - external_id (str)
          - retail_outlet_name (str)
          - name (str)
          - expected_amount (int)
          - **payment_code (str)
          - **expiration_date (str) (ISO 8601 Date)
          - **is_single_use (bool)
          - **for_user_id (str)
          - **x_idempotency_key (str)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          RetailOutlet

        Raises:
          XenditError

        """
        url = "/fixed_payment_code"
        headers, body = _extract_params(
            locals(),
            func_object=RetailOutlet.create_fixed_payment_code,
            headers_params=[
                "for_user_id", "x_idempotency_key", "x_api_version"
            ],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return RetailOutlet(**resp.body)
        else:
            raise XenditError(resp)
コード例 #23
0
ファイル: ewallet.py プロジェクト: xendit/xendit-python
    def create_ewallet_charge(
        *,
        reference_id: str,
        currency: str,
        amount: int,
        checkout_method: str,
        channel_code: str = None,
        channel_properties: dict = None,
        customer_id: str = None,
        basket: list = None,
        metadata: dict = None,
        for_user_id: str = None,
        with_fee_rule: str = None,
        **kwargs,
    ):
        """Send POST Request to create EWallet Charge (API Reference: eWallets/Create E-Wallet Charge)

        Args:
          - reference_id (str)
          - currency (str)
          - amount (int)
          - checkout_method (str)
          - channel_code (str)
          - channel_properties (dict)
          - customer_id (str)
          - basket (list)
          - metadata (dict)
          - **for_user_id (str) (XenPlatforms only)
          - **with_fee_rule (str) (XenPlatforms only)

        Returns:
          EWalletCharge

        Raises:
          XenditError

        """
        url = "/ewallets/charges"
        headers, body = _extract_params(
            locals(),
            func_object=EWallet.create_ewallet_charge,
            headers_params=["for_user_id", "with_fee_rule"],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return EWalletCharge(**resp.body)
        else:
            raise XenditError(resp)
コード例 #24
0
ファイル: ewallet.py プロジェクト: xendit/xendit-python
    def create_linkaja_payment(
        *,
        external_id,
        phone,
        amount,
        items,
        callback_url,
        redirect_url,
        for_user_id=None,
        x_idempotency_key=None,
        x_api_version=None,
        **kwargs,
    ):
        """Send POST Request to create LinkAja Payment (API Reference: eWallets/Create Payment)

        Args:
          - external_id (str)
          - phone (str)
          - amount (int)
          - items (LinkAjaItem.Query[])
          - callback_url (str)
          - redirect_url (str)
          - **for_user_id (str) (XenPlatforms only)
          - **x_idempotency_key (str)
          - **x_api_version (str)

        Returns:
          LinkAjaPayment

        Raises:
          XenditError

        """
        url = "/ewallets"
        headers, body = _extract_params(
            locals(),
            func_object=EWallet.create_linkaja_payment,
            headers_params=[
                "for_user_id", "x_idempotency_key", "x_api_version"
            ],
        )
        body["ewallet_type"] = "LINKAJA"
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return LinkAjaPayment(**resp.body)
        else:
            raise XenditError(resp)
コード例 #25
0
    def update(
        *,
        id,
        suggested_amount=None,
        expected_amount=None,
        expiration_date=None,
        is_single_use=None,
        description=None,
        for_user_id=None,
        x_idempotency_key=None,
        x_api_version=None,
        **kwargs,
    ):
        """Update Virtual Account detail (API Reference: Virtual Account/Update Virtual Account

        Args:
          - id (str)
          - **suggested_amount (int)
          - **expected_amount (int)
          - **expiration_date (str) (ISO 8601 Date)
          - **is_single_use (bool)
          - **description (str)
          - **for_user_id (str) (XenPlatforms only)
          - **x_idempotency_key (str)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          VirtualAccount

        Raises:
          XenditError
        """
        url = f"/callback_virtual_accounts/{id}"
        headers, body = _extract_params(
            locals(),
            func_object=VirtualAccount.update,
            headers_params=[
                "x_idempotency_key", "for_user_id", "x_api_version"
            ],
            ignore_params=["id"],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.patch(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return VirtualAccount(**resp.body)
        else:
            raise XenditError(resp)
コード例 #26
0
ファイル: direct_debit.py プロジェクト: xendit/xendit-python
    def create_payment_method(
        *,
        customer_id,
        type,
        properties,
        metadata=None,
        x_idempotency_key=None,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Create payment method for making payment
        (API Reference: Direct Debit/Create Payment Method)

        Args:
          - customer_id (str)
          - type (DirectDebitPaymentMethodType)
          - properties (DirectDebitPaymentMethodProperties.Query)
          - **metadata (dict)
          - **x_idempotency_key (str)
          - **for_user_id (str)
          - **x_api_version (str)

        Returns:
          DirectDebitPaymentMethod

        Raises:
          XenditError

        """
        type = DirectDebit._parse_payment_method_type(type)
        url = "/payment_methods"
        headers, body = _extract_params(
            locals(),
            func_object=DirectDebit.create_payment_method,
            headers_params=[
                "for_user_id", "x_idempotency_key", "x_api_version"
            ],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return DirectDebitPaymentMethod(**resp.body)
        else:
            raise XenditError(resp)
コード例 #27
0
ファイル: direct_debit.py プロジェクト: xendit/xendit-python
    def initialize_tokenization(
        *,
        customer_id,
        channel_code,
        properties=None,
        metadata=None,
        x_idempotency_key=None,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Initialize Authorization Process and Account Token Creation
        (API Reference: Direct Debit/Initialize Linked Account Tokenization)

        Args:
          - customer_id (str)
          - channel_code (str)
          - **properties (DirectDebitCardLinking.Query or DirectDebitOnlineBanking.Query)
          - **metadata (dict)
          - **x_idempotency_key (str)
          - **for_user_id (str)
          - **x_api_version (str)

        Returns:
          DirectDebitToken

        Raises:
          XenditError

        """
        url = "/linked_account_tokens/auth"
        headers, body = _extract_params(
            locals(),
            func_object=DirectDebit.initialize_tokenization,
            headers_params=[
                "for_user_id", "x_idempotency_key", "x_api_version"
            ],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return DirectDebitToken(**resp.body)
        else:
            raise XenditError(resp)
コード例 #28
0
    def calculate_payment_type(
        *,
        cardless_credit_type,
        amount,
        items,
        x_idempotency_key=None,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Calculate Payment Types feature helps merchants to get an accurate value of the installment offered to end customers by the cardless credit provider
        (API Reference: Cardless Credit/Calculate Payment Types)

        Args:
          - cardless_credit_type (str)
          - amount (int)
          - items (CardlessCreditItem[])
          - **for_user_id (str) (XenPlatform only)
          - **x_idempotency_key (str)
          - **x_api_version (str)

        Returns
          CardlessCreditPaymentType

        Raises
          XenditError

        """
        cardless_credit_type = CardlessCredit._parse_cardless_credit_type(
            cardless_credit_type)
        url = "/cardless-credit/payment-types"
        headers, body = _extract_params(
            locals(),
            func_object=CardlessCredit.calculate_payment_type,
            headers_params=[
                "for_user_id", "x_idempotency_key", "x_api_version"
            ],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return CardlessCreditPaymentTypeCalculation(**resp.body)
        else:
            raise XenditError(resp)
コード例 #29
0
ファイル: retail_outlet.py プロジェクト: xendit/xendit-python
    def update_fixed_payment_code(
        *,
        fixed_payment_code_id,
        name=None,
        expected_amount=None,
        expiration_date=None,
        for_user_id=None,
        x_idempotency_key=None,
        x_api_version=None,
        **kwargs,
    ):
        """Update fixed payment code (API Reference: Retail Outlets/Update Fixed Payment Code)

        Args:
          - fixed_payment_code_id (str)
          - **name (str)
          - **expected_amount (int)
          - **expiration_date (str) (ISO 8601 Date)
          - **for_user_id (str)
          - **x_idempotency_key (str)
          - **x_api_version (str): API Version that will be used. If not provided will default to the latest

        Returns:
          RetailOutlet

        Raises:
          XenditError

        """
        url = f"/fixed_payment_code/{fixed_payment_code_id}"
        headers, body = _extract_params(
            locals(),
            func_object=RetailOutlet.update_fixed_payment_code,
            headers_params=[
                "for_user_id", "x_idempotency_key", "x_api_version"
            ],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.patch(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return RetailOutlet(**resp.body)
        else:
            raise XenditError(resp)
コード例 #30
0
    def transfers(
        *,
        reference,
        amount,
        source_user_id,
        destination_user_id,
        x_idempotency_key=None,
        for_user_id=None,
        x_api_version=None,
        **kwargs,
    ):
        """Transfers balance from sub-account to main account and vice versa (API Reference: xenPlatform/Transfers)

        Args:
          - reference (str)
          - amount (int)
          - source_user_id (str)
          - destination_user_id (str)
          - **x_idempotency_key (str)
          - **for_user_id (str)
          - **x_api_version (str)

        Returns
          XenPlatformTransfers

        Raises
          XenditError

        """
        url = "/transfers"
        headers, body = _extract_params(
            locals(),
            func_object=XenPlatform.transfers,
            headers_params=[
                "x_idempotency_key", "for_user_id", "x_api_version"
            ],
        )
        kwargs["headers"] = headers
        kwargs["body"] = body

        resp = _APIRequestor.post(url, **kwargs)
        if resp.status_code >= 200 and resp.status_code < 300:
            return XenPlatformTransfers(**resp.body)
        else:
            raise XenditError(resp)