refactor: set_as_failed method on Payment Request #40598
Closed
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.
This PR removes the
set_failed
method from the Payment Request Doctype, which did nothing and was referenced nowhere.It replaces the
set_failed
method with aset_as_failed
method which corresponds generally to the existingset_as_cancelled
andset_as_paid
methods, with the notable difference that it accepts areason
parameter which populates the recently-introducedfailed_reason
field.This is somewhat related to my recent PR#75 on the payments app which attempts to incorporate payment status from GoCardless webhooks, including updating the
failed_reason
field, where applicable. In that PR I utilize the existingset_as_cancelled
andset_as_paid
methods for those actions, but have created a manual workaround for the absence of aset_as_failed
method. It would be nice to have this consolidated eventually.