Show tax on order confirmation page

This commit is contained in:
Rohan Mitchell
2015-04-02 14:53:57 +11:00
parent 77d7255243
commit 3ce2c5b84f
2 changed files with 46 additions and 33 deletions

View File

@@ -130,37 +130,36 @@
%td.text-right.total{"data-hook" => "order_item_total"}
%span= item.display_amount_with_adjustments.to_html
%tfoot#order-total{"data-hook" => "order_details_total"}
%tr.total
%td.text-right{colspan: "3"}
%h5
Total
%td.text-right.total
%h5#order_total= order.display_total.to_html
- if order.price_adjustment_totals.present?
%tfoot#price-adjustments{"data-hook" => "order_details_price_adjustments"}
- order.price_adjustment_totals.each do |key, total|
%tr.total
%td.text-right{colspan: "3"}
%strong
= key
%td.text-right.total
%span= total
%tfoot#subtotal{"data-hook" => "order_details_subtotal"}
%tr#subtotal-row.total
%td.text-right{colspan: "3"}
%strong
Produce
%td.text-right.total
%span= display_checkout_subtotal(order)
%tfoot#order-charges{"data-hook" => "order_details_adjustments"}
- checkout_adjustments_for(order, exclude: [:line_item]).reject{ |a| a.amount == 0 }.reverse_each do |adjustment|
%tr.total
%td.text-right{:colspan => "3"}
%tfoot
#subtotal{"data-hook" => "order_details_subtotal"}
%tr#subtotal-row.total
%td.text-right{colspan: "3"}
%strong
= adjustment.label
Produce
%td.text-right.total
%span= adjustment.display_amount.to_html
%span= display_checkout_subtotal(order)
#order-charges{"data-hook" => "order_details_adjustments"}
- checkout_adjustments_for(order, exclude: [:line_item]).reject{ |a| a.amount == 0 }.reverse_each do |adjustment|
%tr.total
%td.text-right{:colspan => "3"}
%strong
= adjustment.label
%td.text-right.total
%span= adjustment.display_amount.to_html
#order-total{"data-hook" => "order_details_total"}
%tr.total
%td.text-right{colspan: "3"}
%h5
Total
%td.text-right.total
%h5#order_total= order.display_total.to_html
- if order.total_tax > 0
#tax{"data-hook" => "order_details_tax"}
%tr#tax-row.total
%td.text-right{colspan: "3"}
(includes tax)
%td.text-right.total
%span= display_checkout_tax_total(order)

View File

@@ -12,11 +12,14 @@ feature "As a consumer I want to check out my cart", js: true do
let(:distributor) { create(:distributor_enterprise) }
let(:supplier) { create(:supplier_enterprise) }
let!(:order_cycle) { create(:simple_order_cycle, suppliers: [supplier], distributors: [distributor], coordinator: create(:distributor_enterprise), variants: [product.master]) }
let(:enterprise_fee) { create(:enterprise_fee, amount: 1.23) }
let(:enterprise_fee) { create(:enterprise_fee, amount: 1.23, tax_category: product.tax_category) }
let(:product) { create(:taxed_product, supplier: supplier, price: 10, zone: zone, tax_rate_amount: 0.1) }
let(:order) { create(:order, order_cycle: order_cycle, distributor: distributor) }
before do
Spree::Config.shipment_inc_vat = true
Spree::Config.shipping_tax_rate = 0.25
add_enterprise_fee enterprise_fee
set_order order
add_product_to_cart
@@ -131,6 +134,17 @@ feature "As a consumer I want to check out my cart", js: true do
o = Spree::Order.complete.first
expect(o.special_instructions).to eq "SpEcIaL NoTeS"
# The Spree tax summary should not be displayed
page.should_not have_content product.tax_category.name
# The total tax for the order, including shipping and fee tax, should be displayed
# product tax ($10.00 @ 10% = $0.91)
# + fee tax ($ 1.23 @ 10% = $0.11)
# + shipping tax ($ 4.56 @ 25% = $0.91)
# = $1.93
page.should have_content "(includes tax)"
page.should have_content "$1.93"
end
context "with basic details filled" do