feat: payment gateway settings
This commit is contained in:
@@ -113,6 +113,12 @@ const tabsStructure = computed(() => {
|
||||
description:
|
||||
'Configure the payment gateway and other payment related settings',
|
||||
fields: [
|
||||
{
|
||||
label: 'Payment Gateway',
|
||||
name: 'payment_gateway',
|
||||
type: 'Link',
|
||||
doctype: 'Payment Gateway',
|
||||
},
|
||||
{
|
||||
label: 'Razorpay Key',
|
||||
name: 'razorpay_key',
|
||||
@@ -254,6 +260,24 @@ const tabs = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
const paymentGateways = computed(() => {
|
||||
const gateways = [
|
||||
'Razorpay',
|
||||
'Stripe',
|
||||
'Mpesa',
|
||||
'Patym',
|
||||
'Paypal',
|
||||
'Braintree',
|
||||
'GoCardless',
|
||||
]
|
||||
return gateways.map((gateway) => {
|
||||
return {
|
||||
label: gateway,
|
||||
value: gateway,
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
watch(show, async () => {
|
||||
if (show.value) {
|
||||
const currentTab = await tabs.value
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
v-if="field.type == 'Link'"
|
||||
v-model="field.value"
|
||||
:doctype="field.doctype"
|
||||
:label="field.label"
|
||||
:label="__(field.label)"
|
||||
/>
|
||||
|
||||
<Codemirror
|
||||
v-else-if="field.type == 'Code'"
|
||||
v-model:value="field.value"
|
||||
:label="field.label"
|
||||
:label="__(field.label)"
|
||||
:height="200"
|
||||
:options="{
|
||||
mode: field.mode,
|
||||
@@ -40,9 +40,10 @@
|
||||
v-else
|
||||
:key="field.name"
|
||||
v-model="field.value"
|
||||
:label="field.label"
|
||||
:label="__(field.label)"
|
||||
:type="field.type"
|
||||
:rows="field.rows"
|
||||
:options="field.options"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user