libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 92829a9d53a2605882b2747ea217fd01e5030256
parent 7cdd0d203f2c43b293a32ec116a5fb8efe076137
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Tue,  3 Mar 2020 16:58:01 +0100

Python logic to prepare payments.

Diffstat:
Msandbox/src/main/python/libeufin-cli | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+), 0 deletions(-)

diff --git a/sandbox/src/main/python/libeufin-cli b/sandbox/src/main/python/libeufin-cli @@ -570,6 +570,67 @@ def prepare(ctx, account_id, nexus_base_url): ctx.invoke(hia, account_id=account_id, nexus_base_url=nexus_base_url) ctx.invoke(sync, account_id=account_id, nexus_base_url=nexus_base_url) + +@ebics.command(help="Prepare a payment") +@click.pass_context +@click.option( + "--account-id", + help="Numerical ID of the customer at the Nexus", + required=True +) +@click.option( + "--bank-account-id", + help="Token that identifies one bank account belonging to --account-id", + required=True +) +@click.option( + "--creditor-iban", + help="IBAN of the creditor", + required=True +) +@click.option( + "--creditor-bic", + help="BIC of the creditor", + required=True +) +@click.option( + "--creditor-name", + help="First and last name of the creditor", + required=True +) +@click.option( + "--subject", + help="subject line of the payment", + required=True +) +@click.option( + "--sum", + help="amount to pay, in the form XY[.UW], no currency needed (for now)", + required=True +) +@click.argument( + "nexus-base-url" +) +def prepare_payment( + ctx, account_id, bank_account_id, creditor_iban, + creditor_bic, creditor_name, subject, amount, nexus_base_url): + nexus_url = urljoin( + nexus_base_url, "/ebics/subscribers/{}/accounts/{}/prepare-payment".format( + account_id, bank_account_id)) + body = dict( + ebicsURL=ebics_url, + userID=user_id, + partnerID=partner_id, + hostID=host_id + ) + try: + resp = post(nexus_url, json=body) + except Exception: + print("Could not reach the Nexus") + return + + print(resp.content.decode("utf-8")) + @ebics.command(help="Send HTD message") @click.pass_context @click.option(