mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Show shipping method via angular only (don't show spree's adjustment)
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
module CheckoutHelper
|
||||
def checkout_adjustments_for_summary(order)
|
||||
def checkout_adjustments_for_summary(order, opts={})
|
||||
adjustments = order.adjustments.eligible
|
||||
|
||||
# Remove empty tax adjustments and (optionally) shipping fees
|
||||
adjustments.reject! { |a| a.originator_type == 'Spree::TaxRate' && a.amount == 0 }
|
||||
adjustments.reject! { |a| a.originator_type == 'Spree::ShippingMethod' } if opts[:exclude_shipping]
|
||||
|
||||
enterprise_fee_adjustments = adjustments.select { |a| a.originator_type == 'EnterpriseFee' }
|
||||
adjustments.reject! { |a| a.originator_type == 'EnterpriseFee' }
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
%th Produce
|
||||
%td= current_order.display_item_total
|
||||
|
||||
- checkout_adjustments_for_summary(current_order).each do |adjustment|
|
||||
- checkout_adjustments_for_summary(current_order, exclude_shipping: true).each do |adjustment|
|
||||
%tr
|
||||
%th= adjustment.label
|
||||
%td= adjustment.display_amount.to_html
|
||||
|
||||
@@ -146,6 +146,21 @@ feature "As a consumer I want to check out my cart", js: true do
|
||||
place_order
|
||||
page.should have_content "Your order has been processed successfully"
|
||||
end
|
||||
|
||||
it "shows the payment processing failed message when submitted with an invalid credit card" do
|
||||
toggle_payment
|
||||
fill_in 'Card Number', with: "9999999988887777"
|
||||
select 'February', from: 'secrets.card_month'
|
||||
select (Date.today.year+1).to_s, from: 'secrets.card_year'
|
||||
fill_in 'Security Code', with: '123'
|
||||
|
||||
place_order
|
||||
page.should have_content "Payment could not be processed, please check the details you entered"
|
||||
|
||||
# Does not show duplicate shipping fee
|
||||
visit checkout_path
|
||||
page.all("th", text: "Shipping").count.should == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user