mollie / spree-mollie-gateway

Mollie payments for Spree Commerce.
https://www.mollie.com
16 stars 23 forks source link

Implement cancel method on gateway #27

Closed vernondegoede closed 6 years ago

vernondegoede commented 6 years ago

Some merchants would to have the ability to cancel the open payments from their Spree backend. Currently the following exception is thrown:

NotImplementedError (You must implement cancel method for this payment method.):

v2 API Reference: https://docs.mollie.com/reference/v2/payments-api/cancel-payment

willemstuursma commented 6 years ago

This is only supported for bank transfer and SDD.

vernondegoede commented 6 years ago

Ah, you're right. Thanks for the heads-up! We should still implement this method on the gateway though, and only cancel the actual payment if it's cancelable.

Without this method, the cancelation process within Spree cannot continue: https://github.com/spree/spree/blob/8943fc95812416c924284de55102cb22a4b8e941/core/app/models/spree/order.rb#L584

Oldharlem commented 6 years ago

Any progress on this issue? :)

vernondegoede commented 6 years ago

@Oldharlem The fix will be released tomorrow: https://github.com/mollie/spree-mollie-gateway/pull/29

vernondegoede commented 6 years ago

The cancel method has been implemented in 2.1.2. If the payment is cancelable (which is only the case when the merchant manually set the order to paid), it will cancel the payment as well. Otherwise, it will do nothing and Spree will continue the order cancelation process.

gem 'spree_mollie_gateway', '~> 2.1', '>= 2.1.2'