forked from tomash/spree-pp-website-standard
/
_paypal_checkout.html.erb
52 lines (42 loc) · 2.89 KB
/
_paypal_checkout.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<%- if(RAILS_ENV == 'development')
submit_url = Spree::Paypal::Config[:sandbox_url]
else
submit_url = Spree::Paypal::Config[:paypal_url]
end
%>
<%= form_tag submit_url do %>
<!-- display payment summary here -->
<input id="business" name="business" type="hidden" value="<%= Spree::Paypal::Config[:account] %>" />
<input id="invoice" name="invoice" type="hidden" value="<%= @order.number %>" />
<% @order.line_items.each_with_index do |item, index| %>
<%- if item.variant.respond_to?(:paypal_name) %>
<input id="item_name_<%= index + 1 %>" name="item_name_<%= index + 1 %>" type="hidden" value="<%= item.variant.paypal_name %>" />
<% else %>
<input id="item_name_<%= index + 1 %>" name="item_name_<%= index + 1 %>" type="hidden" value="<%= item.variant.product.name %>" />
<% end %>
<input id="amount_<%= index + 1 %>" name="amount_<%= index + 1 %>" type="hidden" value="<%= item.price %>" />
<input id="quantity_<%= index + 1 %>" name="quantity_<%= index + 1 %>" type="hidden" value="<%= item.quantity %>" />
<% end %>
<!-- input id="amount" name="amount" type="hidden" value="58.97" /-->
<input id="currency_code" name="currency_code" type="hidden" value="<%= Spree::Paypal::Config[:currency_code] %>" />
<input id="handling_cart" name="handling_cart" type="hidden" value="<%= @order.ship_total %>" />
<input id="tax_cart" name="tax_cart" type="hidden" value="<%= @order.tax_total %>" />
<!-- <input name="no_shipping" type="hidden" value="1" /> -->
<input id="cmd" name="cmd" type="hidden" value="_cart" />
<input type="hidden" name="upload" value="1" />
<input id="notify_url" name="notify_url" type="hidden" value="<%= Spree::Paypal::Config[:ipn_notify_host] + order_paypal_payments_path(@order) %>" />
<input type="hidden" name="rm" value ="2"> <!-- tells paypal that the return should be POST instead of GET -->
<input id="return" name="return" type="hidden" value="<%= Spree::Paypal::Config[:success_url] %>" />
<!-- input id="address_override" name="address_override" type="hidden" value="0" />
<input id="charset" name="charset" type="hidden" value="utf-8" />
<input id="no_note" name="no_note" type="hidden" value="1" />
<input id="no_shipping" name="no_shipping" type="hidden" value="1" />
<input id="item_name" name="item_name" type="hidden" value="Store purchase" />
<input id="return" name="return" type="hidden" value="http://localhost:3000/account/show" />
<input id="currency_code" name="currency_code" type="hidden" value="USD" />
<input id="cancel_return" name="cancel_return" type="hidden" value="http://localhost:3000/account/show" />
<input id="custom" name="custom" type="hidden" value="11" />
<input id="item_number" name="item_number" type="hidden" value="11" / -->
<!-- input id="bn" name="bn" type="hidden" value="ActiveMerchant" /-->
<%= image_submit_tag "pp_checkout.gif" %>
<% end -%>