Skip to content

Commit

Permalink
OM-150 Added return url for mpay payment
Browse files Browse the repository at this point in the history
  • Loading branch information
malinowskikam committed Apr 8, 2024
1 parent 9177cc7 commit ec2a3d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions msystems/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"mpay_config": {
"url": "",
"payment_path": "service/pay",
"bill_path": "front/bills/bill",
"service_id": "SERVICE1",
# The same as mpass cert
"service_certificate": "",
Expand Down
6 changes: 5 additions & 1 deletion msystems/views/mpay.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import decimal
import logging
from functools import reduce

from lxml import etree
from django.db import transaction
Expand Down Expand Up @@ -217,6 +218,9 @@ def mpay_bill_payment_redirect(request):
if not bill:
return HttpResponseNotFound()

host = f"{request.scheme}://{request.get_host()}/"
bill_path = f"{MsystemsConfig.mpay_config['bill_path']}/{bill_id}/"
redirect_back_url = urljoin(host, bill_path)
redirect_url = urljoin(MsystemsConfig.mpay_config['url'], MsystemsConfig.mpay_config['payment_path'])
query = f"OrderKey={bill.code}&ServiceID={MsystemsConfig.mpay_config['service_id']}"
query = f"OrderKey={bill.code}&ServiceID={MsystemsConfig.mpay_config['service_id']}&ReturnUrl={redirect_back_url}"
return redirect(f"{redirect_url}?{query}")

0 comments on commit ec2a3d6

Please sign in to comment.