Make StripeSCA void action make a refund instead

StripeSCA does not support voiding confirmed payment intents so we need to make a refund instead
This commit is contained in:
Luis Ramos
2020-05-17 11:35:22 +01:00
parent 819af03239
commit 2179cc7faf

View File

@@ -57,8 +57,11 @@ module Spree
# NOTE: the name of this method is determined by Spree::Payment::Processing
def void(response_code, _creditcard, gateway_options)
payment_intent_id = response_code
payment_intent_response = Stripe::PaymentIntent.retrieve(payment_intent_id,
stripe_account: stripe_account_id)
gateway_options[:stripe_account] = stripe_account_id
provider.void(response_code, gateway_options)
provider.refund(payment_intent_response.amount_received, response_code, gateway_options)
end
# NOTE: the name of this method is determined by Spree::Payment::Processing