mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-01 21:47:16 +00:00
Update Order shipment adjustments fetching
This commit is contained in:
@@ -684,7 +684,7 @@ module Spree
|
||||
end
|
||||
|
||||
def shipping_tax
|
||||
adjustments(:reload).shipping.sum(:included_tax)
|
||||
shipment_adjustments(:reload).shipping.sum(:included_tax)
|
||||
end
|
||||
|
||||
def enterprise_fee_tax
|
||||
@@ -692,7 +692,7 @@ module Spree
|
||||
end
|
||||
|
||||
def total_tax
|
||||
(adjustments.to_a + line_item_adjustments.to_a).sum(&:included_tax)
|
||||
(adjustments.to_a + shipment_adjustments.to_a + line_item_adjustments.to_a).sum(&:included_tax)
|
||||
end
|
||||
|
||||
def has_taxes_included
|
||||
|
||||
@@ -1088,7 +1088,8 @@ describe Spree::Order do
|
||||
Spree::Config.shipping_tax_rate = 0.25
|
||||
|
||||
# Sanity check the fees
|
||||
expect(order.adjustments.length).to eq 2
|
||||
expect(order.adjustments.length).to eq 1
|
||||
expect(order.shipment_adjustments.length).to eq 1
|
||||
expect(item_num).to eq 2
|
||||
expect(order.adjustment_total).to eq expected_fees
|
||||
expect(order.shipment.adjustment.included_tax).to eq 1.2
|
||||
@@ -1105,7 +1106,7 @@ describe Spree::Order do
|
||||
|
||||
context "when finalized fee adjustments exist on the order" do
|
||||
let(:payment_fee_adjustment) { order.adjustments.payment_fee.first }
|
||||
let(:shipping_fee_adjustment) { order.adjustments.shipping.first }
|
||||
let(:shipping_fee_adjustment) { order.shipment_adjustments.first }
|
||||
|
||||
before do
|
||||
payment_fee_adjustment.finalize!
|
||||
|
||||
Reference in New Issue
Block a user