Skip to content

Commit

Permalink
fix #5829
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpbrett committed Dec 3, 2020
1 parent dfabc5f commit 61ea144
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/models/spree/gateway/stripe_sca.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def void(response_code, _creditcard, gateway_options)
payment_intent_response = Stripe::PaymentIntent.retrieve(payment_intent_id,
stripe_account: stripe_account_id)
gateway_options[:stripe_account] = stripe_account_id
provider.refund(payment_intent_response.amount_received, response_code, gateway_options)
provider.refund(refundable_amount(payment_intent_response), response_code, gateway_options)
end

# NOTE: the name of this method is determined by Spree::Payment::Processing
Expand All @@ -79,6 +79,11 @@ def create_profile(payment)

private

def refundable_amount(payment_intent_response)
payment_intent_response.amount_received -
payment_intent_response.charges.data.map(&:amount_refunded).sum
end

# In this gateway, what we call 'secret_key' is the 'login'
def options
options = super
Expand Down

0 comments on commit 61ea144

Please sign in to comment.