Unable to submit Payment Entry – "Unauthorized" error from Mexico E-Invoicing app #23
Unanswered
andresvizcaya
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Can someone help me solving this problem in ERPNext?, please
Issue Statement:
Unable to submit a Payment Entry (Receive) due to ValidationError: Unauthorized originating from the mexico_einvoice app.
Issue Detailed Description:
We have a customer payment that was received some time ago. The corresponding CFDI Complemento de Pago (payment complement) was already generated and validated with the SAT outside of ERPNext (or in a previous operation). We now need to record the bank receipt in ERPNext as a Payment Entry (type: Receive) to reconcile the customer's balance. However, when we try to submit the Payment Entry, the system throws an Unauthorized error. The traceback points to mexico_einvoice/utils.py, line 249, where the app attempts to generate or validate a complemento de pago with the SAT. Since the complement already exists (or we do not want to generate a new one), the SAT web service likely returns an error (e.g., duplicate, already paid, or not allowed), which the app interprets as "Unauthorized".
Steps to Replicate the issue:
Current behavior:
The system prevents the Payment Entry from being submitted, returning a ValidationError: Unauthorized with a full traceback pointing to the mexico_einvoice app's update_payment method. The payment is not recorded in the general ledger.
Expected behavior:
The Payment Entry should be submitted successfully without triggering the generation of a new Complemento de Pago, because the complement already exists externally. The accounting entry should be recorded (debit bank, credit customer) without contacting the SAT for validation or creation of a new CFDI complement.
Supporting Screenshots/documents/videos/dashboard links:
File "apps/mexico_einvoice/mexico_einvoice/utils.py", line 249, in update_payment
frappe.throw(_(response.get("message")))
frappe.exceptions.ValidationError: Unauthorized
Beta Was this translation helpful? Give feedback.
All reactions