diff --git a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js index 6915c5c5..eb2847e3 100644 --- a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js +++ b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js @@ -1,8 +1,17 @@ // Copyright (c) 2016, Frappe Technologies and contributors // For license information, please see license.txt -frappe.ui.form.on('Razorpay Settings', { - refresh: function(frm) { - } -}); \ No newline at end of file +frappe.ui.form.on("Razorpay Settings", { + 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 ebf16056..5dd2bfa3 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): """