Make charges update method update the first pending payment

Updating the first overall payment could select a failed payment and ignore the pending payment that is about to be processed
This commit is contained in:
Luis Ramos
2020-07-20 18:18:00 +01:00
parent ea1e23abab
commit 21227d7482

View File

@@ -432,8 +432,8 @@ Spree::Order.class_eval do
# amount here.
def charge_shipping_and_payment_fees!
update_totals
return unless payments.any?
return unless pending_payments.any?
payments.first.update_attribute :amount, total
pending_payments.first.update_attribute :amount, total
end
end