diff --git a/app/helpers/checkout_helper.rb b/app/helpers/checkout_helper.rb index 8f05035bdd..02bc03e152 100644 --- a/app/helpers/checkout_helper.rb +++ b/app/helpers/checkout_helper.rb @@ -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' diff --git a/app/views/spree/admin/orders/ticket.html.haml b/app/views/spree/admin/orders/ticket.html.haml index b0cd4ecc7a..415fb97adb 100644 --- a/app/views/spree/admin/orders/ticket.html.haml +++ b/app/views/spree/admin/orders/ticket.html.haml @@ -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 - - diff --git a/spec/helpers/checkout_helper_spec.rb b/spec/helpers/checkout_helper_spec.rb index 7239b72911..920c05f896 100644 --- a/spec/helpers/checkout_helper_spec.rb +++ b/spec/helpers/checkout_helper_spec.rb @@ -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,