mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Remove duplicative line item for taxes
This commit is contained in:
@@ -10,8 +10,8 @@ module CheckoutHelper
|
||||
|
||||
adjustments = order.all_adjustments.eligible.to_a
|
||||
|
||||
# Remove empty tax adjustments and (optionally) shipping fees
|
||||
adjustments.reject! { |a| a.originator_type == 'Spree::TaxRate' && a.amount == 0 }
|
||||
# Remove tax adjustments and (optionally) shipping fees
|
||||
adjustments.reject! { |a| a.originator_type == 'Spree::TaxRate' }
|
||||
if exclude.include? :shipping
|
||||
adjustments.reject! { |a|
|
||||
a.originator_type == 'Spree::ShippingMethod'
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
'#{j(@order.distributor.address.address_part1)}' + '\x0A', // text and line break
|
||||
'#{j(@order.distributor.address.address_part2)}' + '\x0A',
|
||||
'#{j(@order.distributor.contact.email)}' + '\x0A',
|
||||
'\x0A', // line break
|
||||
'\x0A', // line break
|
||||
'\x1B' + '\x61' + '\x32', // right align
|
||||
'#{j(l(Time.zone.now.to_date))}' + '\x0A',
|
||||
'#{j(@order.number)}' + '\x0A',
|
||||
@@ -73,5 +73,3 @@
|
||||
= javascript_include_tag "qz/ticket-popup.js"
|
||||
%body
|
||||
%div#printer-list
|
||||
|
||||
|
||||
|
||||
@@ -60,6 +60,36 @@ describe CheckoutHelper, type: :helper do
|
||||
expect(admin_fee_summary.amount).to eq 123
|
||||
end
|
||||
|
||||
context "tax rate adjustments" do
|
||||
let!(:tax_rate) { create(:tax_rate, amount: 0.1, calculator: ::Calculator::DefaultTax.new) }
|
||||
let!(:line_item_fee_adjustment) {
|
||||
create(:adjustment, originator: enterprise_fee, adjustable: order.line_items.first,
|
||||
order: order)
|
||||
}
|
||||
let!(:order_tax_adjustment) {
|
||||
create(:adjustment,
|
||||
originator: tax_rate,
|
||||
adjustable: fee_adjustment,
|
||||
order: order
|
||||
)
|
||||
}
|
||||
let!(:line_item_fee_adjustment_tax_adjustment) {
|
||||
create(:adjustment,
|
||||
originator: tax_rate,
|
||||
adjustable: line_item_fee_adjustment,
|
||||
order: order
|
||||
)
|
||||
}
|
||||
|
||||
it "removes tax rate adjustments" do
|
||||
expect(order.all_adjustments.tax.count).to eq(2)
|
||||
|
||||
adjustments = helper.checkout_adjustments_for(order)
|
||||
tax_adjustments = adjustments.select { |a| a.originator_type == "Spree::TaxRate" }
|
||||
expect(tax_adjustments.count).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
context "with return authorization adjustments" do
|
||||
let!(:return_adjustment) {
|
||||
create(:adjustment, originator_type: 'Spree::ReturnAuthorization', adjustable: order,
|
||||
|
||||
Reference in New Issue
Block a user