diff --git a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js index 00a5ec9c..71fe56e2 100644 --- a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js +++ b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js @@ -2,5 +2,15 @@ // For license information, please see license.txt frappe.ui.form.on("Razorpay Settings", { - refresh: function (frm) {}, + refresh: function (frm) { + frm.add_custom_button(__("Clear"), function () { + frm.call({ + doc: frm.doc, + method: "clear", + callback: function (r) { + frm.refresh(); + }, + }); + }); + }, }); diff --git a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py index d86627d8..4e77afd8 100644 --- a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py +++ b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py @@ -362,6 +362,13 @@ def verify_signature(self, body, signature, key): return result + @frappe.whitelist() + def clear(self): + self.api_key = self.api_secret = None + self.redirect_url = None + self.flags.ignore_mandatory = True + self.save() + def capture_payment(is_sandbox=False, sanbox_response=None): """