feat: payment gateway settings

This commit is contained in:
Jannat Patel
2024-09-25 10:50:53 +05:30
parent e0f569c382
commit 35a7cce283
4 changed files with 38 additions and 7 deletions

View File

@@ -335,15 +335,15 @@
},
{
"fieldname": "payment_gateway",
"fieldtype": "Select",
"fieldtype": "Link",
"label": "Payment Gateway",
"options": "Razorpay\nMpesa\nPaytm\nBraintree\nStripe\nPaypal\nGoCardless"
"options": "Payment Gateway"
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-09-24 18:09:25.366651",
"modified": "2024-09-24 19:55:47.914930",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Settings",

View File

@@ -22,6 +22,12 @@ def get_payment_link(doctype, docname, amount, total_amount, currency, address):
amount_with_gst = total_amount if total_amount != amount else 0
payment = record_payment(address, doctype, docname, amount, currency, amount_with_gst)
controller = get_controller(payment_gateway)
if controller.doctype == "Stripe Settings":
print(controller.as_dict())
doctype = "Stripe Settings"
docname = controller.name
payment_details = {
"amount": total_amount,
@@ -37,7 +43,7 @@ def get_payment_link(doctype, docname, amount, total_amount, currency, address):
"redirect_to": f"/lms/batches/{docname}",
"payment": payment.name,
}
controller = get_controller(payment_gateway)
print(controller)
url = controller.get_payment_url(**payment_details)
return url