Skip to content

Commit

Permalink
chore: initial tentative support for mbway
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jan 1, 2025
1 parent 9d1d17c commit 2f65aa6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/easypay/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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

Expand Down
9 changes: 8 additions & 1 deletion src/examples/app_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<str:id>", "GET")
Expand Down

0 comments on commit 2f65aa6

Please sign in to comment.