fix: update integrations desk page (#23767)

* fix: update integrations desk page

* fix: setup dashboard after receiving API callback

Co-authored-by: Marica <maricadsouza221197@gmail.com>
This commit is contained in:
Mangesh-Khairnar 2020-11-04 12:48:33 +05:30 committed by GitHub
parent 1354aecafa
commit 2df2b2f351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -8,7 +8,7 @@
{ {
"hidden": 0, "hidden": 0,
"label": "Payments", "label": "Payments",
"links": "[\n {\n \"description\": \"GoCardless payment gateway settings\",\n \"label\": \"GoCardless Settings\",\n \"name\": \"GoCardless Settings\",\n \"type\": \"doctype\"\n }\n]" "links": "[\n {\n \"description\": \"GoCardless payment gateway settings\",\n \"label\": \"GoCardless Settings\",\n \"name\": \"GoCardless Settings\",\n \"type\": \"doctype\"\n }, {\n \"description\": \"M-Pesa payment gateway settings\",\n \"label\": \"M-Pesa Settings\",\n \"name\": \"Mpesa Settings\",\n \"type\": \"doctype\"\n }\n]"
}, },
{ {
"hidden": 0, "hidden": 0,
@ -29,7 +29,7 @@
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "ERPNext Integrations", "label": "ERPNext Integrations",
"modified": "2020-08-23 16:30:51.494655", "modified": "2020-10-29 19:54:46.228222",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "ERPNext Integrations", "module": "ERPNext Integrations",
"name": "ERPNext Integrations", "name": "ERPNext Integrations",

View File

@ -9,11 +9,12 @@ frappe.ui.form.on('Mpesa Settings', {
refresh: function(frm) { refresh: function(frm) {
frappe.realtime.on("refresh_mpesa_dashboard", function(){ frappe.realtime.on("refresh_mpesa_dashboard", function(){
frm.reload_doc(); frm.reload_doc();
frm.events.setup_account_balance_html(frm);
}); });
}, },
get_account_balance: function(frm) { get_account_balance: function(frm) {
if (!frm.initiator_name && !frm.security_credentials) { if (!frm.doc.initiator_name && !frm.doc.security_credential) {
frappe.throw(__("Please set the initiator name and the security credential")); frappe.throw(__("Please set the initiator name and the security credential"));
} }
frappe.call({ frappe.call({

View File

@ -147,7 +147,7 @@ def get_account_balance(request_payload):
return response return response
except Exception: except Exception:
frappe.log_error(title=_("Account Balance Processing Error")) frappe.log_error(title=_("Account Balance Processing Error"))
frappe.throw(title=_("Error"), message=_("Please check your configuration and try again")) frappe.throw(_("Please check your configuration and try again"), title=_("Error"))
@frappe.whitelist(allow_guest=True) @frappe.whitelist(allow_guest=True)
def process_balance_info(**kwargs): def process_balance_info(**kwargs):
@ -173,7 +173,8 @@ def process_balance_info(**kwargs):
ref_doc.db_set("account_balance", balance_info) ref_doc.db_set("account_balance", balance_info)
request.handle_success(account_balance_response) request.handle_success(account_balance_response)
frappe.publish_realtime("refresh_mpesa_dashboard") frappe.publish_realtime("refresh_mpesa_dashboard", doctype="Mpesa Settings",
docname=transaction_data.reference_docname, user=transaction_data.owner)
except Exception: except Exception:
request.handle_failure(account_balance_response) request.handle_failure(account_balance_response)
frappe.log_error(title=_("Mpesa Account Balance Processing Error"), message=account_balance_response) frappe.log_error(title=_("Mpesa Account Balance Processing Error"), message=account_balance_response)