mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Rename #charge_shipping_and_payment_fees! to #set_payment_amount!
This method sets the order's payment amount during the checkout. It doesn't really have anything to do with shipping or payment fees...
This commit is contained in:
@@ -788,7 +788,7 @@ module Spree
|
||||
# before the shipping method is set. This results in the customer not being
|
||||
# charged for their order's shipping. To fix this, we refresh the payment
|
||||
# amount here.
|
||||
def charge_shipping_and_payment_fees!
|
||||
def set_payment_amount!
|
||||
update_totals
|
||||
return unless pending_payments.any?
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ module Spree
|
||||
after_transition to: :delivery, do: :create_tax_charge!
|
||||
after_transition to: :resumed, do: :after_resume
|
||||
after_transition to: :canceled, do: :after_cancel
|
||||
after_transition to: :payment, do: :charge_shipping_and_payment_fees!
|
||||
after_transition to: :payment, do: :set_payment_amount!
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1268,7 +1268,7 @@ describe Spree::Order do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#charge_shipping_and_payment_fees!' do
|
||||
describe '#set_payment_amount!' do
|
||||
let(:order) do
|
||||
shipment = build(:shipment_with, :shipping_method, shipping_method: build(:shipping_method))
|
||||
build(:order, shipments: [shipment] )
|
||||
@@ -1281,8 +1281,8 @@ describe Spree::Order do
|
||||
allow(order).to receive(:payment_required?) { true }
|
||||
end
|
||||
|
||||
it 'calls charge_shipping_and_payment_fees! and updates totals' do
|
||||
expect(order).to receive(:charge_shipping_and_payment_fees!)
|
||||
it 'calls #set_payment_amount! and updates totals' do
|
||||
expect(order).to receive(:set_payment_amount!)
|
||||
expect(order).to receive(:update_totals).at_least(:once)
|
||||
|
||||
order.next
|
||||
|
||||
Reference in New Issue
Block a user