From 1c3e0ae94f3610fe539e8446a1122d2ab0fcc7d8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 25 Oct 2024 14:44:39 +0530 Subject: [PATCH 1/3] refactor: clear API details --- .../doctype/razorpay_settings/razorpay_settings.py | 7 +++++++ 1 file changed, 7 insertions(+) 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): """ From dc92db56037e1918d0127a19e8b4e6a00ffa91fa Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 25 Oct 2024 14:51:02 +0530 Subject: [PATCH 2/3] refactor: UI to clear razorpay api details --- .../doctype/razorpay_settings/razorpay_settings.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js index 00a5ec9c..04057e7a 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(); + }, + }); + }); + }, }); From 80272ceb66d6737c10fba22faeee7e44438d0a63 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 28 Oct 2024 10:24:22 +0530 Subject: [PATCH 3/3] chore: translatable label --- .../doctype/razorpay_settings/razorpay_settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js index 04057e7a..71fe56e2 100644 --- a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js +++ b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.js @@ -3,7 +3,7 @@ frappe.ui.form.on("Razorpay Settings", { refresh: function (frm) { - frm.add_custom_button("Clear", function () { + frm.add_custom_button(__("Clear"), function () { frm.call({ doc: frm.doc, method: "clear",