コード例 #1
0
 def __request_spending_money(self):
     endpoint.RequestInquiry.create(
         object_.Amount(self.__SPENDING_MONEY_AMOUNT, self.__CURRENCY_EUR),
         object_.Pointer(self._POINTER_EMAIL,
                         self.__SPENDING_MONEY_RECIPIENT),
         self.__REQUEST_SPENDING_DESCRIPTION, False)
     endpoint.RequestInquiry.create(
         object_.Amount(self.__SPENDING_MONEY_AMOUNT, self.__CURRENCY_EUR),
         object_.Pointer(self._POINTER_EMAIL,
                         self.__SPENDING_MONEY_RECIPIENT),
         self.__REQUEST_SPENDING_DESCRIPTION, False,
         self._second_monetary_account.id_)
コード例 #2
0
def run():
    api_context = context.ApiContext.restore()
    request_map = {
        endpoint.RequestInquiry.FIELD_AMOUNT_INQUIRED:
        object_.Amount(_REQUEST_AMOUNT, _REQUEST_CURRENCY),
        endpoint.RequestInquiry.FIELD_COUNTERPARTY_ALIAS:
        object_.Pointer(_COUNTERPARTY_POINTER_TYPE, _COUNTERPARTY_EMAIL),
        endpoint.RequestInquiry.FIELD_DESCRIPTION:
        _REQUEST_DESCRIPTION,
        endpoint.RequestInquiry.FIELD_ALLOW_BUNQME:
        True,
    }
    request_id = endpoint.RequestInquiry.create(
        api_context, request_map, _USER_ITEM_ID,
        _MONETARY_ACCOUNT_ITEM_ID).value
    print(
        endpoint.RequestInquiry.get(api_context, _USER_ITEM_ID,
                                    _MONETARY_ACCOUNT_ITEM_ID,
                                    request_id).value.to_json())

    request_update_map = {
        endpoint.RequestInquiry.FIELD_STATUS: _STATUS_REVOKED,
    }
    print(
        endpoint.RequestInquiry.update(api_context, request_update_map,
                                       _USER_ITEM_ID,
                                       _MONETARY_ACCOUNT_ITEM_ID,
                                       request_id).value.to_json())
コード例 #3
0
def run():
    api_context = context.ApiContext.restore()
    request_map = {
        endpoint.PaymentBatch.FIELD_PAYMENTS: [
            {
                endpoint.Payment.FIELD_AMOUNT: object_.Amount(
                    _PAYMENT_AMOUNT,
                    _PAYMENT_CURRENCY),
                endpoint.Payment.FIELD_COUNTERPARTY_ALIAS: object_.Pointer(
                    _COUNTERPARTY_POINTER_TYPE,
                    _COUNTERPARTY_EMAIL
                ),
                endpoint.Payment.FIELD_DESCRIPTION: _PAYMENT_DESCRIPTION,
            }
        ]
    }

    payment_id = endpoint.PaymentBatch.create(
        api_context,
        request_map,
        _USER_ITEM_ID,
        _MONETARY_ACCOUNT_ITEM_ID
    ).value

    print(
        endpoint.PaymentBatch.get(
            api_context,
            _USER_ITEM_ID,
            _MONETARY_ACCOUNT_ITEM_ID,
            payment_id
        ).value.to_json()
    )
コード例 #4
0
    def _create_payment(self):
        """
        :rtype: None
        """

        endpoint.Payment.create(
            object_.Amount(self._PAYMENT_AMOUNT_EUR, self._PAYMENT_CURRENCY),
            self._get_pointer_bravo(), self._PAYMENT_DESCRIPTION)
コード例 #5
0
    def test_payment_to_other_account(self):
        """
        Tests making a payment to another monetary account of the same user

        This test has no assertion as of its testing to see if the code runs
        without errors
        """

        endpoint.Payment.create(
            object_.Amount(self._PAYMENT_AMOUNT_EUR, self._PAYMENT_CURRENCY),
            self._get_alias_second_account(), self._PAYMENT_DESCRIPTION)
コード例 #6
0
    def test_payment_to_other_user(self):
        """
        Tests making a payment to another sandbox user

        This test has no assertion as of its testing to see if the code runs
        without errors
        """

        endpoint.Payment.create(
            object_.Amount(self._PAYMENT_AMOUNT_EUR, self._PAYMENT_CURRENCY),
            self._get_pointer_bravo(), self._PAYMENT_DESCRIPTION)
コード例 #7
0
    def _create_payment_request_map(self, account_to, amount):
        """Creates a request map for an IBAN -> IBAN transaction with a
        given (absolute) amount (in EUR)
        """
        request_map = {
            generated.Payment.FIELD_AMOUNT:
            object_.Amount(abs(amount), 'EUR'),
            generated.Payment.FIELD_COUNTERPARTY_ALIAS:
            object_.Pointer('IBAN', util.get_iban(account_to)),
            generated.Payment.FIELD_DESCRIPTION:
            self._SAVING_PAYMENT_DESCRIPTION,
        }

        request_map[generated.Payment.FIELD_COUNTERPARTY_ALIAS].name = \
            util.get_attr_from_alias(account_to, 'name', 'IBAN')

        return request_map
コード例 #8
0
    def __create_payment_list(self) -> List[endpoint.Payment]:
        """
        :rtype: List[Payment]
        """

        all_payment = []

        while len(all_payment) < self._MAXIMUM_PAYMENT_IN_BATCH:
            all_payment.append(
                endpoint.Payment(
                    object_.Amount(self._PAYMENT_AMOUNT_EUR,
                                   self._PAYMENT_CURRENCY),
                    object_.Pointer(self._POINTER_EMAIL, self._EMAIL_BRAVO),
                    self._PAYMENT_DESCRIPTION))

        self.assertIsInstance(all_payment, List)
        self.assertIsInstance(all_payment[0], endpoint.Payment)
        return all_payment
コード例 #9
0
def make_payment_to_iban(acct_id,
                         to_iban,
                         to_name,
                         amount,
                         description='Subsidy Service payment'):
    counterparty = object_.Pointer(type_='IBAN', value=to_iban, name=to_name)
    amt = object_.Amount(value=str(amount), currency=CURRENCY)

    try:
        response = endpoint.Payment.create(
            amt,
            counterparty,
            description,
            monetary_account_id=acct_id,
        )

    except Exception as e:
        raise _convert_exception(e)

    pmt = endpoint.Payment.get(response.value, acct_id).value

    return payment_summary(pmt)
コード例 #10
0
def run():
    api_context = context.ApiContext.restore()
    request_map = {
        endpoint.Payment.FIELD_AMOUNT:
        object_.Amount(_PAYMENT_AMOUNT, _PAYMENT_CURRENCY),
        endpoint.Payment.FIELD_COUNTERPARTY_ALIAS:
        object_.Pointer(_COUNTERPARTY_POINTER_TYPE, _COUNTERPARTY_EMAIL),
        endpoint.Payment.FIELD_DESCRIPTION:
        _PAYMENT_DESCRIPTION,
    }

    payment_id = endpoint.Payment.create(api_context, request_map,
                                         _USER_ITEM_ID,
                                         _MONETARY_ACCOUNT_ITEM_ID).value

    print(
        endpoint.Payment.get(api_context, _USER_ITEM_ID,
                             _MONETARY_ACCOUNT_ITEM_ID,
                             payment_id).value.to_json())

    # Save the API context to account for all the changes that might have occurred to it during the example execution
    api_context.save()