fix: braintree payment processed twice (#27300)

This commit is contained in:
Subin Tom 2021-09-03 12:30:57 +05:30 committed by GitHub
parent 98696c0ec9
commit 798b464ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -549,3 +549,11 @@ def make_payment_order(source_name, target_doc=None):
}, target_doc, set_missing_values) }, target_doc, set_missing_values)
return doclist return doclist
def validate_payment(doc, method=""):
if not frappe.db.has_column(doc.reference_doctype, 'status'):
return
status = frappe.db.get_value(doc.reference_doctype, doc.reference_docname, 'status')
if status == 'Paid':
frappe.throw(_("The Payment Request {0} is already paid, cannot process payment twice").format(doc.reference_docname))

View File

@ -317,6 +317,9 @@ doc_events = {
}, },
"Company": { "Company": {
"on_trash": "erpnext.regional.india.utils.delete_gst_settings_for_company" "on_trash": "erpnext.regional.india.utils.delete_gst_settings_for_company"
},
"Integration Request": {
"validate": "erpnext.accounts.doctype.payment_request.payment_request.validate_payment"
} }
} }