home *** CD-ROM | disk | FTP | other *** search
- <%@ page language="java" import="
- java.util.*,
- com.jproxy.site.mbeans.JMXInvocator,
- com.jproxy.site.mbeans.config.*,
- com.jproxy.site.ejbeans.interfaces.ISaleFormula,
- com.jproxy.site.ejbeans.interfaces.IProduct,
- com.jproxy.site.*"
- %>
-
- <jsp:useBean id="buycustomers" scope="request" class="com.jproxy.site.customers.Buy"/>
- <%
- buycustomers.request(pageContext);
- buycustomers.ses.setNewHit(pageContext, "hits", "OEM Buy Page", null);
- %>
-
- <%
- int licenses = 1;
- int purchasedLicenses = 0;
- String productName = "";
-
- String productID = buycustomers.getParameter("productid").trim();
- if(buycustomers.getParameter("licenses").trim().length()>0)
- licenses = new Integer(buycustomers.getParameter("licenses")).intValue();
- if(buycustomers.getParameter("purchased-licenses").trim().length()>0)
- purchasedLicenses = new Integer(buycustomers.getParameter("purchased-licenses")).intValue();
-
- // find out the number of licenses requested
- if (licenses <= 0)
- licenses = 1;
-
- if(productID.length()>0)
- productName = buycustomers.product.getProductName();
- else
- {
- %>
- <span class="h9Verdana">Failed to obtain Product Id!
- Please report this error to <a class="h8VerdanaBold" href="mailto:postmaster@jproxy.com">postmaster@jproxy.com</a></span>
- <%
- return;
- }
-
- String customerName = buycustomers.customer.getCustomerName();
- String host = "http://"+request.getServerName()+":"+request.getServerPort();
-
- boolean isDisabled = false;
- ISaleFormula formula = (ISaleFormula)buycustomers.getSaleFormulaByProductID(productID);
-
- int firstLicensePrice = formula.getFirstLicense();
- int additionalLicensePrice = formula.getAdditionalLicense();
- if(purchasedLicenses>0)
- firstLicensePrice = additionalLicensePrice;
-
- int customerId = 0;
- int invoice = 0;
-
- // calculate the TOTAL AMOUNT based on the number of licenses and the pricing model
- double lic_cost = firstLicensePrice * buycustomers.formula.getDiscount();
- lic_cost += (licenses-1) * additionalLicensePrice * buycustomers.formula.getDiscount();
- //double sup_cost = lic_cost * buycustomers.formula.getSupport() * support_licenses;
- double sup_cost = lic_cost * buycustomers.formula.getSupport();
-
- if(request.getParameter("submit_recalculate")!=null)
- {
- }
- if(request.getParameter("submit_purchase")!=null && request.getParameter("error")==null)
- {
- %>
- <jsp:forward page="purchase.jsp"/>
- <%
- }
- %>
- <!-- HEADER -->
- <jsp:include page="header.jsp" flush="true">
- <jsp:param name="name" value="ePortal - Purchasing Licenses and Technical Support"/>
- <jsp:param name="pageId" value="buy"/>
- </jsp:include>
-
- <!-- MAIN PANEL -->
- <%
- ConfigMBean mbean = (ConfigMBean)JMXInvocator.getMBean("JProxy:service=JProxyConfigMBean", ConfigMBean.class);
- //String productName = mbean.get("com.jproxy.proxy.name") + " " + mbean.get("com.jproxy.proxy.version");
- String invoiceStr = mbean.get("com.jproxy.commerce.invoice");
- try{
- invoice = Integer.parseInt(invoiceStr);
- }
- catch(Exception e)
- {
- invoice = 15;
- }
- %>
-
- <br>
- You're about to purchase licenses for your <span class="h9VerdanaBold"><%=customerName%></span> customer.
- <p>
- Once the payment is made the new total of purchased licenses will be changed to include newly purchased licenses.
- <p>
- Please enter the number of licenses you would like to purchase and click <b>Recalcualte</b> to get the updated price
- <p>
- <br>
- <table class="h9Verdana" cellpadding="5" width="100%" border="0">
- <!-- Prolog -->
- <tr>
- <td>
- <table class="h9Verdana" border="0" bgcolor="9c9cff" cellpadding="1" cellspacing="0">
- <tr><td>
- <%=productName%>
- </td></tr>
- <tr><td>
- <form method="get" action="buy.jsp">
- <table class="h8Verdana" border="0" bgcolor="white" cellpadding="5" cellspacing="1" width="100%">
- <tr>
- <td align="left">
- <br>
- Quantity:
- <input type="input" name="licenses" value="<%=licenses%>" size="3">
- <INPUT TYPE=HIDDEN NAME="customer-id" VALUE="<%=buycustomers.customerID%>">
- Licenses:
- <input type="text" name="total" READONLY value="$<%=lic_cost%>" size="8">
- Technical Support:
- <input type="text" name="total" READONLY value="$<%=sup_cost%>" size="8">
- Order Total:
- <input type="text" name="total" READONLY value="$<%=(lic_cost + sup_cost)%>" size="8">
- </td>
- </tr>
- <tr>
- <td class="h8Verdana" align="right">
- <INPUT TYPE=SUBMIT NAME=submit_recalculate WIDTH="20" VALUE="Recalculate">
- <INPUT TYPE=HIDDEN NAME="productid" VALUE="<%=buycustomers.product.getID()%>">
- <INPUT TYPE=HIDDEN NAME="purchased-licenses" VALUE="<%=purchasedLicenses%>">
- </td>
- </tr>
- </table>
- </form>
- <!-- begin separator -->
- </td></tr>
- <tr><td>
- <!-- end separator -->
- <table class="h8Verdana" width="100%" border="0" bgcolor="white" cellpadding="5" cellspacing="0" >
- <tr>
- <td align="left">
- When you're ready to proceed to a secure payment form
- please press the <b>Purchase</b> button
- </td>
- <td align="right">
- <br>
- <%
- String headerHTML = "<font size=30 color=#6331CE>JProxy</font>";
- headerHTML += "<font size=10 color=#9C00FF>.com</font>";
- String footerHTML = "<font size=2><em>Copyright 2001-2002, JProxy</em></font>";
- String description = "productName : "+productName;
- description += "<br>Customer Name : "+customerName;
- description += "<br>Licenses # : "+licenses+" ($"+lic_cost+")";
- description += "<br>Technical support : $"+sup_cost;
- %>
- <FORM METHOD=POST ACTION="https://secure.authorize.net/gateway/transact.dll">
- <INPUT TYPE=HIDDEN NAME="number_of_licenses" VALUE="<%=licenses%>">
- <INPUT TYPE=HIDDEN NAME="customer-id" VALUE="<%=buycustomers.customerID%>">
- <INPUT TYPE=HIDDEN NAME="productid" VALUE="<%=buycustomers.product.getID()%>">
- <INPUT TYPE=HIDDEN NAME="parent-id" VALUE="<%=buycustomers.ses.getLogin().getID()%>">
- <INPUT TYPE=HIDDEN NAME="x_amount" VALUE="<%=(lic_cost + sup_cost)%>">
- <INPUT TYPE=HIDDEN NAME="x_Version" VALUE="3.0">
- <INPUT TYPE=HIDDEN NAME="x_Login" VALUE="jproxyllc">
- <INPUT TYPE=HIDDEN NAME="x_Show_Form" VALUE="PAYMENT_FORM">
- <INPUT TYPE=HIDDEN NAME="x_Cust_ID" VALUE="<%=customerId%>">
- <INPUT TYPE=HIDDEN NAME="x_Invoice_Num" VALUE="<%=invoice%>">
- <INPUT TYPE=HIDDEN NAME="x_Description" VALUE="<%=description%>">
- <!-- INPUT TYPE=HIDDEN NAME="x_Logo_URL" VALUE="http://jproxy.com/main/resources/jproxy.gif" -->
- <INPUT TYPE=HIDDEN NAME="x_Header_HTML_Payment_Form" VALUE="<%=headerHTML%>">
- <INPUT TYPE=HIDDEN NAME="x_Footer_HTML_Payment_Form" VALUE="<%=footerHTML%>">
- <INPUT TYPE=HIDDEN NAME="x_Receipt_Link_Method" VALUE="GET">
- <INPUT TYPE=HIDDEN NAME="x_Receipt_Link_Text" VALUE="Click here to continue">
- <INPUT TYPE=HIDDEN NAME="x_Receipt_Link_URL" VALUE="<%=host%>/main/customers/purchase.jsp;jsessionid=<%=request.getSession().getId()%>">
- <INPUT TYPE=SUBMIT NAME=submit_purchase WIDTH="20" VALUE="Purchase">
- </FORM>
- </td>
- </tr>
- </table>
- </td></tr>
- </table>
- </td>
- </tr>
- </table>
-
- <!-- FOOTER -->
- <jsp:include page="footer.jsp" flush="true"/>
-