-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Payment cancellation #1637
Comments
Relates to #1637. This commit introduces a new function to the PaymentHandler as well as a new `cancelPayment` mutation to the Admin API. Rather than directly transitioning the Payment state to "Cancelled", the intention is that `cancelPayment` should be executed, which will run the associated PaymentMethodHandler function (if defined).
@martijnvdbrug, @vrosa - the above commits introduce a new optional function to PaymentMethodHandlers, Just giving you guys the heads up so that you can potentially incorporate this API into your own implementations once v1.7 is out, and if it proves beneficial, perhaps contribute the changes back to the payments-plugin versions of Stripe and Mollie handlers. |
Is your feature request related to a problem? Please describe.
Current implementation of 'cancel' payment state is like a dummy. I can cancel payment from any state, so its gonna be a problem if payment is in 'authorized' or 'settled' state and I click cancel in admin-ui. Literally we may lose payments, without any callback to payment provider.
Describe the solution you'd like
A new payment handler's method 'cancelPayment' which carefully handle this type of transition. In two-step scheme we could cancel payment transaction, which will unblock held funds, instead invoking a refund.
Describe alternatives you've considered
Handle this type of action as refund, but I guess there is a lot of side effects on order.
@michaelbromley
Hi,
I think you are right - currently it's just setting state to Cancelled and no side effects are happening. It should not really be possible to just cancel a settled payment - you'd also want to take the corresponding action with the payment provider like with "refund".
So I think basically I added this state way back when I implemented Payments but before actually having implemented a concrete provider integration, hence this rather impractical functionality.
@ashitikov
It's quite helpful in case of two-step payment flow
Transition authorized -> cancelled is possible in this case. Corresponding method cancelPayment should be called in payment handler in this case
@michaelbromley
yes, then we'd need to add a cancelPayment method to the handler API.
Slack thread: https://vendure-ecommerce.slack.com/archives/CKYMF0ZTJ/p1656319311851299
The text was updated successfully, but these errors were encountered: