mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Update tax charging in checkout flow
This commit is contained in:
@@ -77,9 +77,9 @@ module Spree
|
||||
|
||||
before_transition to: :delivery, do: :create_proposed_shipments
|
||||
before_transition to: :delivery, do: :ensure_available_shipping_rates
|
||||
before_transition to: :payment, do: :create_tax_charge!
|
||||
|
||||
after_transition to: :complete, do: :finalize!
|
||||
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!
|
||||
|
||||
@@ -48,16 +48,14 @@ describe Spree::Order do
|
||||
end
|
||||
end
|
||||
|
||||
context "when current state is address" do
|
||||
context "when current state is delivery" do
|
||||
before do
|
||||
allow(order).to receive(:ensure_available_shipping_rates)
|
||||
order.state = "address"
|
||||
order.state = "delivery"
|
||||
end
|
||||
|
||||
it "adjusts tax rates when transitioning to delivery" do
|
||||
# Once because the record is being saved
|
||||
# Twice because it is transitioning to the delivery state
|
||||
expect(Spree::TaxRate).to receive(:adjust).twice
|
||||
it "adjusts tax rates when transitioning to payment" do
|
||||
expect(Spree::TaxRate).to receive(:adjust)
|
||||
order.next!
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user