Summarise distribution charges: order confirm page and email

This commit is contained in:
Rohan Mitchell
2013-08-20 14:25:18 +10:00
parent fdf80cac5e
commit fa459c0395
4 changed files with 19 additions and 3 deletions

View File

@@ -0,0 +1,8 @@
/ replace_contents 'tfoot#order-charges'
- checkout_adjustments_for_summary(@order).each do |adjustment|
%tr.total
%td{:colspan => "4"}
%strong= adjustment.label
%td.total
%span= adjustment.display_amount.to_html

View File

@@ -11,7 +11,7 @@ Order for: <%= @order.bill_address.full_name %>
<% end %>
============================================================
Subtotal: <%= @order.display_item_total %>
<% @order.adjustments.eligible.each do |adjustment| %>
<% checkout_adjustments_for_summary(@order).each do |adjustment| %>
<%= raw(adjustment.label) %> <%= adjustment.display_amount %>
<% end %>
Order Total: <%= @order.display_total %>

View File

@@ -7,6 +7,8 @@ module EnterprisesDistributorInfoRichTextFeature
initializer 'enterprises_distributor_info_rich_text_feature.mailer', :after => :load_config_initializers do |app|
if OpenFoodWeb::FeatureToggle.enabled? :enterprises_distributor_info_rich_text
::Spree::OrderMailer.class_eval do
helper CheckoutHelper
def confirm_email(order, resend = false)
find_order(order)
subject = (resend ? "[#{t(:resend).upcase}] " : '')

View File

@@ -324,13 +324,19 @@ feature %q{
click_checkout_continue_button
# -- Checkout: Order complete
page.should have_content('Your order has been processed successfully')
page.should have_content(@payment_method_all.description)
page.should have_content 'Your order has been processed successfully'
page.should have_content @payment_method_all.description
page.should have_selector 'tfoot#order-charges tr.total td', text: 'Distribution'
page.should have_selector 'tfoot#order-charges tr.total td', text: '$3.00'
# page.should have_content('Your order will be available on:')
# page.should have_content('On Tuesday, 4 PM')
# page.should have_content('12 Bungee Rd, Carion')
# -- Checkout: Email
email = ActionMailer::Base.deliveries.last
email.body.should =~ /Distribution \$3.00/
end