Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle denied authorization #313

Merged
merged 13 commits into from
Oct 7, 2021
Merged

Handle denied authorization #313

merged 13 commits into from
Oct 7, 2021

Conversation

AlexP11223
Copy link
Contributor

@AlexP11223 AlexP11223 commented Oct 7, 2021

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 with FAILED status, maybe we need to make order failed 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

The logic in this part is a bit complex because theoretically it is possible that there are multiple authorizations. I don't know if it is actually possible, but that's how it was handled before.

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.

@AlexP11223 AlexP11223 requested a review from Dinamiko October 7, 2021 08:33
@Dinamiko Dinamiko merged commit 229d950 into trunk Oct 7, 2021
@Dinamiko Dinamiko deleted the handle-denied-authorization branch October 7, 2021 10:54
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.

Handle denied payment authorization
2 participants