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

[RFC] Support for authorized payments #392

Open
Nek- opened this issue Nov 8, 2022 · 0 comments
Open

[RFC] Support for authorized payments #392

Nek- opened this issue Nov 8, 2022 · 0 comments

Comments

@Nek-
Copy link
Contributor

Nek- commented Nov 8, 2022

Hello,

I figured out that authorized payments seem to be really not supported by the refund plugin.

Let me explain more precisely:


 Order checkout
┌────────────────────────┐                    ┌──────────────────────────┐
│                        │                    │                          │
│ Payment by card        │                    │     Order                │ Refund will fail
│ (stripe for me)        ├────────────────────►     (state: new)         ├─────────►
│ NOT captured           │                    │                          │
└────────────────────────┘                    └───────────┬──────────────┘
                                                          │
                                                          │ Human action:
                                                          │ stock verification etc
                                              ┌───────────▼──────────────┐
                                              │                          │
                                              │    Order                 │
                                              │    (state fulfilled)     │
                                              └───────────┬──────────────┘
                                                          │
                                                          │
                                              ┌───────────▼───────────────┐
                                              │                           │
                                              │   Payment capture         │
                                              │                           │
                                              └───────────┬───────────────┘
                                                          │
                                                          │   Any refund from here
                                                          ▼   is working

I'm not sure how critical is this issue, but when the payment is only captured, the refund page is a 500 error.

Mostly because of those 2 lines:

{% set completed = constant('Sylius\\Component\\Core\\Model\\PaymentInterface::STATE_COMPLETED') %}
{% set original_payment_method = order.lastPayment(completed).method %}

But it's also complicated to allow a refund on a non captured payment, because it's not really a refund: it's just a reduction of the amount to capture if not all the items are canceled (or even partially canceled).

I think there's also some issues with stock management when an item is refund but the whole order not canceled.

I'm not sure of anything here, I'm just exposing a problem that has tons of solutions...

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

No branches or pull requests

1 participant