PageRenderTime 25ms CodeModel.GetById 19ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Kona.Web/Views/Themes/Blue/PayPal.aspx

#
ASP.NET | 131 lines | 115 code | 16 blank | 0 comment | 0 complexity | 41f2b3d8459433c9471d09817e472bad MD5 | raw file
Possible License(s): BSD-3-Clause
  1<%@ Page Title="" Language="C#" MasterPageFile="Theme.Master" Inherits="System.Web.Mvc.ViewPage" %>
  2<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
  3    <title><%=this.SiteData().SiteName %>: Checkout with PayPal</title>
  4</asp:Content>
  5<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
  6
  7<div id="bdy">
  8    <div class="colmiddle780 cntr">
  9        <h2>Pay with PayPal</h2>
 10            <div class="wrap">
 11                You are about to be redirected to PayPal.com to purchase this order. 
 12                Once payment is completed, please be sure to let PayPal redirect you 
 13                back to this site. When PayPal redirects you, they send along your transaction 
 14                information which we need in order to complete and reconcile your payment.
 15            </div>
 16        <h2>Select Shipping</h2>
 17        <%using (Html.BeginForm()) { %>
 18            <%foreach (ShippingMethod m in this.ShippingMethods().OrderBy(x=>x.Cost)) { %>
 19                
 20                <li><input onclick="this.form.submit();" type="radio" value="<%=m.ID %>" name="id" <%=Html.IsChecked(m.ID, this.CurrentCart().ShippingMethodID)%>> <%=m.Display %></li>
 21        
 22            <%} %>
 23        <%} %>
 24        <div class="wrap">
 25        <h2>Order Details</h2>
 26
 27        <table width="400">
 28            <tr>
 29                <td width="50%">
 30                    <p><b>Shipping To:</b></p>
 31                    <p>
 32                    <%Html.RenderPartial("AddressDisplay",this.CurrentCart().ShippingAddress); %>
 33                    </p>
 34                </td>
 35                 <td width="50%">
 36                    <p><b>Billing To:</b></p>
 37                    <p>
 38                    
 39                    <%Html.RenderPartial("AddressDisplay", this.CurrentCart().BillingAddress); %>
 40
 41                    </p>
 42                 </td>
 43            </tr>
 44        </table>        
 45        <hr />
 46        
 47        <table cellspacing="0" cellpadding="5" width="100%">
 48            <tr>
 49                <td><b>Quantity</b></td>
 50                <td ><b>Item</b></td>
 51                <td  align="right"><b>Regular</b></td>
 52                <td  align="right"><b>Total</b></td>
 53            </tr>
 54
 55            <%foreach(ShoppingCartItem item in this.CurrentCart().Items){%>
 56            <tr>
 57                <td ><%=item.Quantity %></td>
 58                <td ><%=item.Product.Name%></td>
 59                <td  align="right"><%=item.Product.Price.ToString("C")%></td>
 60                <td  align="right"><%=item.LineTotal.ToString("C") %></td>
 61            </tr>
 62
 63            <%} %>
 64             <tr>
 65                <td colspan="4"><hr /></td>
 66             </tr>
 67             <tr>
 68                <td colspan="3" align="right">Subtotal</td>
 69                <td align="right"><%= this.CurrentCart().SubTotal.ToString("C")%></td>
 70             </tr>
 71              <tr>
 72                <td colspan="3" align="right">Tax</td>
 73                <td align="right"><%= this.CurrentCart().TaxAmount.ToString("C")%></td>
 74             </tr>
 75             <tr>
 76                <td colspan="3" align="right">Shipping (<%= this.CurrentCart().ShippingService%>)</td>
 77                <td align="right"><%= this.CurrentCart().ShippingAmount.ToString("C")%></td>
 78             </tr>
 79             <tr>
 80                <td colspan="3" align="right">Discount:</td>
 81                <td align="right">-<%= this.CurrentCart().DiscountAmount.ToString("C")%></td>
 82             </tr>
 83              <tr>
 84                <td colspan="3" align="right">Grand Total</td>
 85                <td align="right"><b><%= this.CurrentCart().Total.ToString("C")%></b></td>
 86             </tr>
 87        </table>
 88        </div>
 89        <form id="Paypal" name="Paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
 90
 91            <%=Html.Hidden("cmd", "_cart")%>
 92            <%=Html.Hidden("upload", "1")%>
 93            <%=Html.Hidden("business", this.SiteData().PayPalBusinessEmail)%>
 94            <%=Html.Hidden("custom", this.CurrentCart().UserName.ToString())%>
 95            <%=Html.Hidden("tax_cart", this.CurrentCart().TaxAmount.ToLocalCurrency())%>
 96            <%=Html.Hidden("currency_code", this.SiteData().CurrencyCode)%>
 97            
 98            <%=Html.Hidden("return", Url.Action("pdt","paypal"))%>
 99            <%=Html.Hidden("cancel_return", Url.Action("Show","Order"))%>
100      
101        <%if(this.CurrentCart().ShippingAddress!=null){ %>
102
103            <%=Html.Hidden("first_name", this.CurrentCart().ShippingAddress.FirstName)%>
104            <%=Html.Hidden("last_name", this.CurrentCart().ShippingAddress.LastName)%>
105            <%=Html.Hidden("address1", this.CurrentCart().ShippingAddress.Street1)%>
106            <%=Html.Hidden("address2", this.CurrentCart().ShippingAddress.Street2)%>
107            <%=Html.Hidden("city", this.CurrentCart().ShippingAddress.City)%>
108            <%=Html.Hidden("state", this.CurrentCart().ShippingAddress.StateOrProvince)%>
109            <%=Html.Hidden("country", this.CurrentCart().ShippingAddress.Country)%>
110            <%=Html.Hidden("zip", this.CurrentCart().ShippingAddress.Zip)%>
111
112        <%} 
113        int itemIndex = 1;
114        foreach(var item in this.CurrentCart().Items){ %>
115
116            <%=Html.Hidden("item_name_"+itemIndex, item.Product.Name)%>
117            <%=Html.Hidden("amount_" + itemIndex, item.Product.Price.ToLocalCurrency())%>
118            <%=Html.Hidden("item_number_" + itemIndex, item.Product.SKU)%>
119            <%=Html.Hidden("quantity_" + itemIndex, item.Quantity.ToString())%>
120            <%=Html.Hidden("shipping_" + itemIndex, (this.CurrentCart().ShippingAmount / this.CurrentCart().Items.Count()).ToLocalCurrency())%>
121           
122            <%itemIndex++;
123        } %>
124        <div class="checkout-button">
125        <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="margin-right:7px;" />
126        </div>
127        </form>
128        </div>
129    </div>
130</div>
131</asp:Content>