home *** CD-ROM | disk | FTP | other *** search
- <SCRIPT runat="server" language="JScript">
-
- // *****************************************************************************
- //
- // plugnpay.actions5.asp
- //
- // Plug'n Pay support for Dynamic Link.
- //
- // COPYRIGHT (c) 2000 Adobe Systems Incorporated. All rights reserved.
-
-
- // -----------------------------------------------------------------------------
- // SetupPlugNPayCheckout
- //
- // Write the form controls onto the page needed to process the current
- // shopping basket using Plug'n Pay. The page must include the E-Commerce
- // Information content source so that this function can access the contents
- // of the shopping cart.
- //
- // publisher-name username issued by Plug'n Pay
- // publisher-email e-mail address to send order confirmation
- // success-link url to success page
- // badcard-link url to failed credit check page
- // problem-link url to general error page
- //
- // Other variables are described in the Plug'n Pay documentation.
- // -----------------------------------------------------------------------------
-
- function SetupPlugNPayCheckout(contentSource, allRecords, publisher_name,
- publisher_email, success_link, badcard_link,
- problem_link)
- {
- var pnpVariables = new Array;
-
- pnpVariables["easycart"] = 1;
- pnpVariables["app-level"] = 3;
-
- pnpVariables["publisher-name"] = publisher_name;
- pnpVariables["publisher-email"] = publisher_email;
-
- var thisPage = Request("URL");
- if (Request("HTTPS") == "ON") {
- var serverString = "HTTPS://" + Request("SERVER_NAME") + ":" + Request("SERVER_PORT");
- } else {
- var serverString = "HTTP://" + Request("SERVER_NAME") + ":" + Request("SERVER_PORT");
- }
- var queryString = Request("QUERY_STRING");
- if (String(success_link).length) {
- pnpVariables["success-link"] = serverString + absolutePath(thisPage, success_link) + queryString;
- }
- if (String(badcard_link).length) {
- pnpVariables["badcard-link"] = serverString + absolutePath(thisPage, badcard_link) + queryString;
- }
- if (String(problem_link).length) {
- pnpVariables["problem-link"] = serverString + absolutePath(thisPage, problem_link) + queryString;
- }
-
- pnpVariables["card-amount"] = orderForm.Value("_total_total");
- orderForm.items.MoveFirst();
- var n = 0;
- while (!orderForm.items.EOF) {
- n++;
- pnpVariables["item" + n] = orderForm.items.Value("SKU");
- pnpVariables["cost" + n] = orderForm.items.Value("_iadjust_currentprice");
- pnpVariables["quantity" + n] = orderForm.items.Value("Quantity");
- pnpVariables["description" + n] = orderForm.items.Value("_product_name");
- orderForm.items.MoveNext();
- }
-
- //Close parent <input>
- Response.Write(">\n");
-
- // Write out the plug'n pay variables:
- for (var x in pnpVariables) {
- Response.Write("<input type='hidden' name='" + x + "' value='" + pnpVariables[x] + "'>\n");
- }
-
- //Protect original close of parent <input>
- Response.Write( "<" );
- Response.Write( "wbr" );
- }
-
- // -----------------------------------------------------------------------------
- // PlugNPayCheckout
- // -----------------------------------------------------------------------------
-
- function PlugNPayCheckout()
- {
- var publisherName = Request("publisher-name");
- var queryString = Request.QueryString;
- var postData = Request.Form;
- var url = "https://pay1.plugnpay.com/payment/" + publisherName + "pay.cgi" + "?" + queryString + postData;
- Response.Redirect(url);
- }
-
- // -----------------------------------------------------------------------------
- // Dispatch
- // -----------------------------------------------------------------------------
-
- if (String(Request.ServerVariables("PATH_TRANSLATED")).indexOf("plugnpay.actions5.asp") >= 0)
- {
- PlugNPayCheckout();
- }
-
- </SCRIPT>
-