Repository navigation
fix: name the real reason a retry collected nothing, and report the send honestly - #61
Merged
Merged
Conversation
…end honestly
Two faults, both about telling the operator something untrue.
1. "Nothing to retry: the subscription is not due, or has no stored card."
That single sentence covered four unrelated situations, so it did not tell the
operator anything. They had to work out which one applied — and one of the four
is fixable from this very screen, which the wording hid.
The four are now named, each with the reference and what would change the
answer:
not due until <date> -> nothing to do; collected automatically
no stored card -> send an update-card link, then retry
no next payment date -> check the feed's billing cycle
cancelled/expired/pending -> reactivate first
not a subscription -> no renewal to collect
`GF_Chip_Renewals::blocking_reason()` returns which one, and `is_due()` is now
`null === blocking_reason()`, so the two cannot drift apart. The classifier
tests conditions in the order the charge path refuses in, so the reason
reported is the reason that would actually stop the charge — reporting a later
one would name a cause that is not the cause. A missing token is checked before
the date for that reason: a subscription with no card is the one case the
operator can fix here, and it must not be reported as "not due yet".
The date is shown in the site's timezone, not the raw UTC that is stored.
2. "Send update-card link" always reported success.
The handler redirected with `&sent=<id>` whether or not the mail left, and the
notice was printed from that flag alone. A refused recipient and a refused send
were indistinguishable from a success. It now captures the return value, and a
failure redirects to a distinct error notice instead.
Verified on a live install. Clicking Retry on a subscription not due until the
next day now reports:
Nothing to do yet (#93): the next payment is not due until 2026-09-26
01:59 (+00:00). It will be collected automatically — press Retry only if
you want to charge it before then.
## Potential Risks & Review Items
- The message is still a display of redirect parameters, so the nonce-ignore
annotations stay. Nothing from the request is echoed: the reason is matched
against the known set and the id is cast to int, so an unknown reason falls
through to a generic sentence rather than printing the supplied value.
- `blocking_reason()` is public because the handler and the notice both need
it. It is pure, so it stays directly testable.
- The wording is longer than before. That is the fix: the old one was short
because it was not saying anything specific. It remains a single sentence.
- A unit test cannot reach `wp_date()` or the site timezone, so the notice text
is pinned by direct reflection on `skipped_message()`, and the rendering was
confirmed on a live install.
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.
fix: name the real reason a retry collected nothing, and report the send honestly
Two faults, both about telling the operator something untrue.
That single sentence covered four unrelated situations, so it did not tell the
operator anything. They had to work out which one applied — and one of the four
is fixable from this very screen, which the wording hid.
The four are now named, each with the reference and what would change the
answer:
GF_Chip_Renewals::blocking_reason()returns which one, andis_due()is nownull === blocking_reason(), so the two cannot drift apart. The classifiertests conditions in the order the charge path refuses in, so the reason
reported is the reason that would actually stop the charge — reporting a later
one would name a cause that is not the cause. A missing token is checked before
the date for that reason: a subscription with no card is the one case the
operator can fix here, and it must not be reported as "not due yet".
The date is shown in the site's timezone, not the raw UTC that is stored.
The handler redirected with
&sent=<id>whether or not the mail left, and thenotice was printed from that flag alone. A refused recipient and a refused send
were indistinguishable from a success. It now captures the return value, and a
failure redirects to a distinct error notice instead.
Verified on a live install. Clicking Retry on a subscription not due until the
next day now reports:
Potential Risks & Review Items
annotations stay. Nothing from the request is echoed: the reason is matched
against the known set and the id is cast to int, so an unknown reason falls
through to a generic sentence rather than printing the supplied value.
blocking_reason()is public because the handler and the notice both needit. It is pure, so it stays directly testable.
because it was not saying anything specific. It remains a single sentence.
wp_date()or the site timezone, so the notice textis pinned by direct reflection on
skipped_message(), and the rendering wasconfirmed on a live install.