mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-23 05:28:53 +00:00
fix #5829
This commit is contained in:
@@ -61,7 +61,7 @@ module Spree
|
||||
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
|
||||
@@ -79,6 +79,11 @@ module Spree
|
||||
|
||||
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
|
||||
|
||||
@@ -75,7 +75,9 @@ module StripeStubs
|
||||
amount_received: 2000,
|
||||
status: options[:intent_status] || "requires_capture",
|
||||
last_payment_error: nil,
|
||||
charges: { data: [{ id: "ch_1234", amount: 2000 }] }) }
|
||||
charges: {
|
||||
data: [{ id: "ch_1234", amount: 2000, amount_refunded: 0 }] })
|
||||
}
|
||||
end
|
||||
|
||||
def payment_intent_redirect_response_mock(redirect_url)
|
||||
|
||||
Reference in New Issue
Block a user