Permalink
Browse files

Merge branch 'release/1.4'

  • Loading branch information...
2 parents f9bd099 + 65fb54d commit 0dd07c486eedb04df9f5aabc034a104fcd6c9ea2 Tim Glen committed Dec 6, 2011
@@ -213,16 +213,16 @@ def do_account_signup
flash[:notice] = "Your user has been created and you are now logged in"
end
end
-
+
if !logged_in?
flash.now[:notice] = "A user with your email address (#{@order.email}) already exists. To have this order associated with your account, login and continue your checkout." if User.find_by_login(@order.email)
end
end
-
- def do_credit_card
+
+ def do_confirm
do_transaction
end
-
+
def do_transaction
if @valid
Order.transaction do
@@ -247,7 +247,7 @@ def do_transaction
@cart.gifts.each{|gift| gift.send_at = Time.now + 1.minute if gift.send_email? && (!gift.send_at? || (gift.send_at? && gift.send_at < Time.now)) }
# save the cart items into the db via the association
@cart.pledges.each{|pledge| pledge.update_attributes(:paid => true)}
-
+
@order.gifts = @cart.gifts
@order.investments = @cart.investments
@order.deposits = @cart.deposits
@@ -292,7 +292,7 @@ def do_transaction
@pledge_account.save!
end
if !@pledge_account
- @order.update_attributes(:pledge_account_payment => nil, :pledge_account_payment_id => nil)
+ @order.update_attributes(:pledge_account_payment => nil, :pledge_account_payment_id => nil)
end
# mark the order as complete
@@ -387,11 +387,12 @@ def set_checkout_steps
@checkout_steps = []
@checkout_steps << 'upowered'
if (logged_in? && (current_user.balance > 0 || current_user.cf_admin?)) || (session[:gift_card_balance] && session[:gift_card_balance] > 0)
- @checkout_steps << 'payment_options'
+ @checkout_steps << 'payment_options'
end
@checkout_steps << 'billing'
@checkout_steps << 'account_signup' unless logged_in?
@checkout_steps << 'credit_card'
+ @checkout_steps << 'confirm'
@checkout_steps << 'receipt'
@checkout_steps
end
@@ -7,7 +7,7 @@ class Iend::UsersController < DtApplicationController
def index
@sectors = Sector.alphabetical
- if params[:name].blank? && params[:sectors].blank? && params[:project].blank?
+ if params[:name].blank? && params[:sectors].blank? && params[:project].blank? && params[:country].blank?
@profiles = IendProfile.paginate(:page => params[:page], :per_page => 18)
else
@profiles = IendProfile.search params[:name],
@@ -102,13 +102,15 @@ def search_prepare_without
without.merge!({ :preferred_poverty_sectors => false }) unless sector_params_array.nil? || sector_params_array.empty?
without.merge!({ :public_name => false }) if params[:name].present?
without.merge!({ :list_projects_funded => false }) if params[:project].present?
+ without.merge!({ :location => false }) if params[:country].present?
without
end
def search_prepare_with_all
with = {}
with.merge!({ :sector_ids => sector_params_array }) unless sector_params_array.empty?
with.merge!({ :funded_project_ids => params[:project] }) unless params[:project].nil?
+ with.merge!({ :funded_country_ids => params[:country] }) unless params[:country].nil?
with
end
View
@@ -72,7 +72,7 @@ def gifts
def investments
self.items.all.select{|item| item.item_type == "Investment" }.map(&:item)
end
-
+
def tips
self.items.all.select{|item| item.item_type == "Tip" }.map(&:item)
end
@@ -81,6 +81,10 @@ def items_without_donation
self.items.find_all_by_donation([false, nil])
end
+ def all_items_donation_last
+ self.items_without_donation << self.donation
+ end
+
def minimum_credit_card_payment
minimum = 0
self.items.all.each do |line_item|
@@ -12,6 +12,8 @@ class IendProfile < ActiveRecord::Base
has user.preferred_sectors.sector_id, :as => :sector_ids
has list_projects_funded
has user.investments.project_id, :as => :funded_project_ids
+ has location
+ has user.investments.project.country(:id), :as => :funded_country_ids
end
def formatted_location
View
@@ -194,7 +194,7 @@ def offline_fund_payment=(val)
def total=(val)
write_attribute(:total, strip_dollar_sign(val))
end
-
+
# set the reader methods for the columns dealing with currency
# we're using BigDecimal explicity for mathematical accuracy - it's better for currency
def account_balance_payment
@@ -7,7 +7,8 @@
"payment_options" => "Payment &nbsp; &nbsp; Options ",
"upowered" => "Join &nbsp; &nbsp; UPowered ",
"billing" => "Billing Information ",
- "account_signup" => "Account Signup ",
+ "account_signup" => "Account Signup ",
+ 'confirm' => "Confirmation",
"credit_card" => "Credit Card Details",
"receipt" => "Transaction Receipt"
}
@@ -19,7 +20,7 @@
-%>
<li class="span-2<%= ' current' if current %>"><%= title %></li>
<%- end -%>
- <li class="span-4 <%= "prepend-#{(10 - @checkout_steps.size*2)}" %> last" style="text-align:right;font-size:18px;">
+ <li class="span-2 <%= "prepend-#{(10 - @checkout_steps.size*2)}" %> last" style="text-align:right;font-size:18px;">
<%- if @cart.present? -%>
<strong>Cart Total: <%= number_to_currency(@cart.total) %></strong>
<%- end -%>
@@ -1,118 +1,82 @@
-<%- content_for :head do -%>
-<%= stylesheet_link_tag 'dt/cart' %>
-<%= javascript_include_tag "dt/checkout" %>
-<%- end -%>
-<%- content_for :html_title do -%>Confirm Checkout<%- end -%>
-<%- content_for :nav do -%><%= checkout_nav %><%- end -%>
+<% content_for :top_content do %>
+ <div class="clearfix prepend-top" style="position:relative;">
+ <div class="span-16 prepend-2 last">
+ <img src="/images/give/icon-cash_register.png" width="93" height="79" alt="">
+ </div>
+ </div>
+<% end %>
-<h2>Step 3 of 3 - Confirm your details</h2>
+<% html_title("Checkout Confirmation") %>
+<%= checkout_nav %>
-<%= render :partial => "subscription" %>
+<!-- this is to get around a really odd webkit bug -->
+<div>&nbsp;</div>
-<%= error_messages_for :order %>
-<% form_for(:order, :url => dt_checkout_path, :html => {:id => "orderform", :name => "orderform", :method => :put}) do |f| %>
-<%= hidden_field_tag "step", "confirm" %>
-<%= hidden_field_tag(:directed_gift, params[:directed_gift]) unless params[:directed_gift].nil? %>
-<%= hidden_field_tag :project_id, params[:project_id] %>
-<div class="userform">
+<div style="width:162px;float:right">
+ <%= render 'iend/authentications/authentications' %>
+</div>
- <fieldset style="margin-top:1em;">
- <legend>Billing and Tax Receipt Information</legend>
- <% if @order.credit_card_payment? %>
- <div class="notes clearfix">
- <h5>Billing and Tax Receipt Information</h5>
- <p>Please ensure this information is correct for your credit card transaction and tax receipt.</p>
- </div>
- <ol>
- <li><label><strong>Donor Type</strong></label> <%=h @order.donor_type %></li>
- <li><label><strong>Title</strong></label> <%=h @order.title %></li>
- <li><label><strong>First Name</strong></label> <%=h @order.first_name %></li>
- <li><label><strong>Last Name</strong></label> <%=h @order.last_name %></li>
- <li><label><strong>Company</strong></label> <%=h @order.company %></li>
- <li><label><strong>Street Address</strong></label> <%=h @order.address %></li>
- <li><label><strong>Street Address 2</strong></label> <%=h @order.address2 %></li>
- <li><label><strong>City</strong></label> <%=h @order.city %></li>
- <li><label><strong>Province/State</strong></label> <%=h @order.province %></li>
- <li><label><strong>Postal/Zip Code</strong></label> <%=h @order.postal_code %></li>
- <li><label><strong>Country</strong></label> <%=h @order.country %></li>
- <li><label><strong>Province</strong></label> <%=h @order.province %></li>
- <li><label><strong>Email</strong></label> <%=h @order.email %></li>
- </ol>
- <% else %>
- <p>You are not paying with a credit card. No billing information is required.</p>
- <% end %>
- </fieldset>
-
- <% if cart_org_investment %>
- <fieldset>
- <legend>Support Uend:</legend>
- <p>100% of your funds go to the project(s) you select.</p>
- <p>You have chosen to give <strong><%= number_to_currency(cart_cf_investment.amount) %></strong> to Uend: directly. Thank You!</p>
- </fieldset>
+
+<div id="confirm">
+ <h1 class="plain dark">Order Summary</h1>
+
+ <h2 class="plain dark">Payment Information</h2>
+ <% if @order.account_balance_payment %>
+ <h3 class="plain dark">Account Balance</h3>
+ <p><%= number_to_currency @order.account_balance_payment %></p>
+ <% end %>
+ <% if @order.credit_card_payment %>
+ <h3 class="plain dark">Credit Card</h3>
+ <p>
+ Amount: <%= number_to_currency @order.credit_card_payment %><br>
+ Card Name: <%= @order.cardholder_name %><br>
+ Card Number: <%= @order.card_number_concealed %><br>
+ Expiration: <%= @order.card_expiry %>
+ </p>
+ <% end %>
+ <% if @order.gift_card_payment? %>
+ <h3 class="plain dark">Gift Card</h3>
+ <p><%= number_to_currency @order.gift_card_payment %></p>
<% end %>
-
- <fieldset>
- <legend>Payment Summary</legend>
- <ol>
- <li class="odd"><label>Cart Total:</label> <%= number_to_currency(@cart.total) %><%= hidden_field_tag :total, @cart.total, :id => 'cart_total' %></li>
- <% if @order.gift_card_payment? %>
- <li>
- <label>Gift Card Payment:</label> <%= number_to_currency(@order.gift_card_payment) %>
- <div class="note" >After this transaction, your gift card balance will be <%= number_to_currency(session[:gift_card_balance] - @order.gift_card_payment) %>.</div>
- </li>
- <% end %>
- <% if @order.account_balance_payment? %>
- <li>
- <label>Account Balance Payment:</label> <%= number_to_currency(@order.account_balance_payment) %>
- <div class="note">After this transaction, your account balance will be <%= number_to_currency(current_user.balance - @order.account_balance_payment) %>.</div>
- </li>
- <% end %>
- <% if pledge_account && @order.pledge_account_payment? %>
- <li>
- <label>Pledge Account Payment:</label> <%= number_to_currency(@order.pledge_account_payment) %>
- <div class="note" >After this transaction, your pledge account balance will be <%= number_to_currency(pledge_account.balance - @order.pledge_account_payment) %>.</div>
- </li>
- <% end %>
- <% if @order.credit_card_payment? %>
- <li>
- <label>Credit Card Payment:</label> <%= number_to_currency(@order.credit_card_payment) %>
- </li>
- <% end %>
- <li id="totalfield">
- <label>Total Paid:</label> <%= number_to_currency(@order.total) %>&nbsp;
- </li>
- </ol>
-
- <% if @order.credit_card_payment? %>
- <div class="textsm" style="font-size:0.75em;margin-top:1em;"><strong>Credit Card Information</strong></div>
- <div class="notes">
- <h5>Credit Card Information</h5>
- <p>Your credit card is processed on a secure server. We <strong>do not</strong> store any credit card information or details.</p>
- </div>
- <p>A balance of <strong><%= number_to_currency( @order.credit_card_payment) %></strong> will be charged to your credit card.</p>
- <ol class="clearfix">
- <li><label class="wide"><strong>Credit Card</strong></label><%=h @order.card_number_concealed %> <%= f.hidden_field :card_number, :value => @order.credit_card.number %><%# this sets the card_number temporarily back to the full value for processing %></li>
- <li><label class="wide"><strong>Card Security Number (CVV)</strong></label> <%=h @order.cvv.gsub(/./, "*") if @order.cvv? %></li>
- <li><label class="wide"><strong>Card Expiry</strong></label> <%=h @order.card_expiry %></li>
- <li><label class="wide"><strong>Cardholder Name</strong></label> <%=h @order.cardholder_name %></li>
- </ol>
- <% end %>
- </fieldset>
-</div>
-<div class="checkoutbuttons clearfix" id="checkout-submitbuttons">
- <%= link_to image_tag("/images/dt/nav_elements/go_back_a_step.png", :alt => "Go Back a Step"), edit_dt_checkout_path(:step => "billing") %>
- <%= image_submit_tag "/images/dt/nav_elements/checkout.png", :alt => 'Complete Checkout' %>
-</div>
-<div id="please-wait" style="display:none;text-align:right;">
- <%= image_tag "/images/dt/nav_elements/please_wait.gif", :alt => 'Please Wait...' %>
-</div>
-<% end %>
-<%- content_for :sidebar do -%>
- <h2><%= link_to "My Cart", dt_checkout_path, :method => :delete %></h2>
- <%= render :file => "dt/cart/sidebar" %>
- <%= render :file => "dt/accounts/profile_sidebar" %>
- <%= render :partial => 'dt/checkouts/verisign' %>
-<%- end -%>
+ <h2 class="plain dark">Receipt Information</h2>
+ <p><%= @order.updated_at.strftime('%B %d, %Y') %></p>
+ <p><%= @order.name %><br><%= @order.email %></p>
+ <%- if @order.multiline_address.present? -%>
+ <p>
+ <%= @order.multiline_address.join("<br>") %>
+ </p>
+ <%- end -%>
-<% content_for :google_analytics_path do %>/checkout/confirmation.html<% end %>
+ <table border="0" cellpadding="4" cellspacing="0" class="activity_summary">
+ <colgroup>
+ <col style="width:85%;" />
+ <col style="width:15%;" />
+ </colgroup>
+ <% @order.cart.all_items_donation_last.each do |line_item| %>
+ <%- partial_name = line_item.item.class.to_s.underscore -%>
+ <%- partial_name = 'subscription' if @order.created_subscription? && line_item.class == Investment && line_item.project == Project.admin_project -%>
+ <% content_tag_for :tr, line_item, :class => "line_item_row" do %>
+ <td class="textsm" style="text-align:left;">
+ <%= render :partial => "dt/cart/#{partial_name}", :locals => { :item => line_item.item } %>
+ </td>
+ <td class="textsm" style="text-align:right;"><%= number_to_currency(line_item.item.amount) %></td>
+ <% end %>
+ <% end %>
+ <tr class="total">
+ <td class="numeric">Total</td>
+ <td class="numeric"><%= number_to_currency @order.total %></td>
+ </tr>
+ </table>
+
+ <% semantic_form_for(@order, :url => dt_checkout_path, :html => {:id => "billingform", :method => :put}) do |f| %>
+ <%= f.semantic_errors :order %>
+ <%= hidden_field_tag "step", "confirm" %>
+ <%= hidden_field_tag "card_number", @order.full_card_number %>
+ <% f.buttons do %>
+ <%= link_to("back", edit_dt_checkout_path(:step => "credit_card"), :class => "bigbutton black") %>
+ <%= f.commit_button "finish" %>
+ <%= f.input :payment_options_step, :as => :hidden, :input_html => { :value => 1 } %>
+ <% end %>
+ <% end %>
+</div>
@@ -37,7 +37,7 @@
<% f.buttons do %>
<%= link_to("back", edit_dt_checkout_path(:step => @checkout_steps.include?("account_signup") ? "account_signup": "billing"), :class => "bigbutton black") %>
- <%= f.commit_button "finish" %>
+ <%= f.commit_button "next" %>
<% end %>
<% end %>
</div>
Oops, something went wrong.

0 comments on commit 0dd07c4

Please sign in to comment.