mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Update OrderTaxAdjustmentsFetcher
This commit is contained in:
@@ -22,7 +22,7 @@ class OrderTaxAdjustmentsFetcher
|
||||
def all
|
||||
Spree::Adjustment
|
||||
.with_tax
|
||||
.where(order_adjustments.or(line_item_adjustments))
|
||||
.where(order_adjustments.or(line_item_adjustments).or(shipment_adjustments))
|
||||
.order('created_at ASC')
|
||||
end
|
||||
|
||||
@@ -36,6 +36,11 @@ class OrderTaxAdjustmentsFetcher
|
||||
.and(table[:adjustable_type].eq('Spree::LineItem'))
|
||||
end
|
||||
|
||||
def shipment_adjustments
|
||||
table[:order_id].eq(order.id)
|
||||
.and(table[:adjustable_type].eq('Spree::Shipment'))
|
||||
end
|
||||
|
||||
def table
|
||||
@table ||= Spree::Adjustment.arel_table
|
||||
end
|
||||
|
||||
@@ -86,7 +86,7 @@ describe OrderTaxAdjustmentsFetcher do
|
||||
|
||||
subject { OrderTaxAdjustmentsFetcher.new(order).totals }
|
||||
|
||||
it "returns a hash with all 3 taxes" do
|
||||
it "returns a hash with all 4 taxes" do
|
||||
expect(subject.size).to eq(4)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user