From fafd86a2db38f1da5cb67e14c749e4b05700e2e4 Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Mon, 30 Sep 2024 16:04:44 +1000 Subject: [PATCH] Revert change made in https://github.com/openfoodfoundation/openfoodnetwork/pull/12538 Although the change fix the issue in the back office scenario, it has the side effect of getting the order total out of sync. Updating a payment adjustment need to be followed by udpating the order total and payment amount to keep everything in sync. --- app/models/spree/payment.rb | 1 - spec/system/admin/order_spec.rb | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/spree/payment.rb b/app/models/spree/payment.rb index e10920d4b8..6479694df9 100644 --- a/app/models/spree/payment.rb +++ b/app/models/spree/payment.rb @@ -155,7 +155,6 @@ module Spree if adjustment adjustment.originator = payment_method adjustment.label = adjustment_label - adjustment.amount = payment_method.compute_amount(self) adjustment.save elsif !processing_refund? && payment_method.present? payment_method.create_adjustment(adjustment_label, self, true) diff --git a/spec/system/admin/order_spec.rb b/spec/system/admin/order_spec.rb index 685e1174cb..43d0745723 100644 --- a/spec/system/admin/order_spec.rb +++ b/spec/system/admin/order_spec.rb @@ -180,6 +180,7 @@ RSpec.describe ' let(:order_with_fees) { create(:completed_order_with_fees, user:, distributor:, order_cycle: ) } it 'recalculates transaction fee' do + pending login_as_admin visit spree.edit_admin_order_path(order_with_fees)