mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Remove admin_and_handling merging
+ update specs as well
This commit is contained in:
committed by
Konrad
parent
0cc8349c71
commit
72df2867d4
@@ -32,18 +32,6 @@ module CheckoutHelper
|
||||
}
|
||||
end
|
||||
|
||||
enterprise_fee_adjustments = adjustments.select { |a|
|
||||
a.originator_type == 'EnterpriseFee' && a.adjustable_type != 'Spree::LineItem'
|
||||
}
|
||||
adjustments.reject! { |a|
|
||||
a.originator_type == 'EnterpriseFee' && a.adjustable_type != 'Spree::LineItem'
|
||||
}
|
||||
unless exclude.include? :admin_and_handling
|
||||
adjustments << Spree::Adjustment.new(
|
||||
label: I18n.t(:orders_form_admin), amount: enterprise_fee_adjustments.sum(&:amount)
|
||||
)
|
||||
end
|
||||
|
||||
adjustments
|
||||
end
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
%span.order-total.distribution-total= display_line_item_fees_total_for(@order)
|
||||
%td
|
||||
|
||||
- checkout_adjustments_for(@order, exclude: [:line_item, :admin_and_handling]).reject{ |a| a.amount == 0 }.reverse_each do |adjustment|
|
||||
- checkout_adjustments_for(@order, exclude: [:line_item]).reject{ |a| a.amount == 0 }.reverse_each do |adjustment|
|
||||
%tr.order-adjustment
|
||||
%td.text-right{:colspan => "3"}
|
||||
= adjustment.label
|
||||
|
||||
@@ -148,7 +148,7 @@ describe CheckoutHelper, type: :helper do
|
||||
expect(adjustments).to include shipping_adjustment
|
||||
|
||||
admin_fee_summary = adjustments.last
|
||||
expect(admin_fee_summary.label).to eq I18n.t(:orders_form_admin)
|
||||
expect(admin_fee_summary.label).to eq "Shipping"
|
||||
expect(admin_fee_summary.amount).to eq 123
|
||||
end
|
||||
|
||||
|
||||
@@ -215,7 +215,8 @@ describe '
|
||||
it "displays GST for enterprise fees" do
|
||||
pending "ii) for legend see picture on PR #9495"
|
||||
# enterprise fee of $20.00
|
||||
expect(page).to have_content "Admin & Handling 1 $20.00 $120.00"
|
||||
expect(page).to have_content "Whole order - #{enterprise_fee.name} fee by coordinator " \
|
||||
"#{user1.enterprises.first.name} 1 $20.00 (included) $120.00"
|
||||
end
|
||||
|
||||
it "displays the taxes correctly" do
|
||||
@@ -225,7 +226,8 @@ describe '
|
||||
expect(page).to have_content "#{Spree::Product.second.name} 3 $250.08 $1,500.45"
|
||||
expect(page).to have_content "(1g)" # display as
|
||||
# Enterprise fee
|
||||
expect(page).to have_content "Admin & Handling 1 $120.00"
|
||||
expect(page).to have_content "Whole order - #{enterprise_fee.name} fee by coordinator " \
|
||||
"#{user1.enterprises.first.name} 1 $15.65 (included) $120.00"
|
||||
# Shipping
|
||||
expect(page).to have_content "Shipping 1 $9.14 (included) $100.55"
|
||||
# Order Totals
|
||||
@@ -257,7 +259,8 @@ describe '
|
||||
expect(page).to have_content "(1g)" # display as
|
||||
expect(page).to have_content "3 $500.15 $1,500.45 20.0%"
|
||||
# Enterprise fee
|
||||
expect(page).to have_content "Admin & Handling $120.00"
|
||||
expect(page).to have_content "#{enterprise_fee.name} fee by coordinator " \
|
||||
"#{user1.enterprises.first.name} $120.00"
|
||||
# Shipping
|
||||
expect(page).to have_content "Shipping $100.55 10.0%"
|
||||
# Tax totals
|
||||
@@ -357,14 +360,16 @@ describe '
|
||||
it "displays GST for enterprise fees" do
|
||||
pending "v) for legend see picture on PR #9495"
|
||||
# enterprise fee of $24.00
|
||||
expect(page).to have_content "Admin & Handling 1 $20.00 $120.00"
|
||||
expect(page).to have_content "Whole order - #{enterprise_fee.name} fee by coordinator " \
|
||||
"#{user1.enterprises.first.name} 1 $20.00 $120.00"
|
||||
end
|
||||
|
||||
it "displays the taxes correctly" do
|
||||
# header
|
||||
expect(page).to have_content "Item Qty GST Price"
|
||||
# Enterprise fee
|
||||
expect(page).to have_content "Admin & Handling 1 $120.00"
|
||||
expect(page).to have_content "Whole order - #{enterprise_fee.name} fee by coordinator " \
|
||||
"#{user1.enterprises.first.name} 1 $18.00 $120.00"
|
||||
# Shipping
|
||||
expect(page).to have_content "Shipping 1 $10.06 $100.55"
|
||||
# Order Totals
|
||||
@@ -395,7 +400,8 @@ describe '
|
||||
expect(page).to have_content "(1g)" # display as
|
||||
expect(page).to have_content "3 $500.15 $1,500.45 20.0%"
|
||||
# Enterprise fee
|
||||
expect(page).to have_content "Admin & Handling $120.00"
|
||||
expect(page).to have_content "#{enterprise_fee.name} fee by coordinator " \
|
||||
"#{user1.enterprises.first.name} $120.00"
|
||||
# Shipping
|
||||
expect(page).to have_content "Shipping $100.55 10.0%"
|
||||
# Tax totals
|
||||
|
||||
Reference in New Issue
Block a user