Skip to content

diag(gocardless): summarise the failing transaction when a mandate cannot be saved#231

Open
0spinboson wants to merge 1 commit into
frappe:developfrom
nlvegan:diag/gocardless-mandate-creation-context
Open

diag(gocardless): summarise the failing transaction when a mandate cannot be saved#231
0spinboson wants to merge 1 commit into
frappe:developfrom
nlvegan:diag/gocardless-mandate-creation-context

Conversation

@0spinboson

Copy link
Copy Markdown

Why

When a GoCardless payment completes and the customer approves a new mandate,
gocardless_confirmation.create_mandate() persists a local GoCardless Mandate
record. 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 and
asserts the summary is recorded.

Refs #89

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant