fix: show descriptive message for missing fields

This commit is contained in:
Mangesh-Khairnar 2020-10-23 13:38:55 +05:30
parent ed1553ea81
commit e03a02d9c0
3 changed files with 7 additions and 4 deletions

View File

@ -127,6 +127,7 @@ class TestPaymentRequest(unittest.TestCase):
recipient_id="nabin@erpnext.com", return_doc=1)
pr1.grand_total = 200
pr1.submit()
pr1.set_as_paid()
# Make a 2nd Payment Request
pr2 = make_payment_request(dt="Sales Order", dn=so.name,

View File

@ -13,7 +13,9 @@ frappe.ui.form.on('Mpesa Settings', {
},
get_account_balance: function(frm) {
if (!frm.initiator_name && !frm.security_credentials) return;
if (!frm.initiator_name && !frm.security_credentials) {
frappe.throw(__("Please set the initiator name and the security credential"));
}
frappe.call({
method: "get_account_balance_info",
doc: frm.doc

View File

@ -10,7 +10,7 @@ from erpnext.accounts.doctype.pos_invoice.test_pos_invoice import create_pos_inv
class TestMpesaSettings(unittest.TestCase):
def test_creation_of_payment_gateway(self):
mpesa_doc = create_mpesa_settings(payment_gateway_name="_Test")
create_mpesa_settings(payment_gateway_name="_Test")
mode_of_payment = frappe.get_doc("Mode of Payment", "Mpesa-_Test")
self.assertTrue(frappe.db.exists("Payment Gateway Account", {'payment_gateway': "Mpesa-_Test"}))
@ -41,7 +41,7 @@ class TestMpesaSettings(unittest.TestCase):
}))
def test_processing_of_callback_payload(self):
mpesa_doc = create_mpesa_settings(payment_gateway_name="Payment")
create_mpesa_settings(payment_gateway_name="Payment")
mpesa_account = frappe.db.get_value("Payment Gateway Account", {"payment_gateway": 'Mpesa-Payment'}, "payment_account")
frappe.db.set_value("Account", mpesa_account, "account_currency", "KES")
@ -73,7 +73,7 @@ def create_mpesa_settings(payment_gateway_name="Express"):
if frappe.db.exists("Mpesa Settings", payment_gateway_name):
return frappe.get_doc("Mpesa Settings", payment_gateway_name)
doc = frappe.get_doc(dict(
doc = frappe.get_doc(dict( #nosec
doctype="Mpesa Settings",
payment_gateway_name=payment_gateway_name,
consumer_key="5sMu9LVI1oS3oBGPJfh3JyvLHwZOdTKn",