Update Order shipment adjustments fetching

This commit is contained in:
Matt-Yorkley
2021-02-10 20:01:53 +00:00
parent 00f116f35f
commit f0aa43e198
2 changed files with 5 additions and 4 deletions

View File

@@ -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

View File

@@ -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!