From 2f65aa6246954eeb8a45af1e03090d1d0e3c8245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= Date: Wed, 1 Jan 2025 02:23:59 +0000 Subject: [PATCH] chore: initial tentative support for mbway --- src/easypay/payment.py | 11 ++++++++++- src/examples/app_v2.py | 9 ++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/easypay/payment.py b/src/easypay/payment.py index 0e2413b..e6f5f6e 100644 --- a/src/easypay/payment.py +++ b/src/easypay/payment.py @@ -34,7 +34,14 @@ class PaymentAPI(object): def generate_payment( - self, amount, method="mb", currency="EUR", key=None, warning=None, cancel=None + self, + amount, + method="mb", + currency="EUR", + key=None, + customer=None, + warning=None, + cancel=None, ): result = self.create_payment(amount, method=method, currency=currency, key=key) status = result.get("status", "error") @@ -47,6 +54,8 @@ def generate_payment( method["currency"] = currency method["warning"] = warning method["cancel"] = cancel + if not customer == None: + method["customer"] = customer self.set_payment(method) return method diff --git a/src/examples/app_v2.py b/src/examples/app_v2.py index 94125e7..8a91ecf 100644 --- a/src/examples/app_v2.py +++ b/src/examples/app_v2.py @@ -75,10 +75,17 @@ def create_payment(self): amount = self.field("amount", 10, cast=float) method = self.field("method", "mb") key = self.field("key", None) + phone = self.field("phone", None) warning = self.field("warning", None, cast=float) cancel = self.field("cancel", None, cast=float) + customer = dict(phone=phone) if phone else None return self.api.generate_payment( - amount=amount, method=method, key=key, warning=warning, cancel=cancel + amount=amount, + method=method, + key=key, + customer=customer, + warning=warning, + cancel=cancel, ) @appier.route("/payments/show/", "GET")