diag(gocardless): summarise the failing transaction when a mandate cannot be saved#231
Open
0spinboson wants to merge 1 commit into
Open
Conversation
When create_mandate() cannot persist a GoCardless Mandate, future payments stop reusing it and re-prompt the payer (frappe#89). Frappe already captures the traceback, but the failing transaction is buried in a locals dump. Add a readable summary line (mandate id, reference document, customer, gocardless_customer) above the traceback so the Error Log entry is actionable on its own. Test drives a forced create_mandate() failure and asserts the summary is logged. No behavioural change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
When a GoCardless payment completes and the customer approves a new mandate,
gocardless_confirmation.create_mandate()persists a localGoCardless Mandaterecord. That record is what later payments look up to charge the customer
off-session instead of asking them to authorise a mandate again.
If that insert fails, it is caught and logged, but the payment itself still
succeeds (the first charge goes through the redirect-flow mandate id directly),
so the failure is invisible until a later payment re-prompts the customer
(#89). When investigating such reports, the existing log entry is
not enough: Frappe captures a traceback, but the failing transaction (which
Payment Request, which customer, which mandate) is buried in a variable dump.
What
Add a readable summary line above the traceback in the failure log: the mandate
id, the reference document, the customer, and the GoCardless customer id. The
Error Log entry is then actionable on its own.
No behavioural change. A test drives a forced
create_mandate()failure andasserts the summary is recorded.
Refs #89