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.
Fixes #302 and #312. Also some other bugs like missing metadata on captured orders paid via saved card (making impossible to refund).
There was lots of mess in the payment handling, duplicated code in different places (sometimes missing some things), etc. I tried to improve it a bit by extracting some things to traits.
The order state/messages should now match the behavior suggested by @Chaithi.
The only thing that I am not sure is when we have
intent=CAPTURE
and get a capture withFAILED
status, maybe we need to make orderfailed
and show some error? I am not sure when such status can occur.Also we now always add an order note with the status and status details when we get a capture/authorization with details. As I understand besides
PENDING
we may get details for declined payments.For #312 it is more like a quick fix.
As I mentioned it #305
We should figure out if it is actually possible to have multiple authorizations here, and decide how we need to handle them, or (if only single authorization is possible) simplify this part.
For now the order state is decided using the capture of the last captureable authorization in the list.