From 21227d7482a20f722f4c005bb3fa862e46705634 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Mon, 20 Jul 2020 18:18:00 +0100 Subject: [PATCH] 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 --- app/models/spree/order_decorator.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index 71574359a72..377b72a0f6d 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -432,8 +432,8 @@ def update_adjustment!(adjustment) # 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