/** * Redirect the customer to VCS's site to enter their payment details */ public function TransferToProvider() { $VCSTerminalID = $this->GetValue("vcsterminalid"); $order = LoadPendingOrderByToken($_COOKIE['SHOP_ORDER_TOKEN']); $vcs_url = "https://www.vcs.co.za/vvonline/ccform.asp"; $amount = $this->gettotal(); // vcs can't process amount exceeding 10 digits (ISC-1003) if ($amount >= 100000.0000) { // drop last 2 decimal $amount = number_format($amount, 2); } $hiddenFields = array( 'p1' => $VCSTerminalID, 'p2' => $order['orderid'], 'p3' => getLang('YourOrderFromX', array('storeName' => getConfig('StoreName'))), 'p4' => $amount, 'p5' => 'ZAR', 'p10' => $GLOBALS['ShopPathSSL'].'/finishorder.php', 'm_1' => $this->_calculateSecurityHash($order, $amount), 'CardholderEmail' => isc_html_escape($order['ordbillemail']), ); $this->RedirectToProvider($vcs_url, $hiddenFields); }
/** * Redirect the customer to VCS's site to enter their payment details */ public function TransferToProvider() { $VCSTerminalID = $this->GetValue("vcsterminalid"); $order = LoadPendingOrderByToken($_COOKIE['SHOP_ORDER_TOKEN']); $vcs_url = "https://www.vcs.co.za/vvonline/ccform.asp"; $productNames = ''; foreach ($_SESSION['CART']['ITEMS'] as $item) { $productNames .= isc_html_escape($item['product_name']) . ", "; } $productNames = rtrim($productNames, ','); $amount = $this->gettotal(); // Fetch the customer details $query = sprintf("SELECT * FROM [|PREFIX|]customers WHERE customerid='%s'", $GLOBALS['ISC_CLASS_DB']->Quote($order['ordcustid'])); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $customer = $GLOBALS['ISC_CLASS_DB']->Fetch($result); $hiddenFields = array('p1' => $VCSTerminalID, 'p2' => $order['orderid'], 'p3' => $productNames, 'p4' => $amount, 'p5' => 'ZAR', 'p10' => $GLOBALS['ShopPathSSL'] . '/finishorder.php', 'CardholderEmail' => isc_html_escape($customer['custconemail'])); $this->RedirectToProvider($vcs_url, $hiddenFields); }
public function ShowPaymentForm() { // Was there an error validating the payment? If so, pre-fill the form fields with the already-submitted values if ($this->HasErrors()) { $fields = array("CreditCardNum" => 'creditcard_ccno'); foreach ($fields as $global => $post) { if (isset($_POST[$post])) { $GLOBALS[$global] = isc_html_escape($_POST[$post]); } } $errorMessage = implode("<br />", $this->GetErrors()); $GLOBALS['CreditCardErrorMessage'] = $errorMessage; } else { // Hide the error message box $GLOBALS['HideCreditCardError'] = "none"; } $pendingOrder = LoadPendingOrderByToken(); $GLOBALS['OrderAmount'] = CurrencyConvertFormatPrice($pendingOrder['ordgatewayamount'], $pendingOrder['ordcurrencyid'], $pendingOrder['ordcurrencyexchangerate']); // Collect their details to send through to CreditCard $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("valuteccard"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); }
/** * Create a new order in ISC based on a new-order-notification from google * * @return void **/ private function CreateOrder() { $this->LoadCart($this->module->cartid); $pendingOrder = $this->CalculateOrder(); $cartItems = $GLOBALS['ISC_CLASS_CART']->api->GetProductsInCart(); $checkoutSession = $_SESSION['CHECKOUT']; $pendingData = $checkoutSession['PENDING_DATA']; // Get a list of the vendors for all of the items in the cart, and loop through them // to build all of the pending orders $cartContent = $GLOBALS['ISC_CLASS_CHECKOUT']->BreakdownCartByAddressVendorforshipping(); //Changed to merging function by Simha $vendorOrderInfo = array(); foreach ($cartContent as $vendorId => $addresses) { foreach ($addresses as $addressId => $products) { $allDigital = 1; $productArray = array(); foreach ($products as $cartItemId => $product) { // A physical product, mark as so if ($product['data']['prodtype'] == PT_PHYSICAL) { $allDigital = 0; } // Mark the quantity of this item $productArray[$cartItemId] = $product['quantity']; } $vendorInfo = $pendingData['VENDORS'][$vendorId . '_' . $addressId]; $vendorData = array('itemtotal' => $vendorInfo['ITEM_TOTAL'], 'taxcost' => $vendorInfo['TAX_COST'], 'totalcost' => $vendorInfo['ORDER_TOTAL'], 'shippingcost' => $_SESSION['CHECKOUT']['SHIPPING'][$vendorId . '_0']['COST'], 'handlingcost' => $_SESSION['CHECKOUT']['SHIPPING'][$vendorId . '_0']['HANDLING'], 'shippingprovider' => $_SESSION['CHECKOUT']['SHIPPING'][$vendorId . '_0']['PROVIDER'], 'shippingmodule' => $_SESSION['CHECKOUT']['SHIPPING'][$vendorId . '_0']['MODULE'], 'isdigitalorder' => $allDigital, 'products' => $productArray); // Shipping zones can be configured per vendor, so we need to be sure // to pass this along correctly too if (isset($vendorInfo['SHIPPING_ZONE'])) { $shippingZone = GetShippingZoneById($vendorInfo['SHIPPING_ZONE']); if (is_array($shippingZone)) { $vendorData['ordshippingzoneid'] = $shippingZone['zoneid']; $vendorData['ordshippingzone'] = $shippingZone['zonename']; } } $vendorOrderInfo[$vendorId . '_' . $addressId] = $vendorData; } } $this->module->DebugLog($vendorData); // Work out the cost of the order, shipping etc $pendingOrder['ipaddress'] = ''; $pendingOrder['vendorinfo'] = $vendorOrderInfo; $pendingToken = CreateOrder($pendingOrder, $cartItems); if ($pendingToken === false) { $GLOBALS['ISC_CLASS_LOG']->LogSystemError($this->logtype, sprint(GetLang('GoogleCheckoutMissingCart'), isc_html_escape($this->module->cartid))); return; } $order = LoadPendingOrderByToken($pendingToken); $googleid = $this->response->data['new-order-notification']['google-order-number']['VALUE']; $this->SendGoogleNewOrderId($googleid, $order['orderid']); $updatedOrder = array('ordpayproviderid' => $googleid, 'ordpaymentstatus' => 'captured'); $this->module->DebugLog($order); $orderIds = array($order['orderid']); // Update the orders in the database $GLOBALS['ISC_CLASS_DB']->UpdateQuery('orders', $updatedOrder, "orderid IN (" . implode(',', $orderIds) . ")"); $completed = CompletePendingOrder($pendingToken, ORDER_STATUS_PENDING, false); if ($this->response->data['new-order-notification']['buyer-marketing-preferences']['email-allowed']['VALUE'] == 'true') { $this->SubscribeCustomerToLists($order['orderid']); } if (!$completed) { $GLOBALS['ISC_CLASS_LOG']->LogSystemError($this->logtype, sprintf(GetLang('GoogleCheckoutCantCompleteOrder'), isc_html_escape($pendingToken), isc_html_escape(var_export($completed, true)))); return; } $orderClass = GetClass('ISC_ORDER'); $orderClass->EmptyCartAndKillCheckout(); $GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess($this->logtype, sprintf(GetLang('GoogleCheckoutOrderCreated'), (int) $order['orderid'], isc_html_escape($googleid))); }
/** * ShowPaymentForm * Show a payment form for this particular gateway if there is one. * This is useful for gateways that require things like credit card details * to be submitted and then processed on the site. */ public function ShowPaymentForm() { $GLOBALS['CreditCardMonths'] = $GLOBALS['CreditCardYears'] = ''; $GLOBALS['CreditCardIssueDateMonths'] = $GLOBALS['CreditCardIssueDateYears'] = ''; $cc_type = ""; if(isset($_POST['creditcard_cctype'])) { $cc_type = $_POST['creditcard_cctype']; } $GLOBALS['CCTypes'] = $this->_GetCCTypes($cc_type); for ($i = 1; $i <= 12; $i++) { $stamp = mktime(0, 0, 0, $i, 15, date("Y")); $i = str_pad($i, 2, "0", STR_PAD_LEFT); if (isset($_POST['creditcard_ccexpm']) && $_POST['creditcard_ccexpm'] == $i) { $sel = 'selected="selected"'; } else { $sel = ""; } if(isset($_POST['creditcard_issuedatem']) && $_POST['creditcard_issuedatem'] == $i) { $issueSel = 'selected="selected"'; } else { $issueSel = ''; } $GLOBALS['CreditCardMonths'] .= sprintf("<option %s value='%s'>%s</option>", $sel, $i, date("M", $stamp)); $GLOBALS['CreditCardIssueDateMonths'] .= sprintf("<option %s value='%s'>%s</option>", $issueSel, $i, date("M", $stamp)); } for ($i = date("Y"); $i <= date("Y")+10; $i++) { if(isset($_POST['creditcard_ccexpy']) && $_POST['creditcard_ccexpy'] == isc_substr($i, 2, 2)) { $sel = 'selected="selected"'; } else { $sel = ""; } $GLOBALS['CreditCardYears'] .= sprintf("<option %s value='%s'>%s</option>", $sel, isc_substr($i, 2, 2), $i); } for ($i = date("Y"); $i > date("Y")-5; --$i) { if(isset($_POST['creditcard_issuedatey']) && $_POST['creditcard_issuedatey'] == isc_substr($i, 2, 2)) { $sel = 'selected="selected"'; } else { $sel = ""; } $GLOBALS['CreditCardIssueDateYears'] .= sprintf("<option %s value='%s'>%s</option>", $sel, isc_substr($i, 2, 2), $i); } if ($this->CardTypeRequiresCVV2($cc_type)) { $GLOBALS['CreditCardHideCardCode'] = ''; } else { $GLOBALS['CreditCardHideCardCode'] = 'none'; } // Was there an error validating the payment? If so, pre-fill the form fields with the already-submitted values if($this->HasErrors()) { $fields = array( "CreditCardName" => 'creditcard_name', "CreditCardNum" => 'creditcard_ccno', "CreditCardCardCode" => 'creditcard_cccvd', "CreditCardIssueNo" => 'creditcard_issueno' ); foreach($fields as $global => $post) { if(isset($_POST[$post])) { $GLOBALS[$global] = isc_html_escape($_POST[$post]); } } $errorMessage = implode("<br />", $this->GetErrors()); $GLOBALS['CreditCardErrorMessage'] = $errorMessage; } else { // Hide the error message box $GLOBALS['HideCreditCardError'] = "none"; } $pendingOrder = LoadPendingOrderByToken(); $GLOBALS['OrderAmount'] = CurrencyConvertFormatPrice($pendingOrder['total_inc_tax'], $pendingOrder['ordcurrencyid'], $pendingOrder['ordcurrencyexchangerate']); // Get additional payment page contents if there is any if(method_exists($this, 'GetAdditionalPaymentPageContents')) { $GLOBALS['AdditionalPaymentPageContents'] = $this->GetAdditionalPaymentPageContents(); } // Collect their details to send through to CreditCard $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("genericcreditcard"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); }
/** * Redirect the customer to LinkPointConnect's site to enter their payment details */ public function TransferToProvider() { $pendingdata = $_SESSION['CHECKOUT']['PENDING_DATA']; $itemcost = $this->GetSubTotal(); $shippingcost = $this->GetShippingCost() + $this->GetHandlingCost(); $taxcost = $this->GetTaxCost(); $total = $this->GetGatewayAmount(); $this->_storenumber = $this->GetValue("storenumber"); $transactiontype = $this->GetValue("transactiontype"); $testmode_on = $this->GetValue("testmode"); $gatewayprovider = $this->GetValue("gatewayprovider"); if ($testmode_on == "YES") { if ($gatewayprovider == 'lp') { $linkpointconnect_url = "https://staging.linkpt.net/lpc/servlet/lppay"; } else { $linkpointconnect_url = "https://www.staging.yourpay.com/lpcentral/servlet/lppay"; } } else { if ($gatewayprovider == 'lp') { $linkpointconnect_url = "https://www.linkpointcentral.com/lpc/servlet/lppay"; } else { $linkpointconnect_url = "https://secure.linkpt.net/lpcentral/servlet/lppay"; } } // Load the pending order $order = LoadPendingOrderByToken($_COOKIE['SHOP_ORDER_TOKEN']); $bcountry = GetCountryISO2ById($order['ordbillcountryid']); $scountry = GetCountryISO2ById($order['ordshipcountryid']); // Fetch the customer details $query = sprintf("SELECT * FROM [|PREFIX|]customers WHERE customerid='%s'", $GLOBALS['ISC_CLASS_DB']->Quote($order['ordcustid'])); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $customer = $GLOBALS['ISC_CLASS_DB']->Fetch($result); $phone = $customer['custconphone']; $phone = preg_replace("#[^\\+0-9]+#", "", $phone); //if it's us, we need to have find the us state code if ($bcountry == "US") { $bstate = GetStateISO2ById($order['ordbillstateid']); $bstate_name = 'bstate'; } else { $bstate = $order['ordbillstate']; $bstate_name = 'bstate2'; } if ($scountry == "US") { $sstate = GetStateISO2ById($order['ordshipstateid']); $sstate_name = 'sstate'; } else { $sstate = $order['ordshipstate']; $sstate_name = 'sstate2'; } ?> <html> <head> <title><?php echo GetLang('RedirectingToLinkPointConnect'); ?> </title> </head> <body onload="document.forms[0].submit()"> <a href="javascript:void(0)" onclick="document.forms[0].submit()" style="color:gray; font-size:12px"><?php echo GetLang('ClickIfNotRedirected'); ?> </a> <form name="linkpointconnect" id="linkpointconnect" action="<?php echo $linkpointconnect_url; ?> " method="post"> <input type="hidden" name="mode" value="fullpay"> <input type="hidden" name="chargetotal" value="<?php echo $total; ?> "> <input type="hidden" name="tax" value="<?php echo $taxcost; ?> "> <input type="hidden" name="shipping" value="<?php echo $shippingcost; ?> "> <input type="hidden" name="subtotal" value="<?php echo $itemcost; ?> "> <input type="hidden" name="storename" value="<?php echo $this->_storenumber; ?> "> <input type="hidden" name="txntype" value="<?php echo $transactiontype; ?> "> <input type="hidden" name="bname" value="<?php echo isc_html_escape($order['ordbillfirstname'] . ' ' . $order['ordbilllastname']); ?> " /> <input type="hidden" name="email" value="<?php echo isc_html_escape($customer['custconemail']); ?> " /> <input type="hidden" name="phone" value="<?php echo $phone; ?> " /> <input type="hidden" name="baddr1" value="<?php echo isc_html_escape($order['ordbillstreet1']); ?> " /> <input type="hidden" name="baddr2" value="<?php echo isc_html_escape($order['ordbillstreet2']); ?> " /> <input type="hidden" name="bcountry" value="<?php echo isc_html_escape($bcountry); ?> " /> <input type="hidden" name="bzip" value="<?php echo isc_html_escape($order['ordbillzip']); ?> " /> <input type="hidden" name="bcity" value="<?php echo isc_html_escape($order['ordbillsuburb']); ?> " /> <input type="hidden" name="<?php echo isc_html_escape($bstate_name); ?> " value="<?php echo isc_html_escape($bstate); ?> " /> <input type="hidden" name="sname" value="<?php echo isc_html_escape($order['ordshipfirstname'] . ' ' . $order['ordshiplastname']); ?> " /> <input type="hidden" name="saddr1" value="<?php echo isc_html_escape($order['ordshipstreet1']); ?> " /> <input type="hidden" name="saddr2" value="<?php echo isc_html_escape($order['ordshipstreet2']); ?> " /> <input type="hidden" name="scountry" value="<?php echo isc_html_escape($scountry); ?> " /> <input type="hidden" name="szip" value="<?php echo isc_html_escape($order['ordshipzip']); ?> " /> <input type="hidden" name="scity" value="<?php echo isc_html_escape($order['ordshipsuburb']); ?> " /> <input type="hidden" name="<?php echo isc_html_escape($sstate_name); ?> " value="<?php echo isc_html_escape($sstate); ?> " /> </form> </body> </html> <?php exit; }
/** * ShowPaymentForm * Show a payment form for this particular gateway if there is one. * This is useful for gateways that require things like credit card details * to be submitted and then processed on the site. */ public function ShowPaymentForm() { $GLOBALS['eSelectPlusDPMonths'] = ""; $GLOBALS['eSelectPlusDPYears'] = ""; $selectedMonth = ''; $selectedYear = ''; if(isset($_POST['expMonth'])) { $selectedMonth = $_POST['expMonth']; } else if(isset($_SESSION['CHECKOUT']['ESELECTDP']['expMonth'])) { $selectedMonth = $_SESSION['CHECKOUT']['ESELECTDP']['expMonth']; } for($i = 1; $i <= 12; $i++) { $stamp = mktime(0, 0, 0, $i, 15, isc_date("Y")); $i = str_pad($i, 2, "0", STR_PAD_LEFT); $sel = ''; if ($selectedMonth == $i) { $sel = 'selected="selected"'; } $GLOBALS['eSelectPlusDPMonths'] .= sprintf("<option %s value='%s'>%s</option>", $sel, $i, isc_date("M", $stamp)); } if(isset($_POST['expYear'])) { $selectedYear = $_POST['expYear']; } else if(isset($_SESSION['CHECKOUT']['ESELECTDP']['expYear'])) { $selectedYear = $_SESSION['CHECKOUT']['ESELECTDP']['expYear']; } for($i = isc_date("Y"); $i < isc_date("Y")+10; $i++) { $sel = ''; if ($selectedYear == substr($i, 2, 2)) { $sel = 'selected="selected"'; } $GLOBALS['eSelectPlusDPYears'] .= sprintf("<option %s value='%s'>%s</option>", $sel, substr($i, 2, 2), $i); } // Load the pending order $pendingOrder = LoadPendingOrderByToken(); // take the first word of the street line as street number. // this will not work for an address like "unit 1 78 Hello Street" $streetline = $pendingOrder['ordbillstreet1']; if(preg_match('#^[0-9]+\s#', $streetline)) { $streetline = explode(' ', $streetline, 2); $streetnum = $streetline[0]; $streetname = $streetline[1]; } else { $streetnum = ''; $streetname = $streetline; } $GLOBALS['eSelectPlusDPBillStNum'] = isc_html_escape($streetnum); $GLOBALS['eSelectPlusDPBillStName'] = isc_html_escape($streetname); $GLOBALS['eSelectPlusDPCardHolderName'] = isc_html_escape($pendingOrder['ordbillfirstname'].' '.$pendingOrder['ordbilllastname']); $GLOBALS['eSelectPlusDPBillZip'] = isc_html_escape($pendingOrder['ordbillzip']); // Format the amount that's going to be going through the gateway $GLOBALS['OrderAmount'] = CurrencyConvertFormatPrice($pendingOrder['total_inc_tax'], $pendingOrder['ordcurrencyid'], $pendingOrder['ordcurrencyexchangerate']); // Was there an error validating the payment? If so, pre-fill the form fields with the already-submitted values if($this->HasErrors()) { $GLOBALS['eSelectPlusDPErrorMessage'] = implode("<br />", $this->GetErrors()); } else { // Hide the error message box $GLOBALS['HideeSelectPlusDPError'] = "none"; } // If we have any fields we can remember the value of, take them & set them $rememberedFields = array( 'eSelectPlusDPCardHolderName' => 'cardholder', 'eSelectPlusDPBillStNum' => 'avs_street_number', 'eSelectPlusDPBillStName' => 'avs_street_name', 'eSelectPlusDPBillZip' => 'avs_zipcode' ); foreach($rememberedFields as $field => $from) { if(isset($_POST[$from])) { $GLOBALS[$field] = isc_html_escape($_POST[$from]); } else if(isset($_SESSION['CHECKOUT']['ESELECTDP'][$from])) { $GLOBALS[$field] = isc_html_escape($_SESSION['CHECKOUT']['ESELECTDP'][$from]); } } // Collect their details to send through to Authorize.NET $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("eselectplusdp"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); }
/** * Verify the order by checking the PayPal Express Checkout variables */ public function VerifyOrderPayment() { // The *only* way someone can end up here is AFTER the order has ALREADY been validated, so we pass an MD5 has of the pending // order token in the $_GET array and compare that to the pending token, returning true if they are equal and false if not. if(isset($_COOKIE['SHOP_ORDER_TOKEN']) && isset($_REQUEST['o']) && md5(GetConfig('EncryptionToken').$_COOKIE['SHOP_ORDER_TOKEN']) == $_REQUEST['o']) { $orders = $this->GetOrders(); reset($orders); $orderId = '#'.implode(', #', array_keys($orders)); //$orders = $this->GetOrders(); //$orderIds = '#'.implode(', #', array_keys($orders)); $order = LoadPendingOrderByToken($_COOKIE['SHOP_ORDER_TOKEN']); $orderId = '#'.$order['orderid']; $nvpArray = $_SESSION['PayPalExpressResponse']; unset($_SESSION['PayPalExpressResponse']); $responseMsg = isc_html_escape($nvpArray['ACK']); $transactionId = ''; if (isset($nvpArray['TRANSACTIONID'])) { $transactionId = isc_html_escape($nvpArray['TRANSACTIONID']); } // Load the paypal transaction Type //$transactionType = $this->GetValue('transactiontype'); //if transaction is successful if (strtolower($responseMsg) == 'success') { // if($transactionType == 'Authorization') { if($nvpArray['PAYMENTSTATUS'] == 'Pending') { $paymentStatus = 'authorized'; } else { $paymentStatus = 'captured'; } if($nvpArray['PAYMENTTYPE'] == 'echeck' && $nvpArray['PAYMENTSTATUS'] == 'Pending') { $orderStatus = PAYMENT_STATUS_PENDING; $paymentStatus = ''; } else { $orderStatus = PAYMENT_STATUS_PAID; } $updatedOrder = array( 'ordpayproviderid' => $transactionId, 'ordpaymentstatus' => $paymentStatus ); $this->UpdateOrders($updatedOrder); $paypalPaymentStatus = ''; if(isset($nvpArray['PAYMENTSTATUS'])) { $paypalPaymentStatus = $nvpArray['PAYMENTSTATUS']; } $paymentSuccess = sprintf(GetLang('PayPalExpressSuccess'), $orderId); $paymentMessage = sprintf(GetLang('PayPalExpressDetails'), $transactionId, $paypalPaymentStatus, $nvpArray['PENDINGREASON']); $GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->GetName()), $paymentSuccess, $paymentMessage); //set order status $this->SetPaymentStatus($orderStatus); return true; } else { $errorMsg = ''; if(isset($nvpArray['L_LONGMESSAGE0'])) { $errorMsg = isc_html_escape($nvpArray['L_LONGMESSAGE0']); } $paypalPaymentStatus = ''; if(isset($nvpArray['PAYMENTSTATUS'])) { $paypalPaymentStatus = $nvpArray['PAYMENTSTATUS']; } // Status was declined or error, show the response message as an error $error = sprintf(GetLang('PayPalExpressError'), $orderId); $errorDetails = sprintf(GetLang('PayPalExpressErrorDetails'), $transactionId, $paypalPaymentStatus, $errorMsg); $GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), $error, $errorDetails); return false; } } else { return false; } }
/** * Redirect the customer to iDeal's site to enter their payment details */ public function transfertoprovider() { $total = $this->gettotal() * 100; $this->_merchantid = $this->GetValue("merchantid"); $secretkey = $this->GetValue("secretkey"); $testmode_on = $this->GetValue("testmode"); $validUntil = date("Y-m-d\\TG:i:s\\Z", strtotime("+1 week")); // Load the pending order $order = LoadPendingOrderByToken($_COOKIE['SHOP_ORDER_TOKEN']); $itemString = ''; $orderItems = $_SESSION['CART']['ITEMS']; foreach ($orderItems as $item) { $itemNumber = $item['product_id']; $itemDescription = $item['product_name']; $itemQuantity = $item['quantity']; $itemPrice = $item['product_price'] * 100; $itemString .= $itemNumber . $itemDescription . $itemQuantity . $itemPrice; } $hashString = $secretkey . $this->_merchantid . "0" . $total . $order['orderid'] . "ideal" . $validUntil . $itemString; $clean_hashString = HTML_entity_decode($hashString); $not_allowed = array("\t", "\n", "\r", " "); $clean_hashString = str_replace($not_allowed, "", $clean_hashString); $clean_hashString = sha1($clean_hashString); $shipping_cost = $order['ordshipcost'] + $order['ordhandlingcost']; if ($testmode_on == "YES") { $ideal_url = "https://idealtest.rabobank.nl/ideal/mpiPayInitRabo.do"; } else { $ideal_url = "https://ideal.rabobank.nl/ideal/mpiPayInitRabo.do"; } ?> <html> <head> <title><?php echo GetLang('RedirectingToiDeal'); ?> </title> </head> <body onload="document.forms[0].submit()"> <a href="javascript:void(0)" onclick="document.forms[0].submit()" style="color:gray; font-size:12px"><?php echo GetLang('ClickIfNotRedirected'); ?> </a> <form name="ideal" id="ideal" action="<?php echo $ideal_url; ?> " method="post"> <INPUT type="hidden" NAME="merchantID" value="<?php echo $this->_merchantid; ?> "> <INPUT type="hidden" NAME="subID" value="0"> <INPUT type="hidden" NAME="amount" VALUE="<?php echo $total; ?> " > <INPUT type="hidden" NAME="purchaseID" VALUE="<?php echo $order['orderid']; ?> "> <INPUT type="hidden" NAME="currency" VALUE="EUR"> <INPUT type="hidden" NAME="hash" size="50" VALUE="<?php echo $clean_hashString; ?> "> <INPUT type="hidden" NAME="paymentType" VALUE="ideal"> <INPUT type="hidden" NAME="validUntil" VALUE="<?php echo $validUntil; ?> "> <INPUT type="hidden" NAME="urlCancel" VALUE="<?php echo $GLOBALS['ShopPathSSL']; ?> /cart.php"> <INPUT type="hidden" NAME="urlSuccess" VALUE="<?php echo $GLOBALS['ShopPathSSL']; ?> /finishorder.php?status=success"> <INPUT type="hidden" NAME="urlError" VALUE="<?php echo $GLOBALS['ShopPathSSL']; ?> /finishorder.php?status=fail"> <?php if ($shipping_cost != 0) { ?> <INPUT type="hidden" NAME="itemNumber0" VALUE="0"> <INPUT type="hidden" NAME="itemDescription0" size="32" VALUE="<?php echo GetLang("ShippingCost"); ?> "> <INPUT type="hidden" NAME="itemQuantity0" VALUE="1"> <INPUT type="hidden" NAME="itemPrice0" VALUE="<?php echo $shipping_cost * 100; ?> "> <? } $i = 1; foreach ($orderItems as $item) { $itemSubtotal = $item['quantity']*$item['product_price']; ?> <INPUT type="hidden" NAME="itemNumber<?php echo $i; ?> " VALUE="<?php echo (int) $item['product_id']; ?> "> <INPUT type="hidden" NAME="itemDescription<?php echo $i; ?> " size="32" VALUE="<?php echo isc_html_escape($item['product_name']); ?> "> <INPUT type="hidden" NAME="itemQuantity<?php echo $i; ?> " VALUE="<?php echo (int) $item['quantity']; ?> "> <INPUT type="hidden" NAME="itemPrice<?php echo $i; ?> " VALUE="<?php echo $item['product_price'] * 100; ?> "> <?php $i++; } ?> </form> </body> </html> <?php exit; }
protected function _ConstructPostData($postData) { $transactionid = $this->GetCombinedOrderId(); $pendingOrder = LoadPendingOrderByToken(); $description = sprintf(GetLang('ProtxVspDirectOrderFromX'), $transactionid, $GLOBALS['StoreName']); $ccname = $postData['name']; $cctype = $postData['cctype']; $ccissueno = $postData['ccissueno']; $ccissuedatem = $postData['ccissuedatem']; $ccissuedatey = $postData['ccissuedatey']; $ccnum = $postData['ccno']; $ccexpm = $postData['ccexpm']; $ccexpy = $postData['ccexpy']; $cccvd = $postData['cccvd']; $currency = GetDefaultCurrency(); $amount = number_format($this->GetGatewayAmount(),2,'.',''); $billState = ''; if($pendingOrder['ordbillcountrycode'] == 'US') { $billState = GetStateISO2ById($pendingOrder['ordbillstateid']); } $shippingAddress = $this->getShippingAddress(); $shipState = ''; if($shippingAddress['country_iso2'] == 'US') { $shipState = GetStateISO2ById($shipingAddress['state_id']); } $TransType = 'DEFERRED'; if($this->GetValue('transactiontype')) { $TransType = $this->GetValue('transactiontype'); } // Contstruct the POST data $vspdirect_post = array( 'VPSProtocol' => '2.23', 'TxType' => $TransType, 'Vendor' => $this->GetValue("vendorname"), 'VendorTxCode' => 'ISC-'.$transactionid, 'Description' => $description, 'CardType' => $cctype, 'CardNumber' => $ccnum, 'CardHolder' => $ccname, 'ExpiryDate' => $ccexpm.$ccexpy, 'Amount' => $amount, 'Currency' => $currency['currencycode'], 'BillingSurname' => $pendingOrder['ordbilllastname'], 'BillingFirstnames' => $pendingOrder['ordbillfirstname'], 'BillingAddress1' => $pendingOrder['ordbillstreet1'], 'BillingAddress2' => $pendingOrder['ordbillstreet2'], 'BillingCity' => $pendingOrder['ordbillsuburb'], 'BillingState' => $billState, 'BillingPostCode' => $pendingOrder['ordbillzip'], 'BillingCountry' => $pendingOrder['ordbillcountrycode'], 'BillingPhone' => $pendingOrder['ordbillphone'], 'DeliverySurname' => $shippingAddress['last_name'], 'DeliveryFirstnames'=> $shippingAddress['first_name'], 'DeliveryAddress1' => $shippingAddress['address_1'], 'DeliveryAddress2' => $shippingAddress['address_2'], 'DeliveryCity' => $shippingAddress['city'], 'DeliveryState' => $shipState, 'DeliveryPostCode' => $shippingAddress['zip'], 'DeliveryCountry' => $shippingAddress['country_iso2'], 'DeliveryPhone' => $shippingAddress['phone'], ); if ($this->CardTypeHasIssueDate($cctype)) { $vspdirect_post['StartDate'] = $ccissuedatem . $ccissuedatey; } if ($this->CardTypeHasIssueNo($cctype)) { $vspdirect_post['IssueNumber'] = $ccissueno; } if ($this->CardTypeRequiresCVV2($cctype)) { $vspdirect_post['CV2'] = $cccvd; } return http_build_query($vspdirect_post); }
/** * Redirect the customer to Protx's site to enter their payment details */ public function TransferToProvider() { $currency = GetDefaultCurrency(); $crypt_after = ""; $shipping_address = ""; $shipping_zip = ""; $total = number_format($this->GetGatewayAmount(), 2, '.', ''); $this->_vendorname = $this->GetValue("vendorname"); $this->_encryptionpassword = $this->GetValue("encryptionpassword"); $testmode_on = $this->GetValue("testmode"); if ($testmode_on == "YES") { $this->_protxurl = "https://ukvpstest.protx.com/vspgateway/service/vspform-register.vsp"; } else { if ($testmode_on == "SIMULATOR") { $this->_protxurl = "https://ukvpstest.protx.com/VSPSimulator/VSPFormGateway.asp"; } else { $this->_protxurl = "https://ukvps.protx.com/vspgateway/service/vspform-register.vsp"; } } // Load the pending order $pendingOrder = LoadPendingOrderByToken(); // Load the billing address for the pending order $GLOBALS['ISC_CLASS_ACCOUNT'] = GetClass('ISC_ACCOUNT'); if (isset($pendingOrder['ordbillstreet1']) && trim($pendingOrder['ordbillstreet1']) != '') { $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER'); $customerEmail = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerEmailAddress(); $description = str_replace("&", "", GetLang('ProtxYourOrderFromX') . str_replace("'", "'", $GLOBALS['StoreName'])); $billState = ''; if ($pendingOrder['ordbillcountrycode'] == 'US') { $billState = GetStateISO2ById($pendingOrder['ordbillstateid']); } if ($pendingOrder['ordisdigital']) { $ShippingAddress = array('firstname' => $pendingOrder['ordbillfirstname'], 'lastname' => $pendingOrder['ordbilllastname'], 'address1' => $pendingOrder['ordbillstreet1'], 'address2' => $pendingOrder['ordbillstreet2'], 'city' => $pendingOrder['ordbillsuburb'], 'state' => $billState, 'country' => $pendingOrder['ordbillcountrycode'], 'postcode' => $pendingOrder['ordbillzip']); } else { $shipState = ''; if ($pendingOrder['ordshipcountrycode'] == 'US') { $shipState = GetStateISO2ById($pendingOrder['ordshipstateid']); } $ShippingAddress = array('firstname' => $pendingOrder['ordshipfirstname'], 'lastname' => $pendingOrder['ordshiplastname'], 'address1' => $pendingOrder['ordshipstreet1'], 'address2' => $pendingOrder['ordshipstreet2'], 'city' => $pendingOrder['ordshipsuburb'], 'state' => $shipState, 'country' => $pendingOrder['ordshipcountrycode'], 'postcode' => $pendingOrder['ordshipzip']); } $data = array('VendorTxCode' => $_COOKIE['SHOP_ORDER_TOKEN'] . "_" . rand(1, 100000), 'Amount' => $total, 'Currency' => $currency['currencycode'], 'Description' => $description, 'SuccessURL' => $GLOBALS['ShopPath'] . '/finishorder.php', 'FailureURL' => $GLOBALS['ShopPath'] . '/finishorder.php?protx_failure=true', 'CustomerName' => str_replace("&", "", $pendingOrder['ordbillfirstname'] . ' ' . $pendingOrder['ordbilllastname']), 'CustomerEMail' => str_replace("&", "", $customerEmail), 'VendorEMail' => str_replace("&", "", GetConfig('OrderEmail')), 'ContactNumber' => str_replace("&", "", $pendingOrder['ordbillphone']), 'BillingSurname' => str_replace("&", "", $pendingOrder['ordbilllastname']), 'BillingFirstnames' => str_replace("&", "", $pendingOrder['ordbillfirstname']), 'BillingAddress1' => str_replace("&", "", $pendingOrder['ordbillstreet1']), 'BillingAddress2' => str_replace("&", "", $pendingOrder['ordbillstreet2']), 'BillingCity' => str_replace("&", "", $pendingOrder['ordbillsuburb']), 'BillingState' => str_replace("&", "", $billState), 'BillingPostCode' => str_replace("&", "", $pendingOrder['ordbillzip']), 'BillingCountry' => str_replace("&", "", $pendingOrder['ordbillcountrycode']), 'DeliverySurname' => str_replace("&", "", $ShippingAddress['lastname']), 'DeliveryFirstnames' => str_replace("&", "", $ShippingAddress['firstname']), 'DeliveryAddress1' => str_replace("&", "", $ShippingAddress['address1']), 'DeliveryAddress2' => str_replace("&", "", $ShippingAddress['address2']), 'DeliveryCity' => str_replace("&", "", $ShippingAddress['city']), 'DeliveryState' => str_replace("&", "", $ShippingAddress['state']), 'DeliveryPostCode' => str_replace("&", "", $ShippingAddress['postcode']), 'DeliveryCountry' => str_replace("&", "", $ShippingAddress['country'])); $crypt_before = ''; // Build the XOR'd crypt string as per the Protx documentation foreach ($data as $key => $value) { $crypt_before .= $key . "=" . $value . "&"; } $crypt_before = rtrim($crypt_before, '&'); // Base 64 encode to make it binary-safe $crypt_after = $this->simplexor($crypt_before, $this->_encryptionpassword); $crypt_after = base64_encode($crypt_after); ?> <html> <head> <title><?php echo GetLang('RedirectingToProtx'); ?> </title> </head> <body onload="document.forms[0].submit()"> <a href="javascript:void(0)" onclick="document.forms[0].submit()" style="color:gray; font-size:12px"><?php echo GetLang('ClickIfNotRedirected'); ?> </a> <form action="<?php echo $this->_protxurl; ?> " method="post"> <input type="hidden" name="VPSProtocol" value="2.23"> <input type="hidden" name="TxType" value="PAYMENT"> <input type="hidden" name="Vendor" value="<?php echo htmlentities($this->_vendorname); ?> "> <input type="hidden" name="Crypt" value="<?php echo $crypt_after; ?> "> </form> </body> </html> <?php } else { // Bad billing address ob_end_clean(); header(sprintf("Location:%s/checkout.php", $GLOBALS['ShopPath'])); die; } }
/** * Redirect the customer to LinkPointConnect's site to enter their payment details */ public function TransferToProvider() { // deduct tax and shipping from gateway amount instead of $this->GetSubTotal as that function doesn't factor in any discounts, // which results in a gateway error if subtotal + shipping + tax != charge (gateway) amount $subtotal = $this->GetGatewayAmount() - $this->GetTaxCost() - $this->GetShippingCost() - $this->GetHandlingCost(); $subtotal = number_format($subtotal, 2, '.', ''); $shippingcost = number_format($this->GetShippingCost() + $this->GetHandlingCost(), 2, '.', ''); $taxcost = number_format($this->GetTaxCost(), 2, '.', ''); $total = number_format($this->GetGatewayAmount(), 2, '.', ''); $this->_storenumber = $this->GetValue("storenumber"); $transactiontype = $this->GetValue("transactiontype"); $testmode_on = $this->GetValue("testmode"); if($testmode_on == "YES") { $linkpointconnect_url = "https://www.staging.linkpointcentral.com/lpc/servlet/lppay"; } else { $linkpointconnect_url = "https://www.linkpointcentral.com/lpc/servlet/lppay"; } // Load the pending order $order = LoadPendingOrderByToken($_COOKIE['SHOP_ORDER_TOKEN']); $shippingAddress = $this->getShippingAddress(); $bcountry = GetCountryISO2ById($order['ordbillcountryid']); $scountry = $shippingAddress['country_iso2']; $phone = $order['ordbillphone']; $phone = preg_replace("#[^\+0-9]+#", "", $phone); //if it's us, we need to have find the us state code if($bcountry == "US") { $bstate = GetStateISO2ById($order['ordbillstateid']); $bstate_name='bstate'; } else { $bstate = $order['ordbillstate']; $bstate_name='bstate2'; } $billstate = 'name="' . $bstate_name . '" value="' . isc_html_escape($bstate) . '"'; if($scountry == "US") { $sstate = GetStateISO2ById($shippingAddress['state_id']); $sstate_name='sstate'; } else { $sstate = $shippingAddress['state']; $sstate_name='sstate2'; } $shipstate = 'name="' . $sstate_name . '" value="' . isc_html_escape($sstate) . '"'; ?> <html> <head> <title><?php echo GetLang('RedirectingToLinkPointConnect'); ?></title> </head> <body onload="document.forms[0].submit()"> <a href="javascript:void(0)" onclick="document.forms[0].submit()" style="color:gray; font-size:12px"><?php echo GetLang('ClickIfNotRedirected'); ?></a> <form name="linkpointconnect" id="linkpointconnect" action="<?php echo $linkpointconnect_url; ?>" method="post"> <input type="hidden" name="mode" value="fullpay"> <input type="hidden" name="chargetotal" value="<?php echo $total;?>"> <input type="hidden" name="tax" value="<?php echo $taxcost;?>"> <input type="hidden" name="shipping" value="<?php echo $shippingcost;?>"> <input type="hidden" name="subtotal" value="<?php echo $subtotal;?>"> <input type="hidden" name="storename" value="<?php echo $this->_storenumber;?>"> <input type="hidden" name="txntype" value="<?php echo $transactiontype;?>"> <input type="hidden" name="bname" value="<?php echo isc_html_escape($order['ordbillfirstname'].' '.$order['ordbilllastname']); ?>" /> <input type="hidden" name="email" value="<?php echo isc_html_escape($order['ordbillemail']); ?>" /> <input type="hidden" name="phone" value="<?php echo $phone; ?>" /> <input type="hidden" name="baddr1" value="<?php echo isc_html_escape($order['ordbillstreet1']); ?>" /> <input type="hidden" name="baddr2" value="<?php echo isc_html_escape($order['ordbillstreet2']); ?>" /> <input type="hidden" name="bcountry" value="<?php echo isc_html_escape($bcountry); ?>" /> <input type="hidden" name="bzip" value="<?php echo isc_html_escape($order['ordbillzip']); ?>" /> <input type="hidden" name="bcity" value="<?php echo isc_html_escape($order['ordbillsuburb']); ?>" /> <input type="hidden" <?php echo $billstate; ?> /> <input type="hidden" name="sname" value="<?php echo isc_html_escape($shippingAddress['first_name'].' '.$shippingAddress['last_name']); ?>" /> <input type="hidden" name="saddr1" value="<?php echo isc_html_escape($shippingAddress['address_1']); ?>" /> <input type="hidden" name="saddr2" value="<?php echo isc_html_escape($shippingAddress['address_2']); ?>" /> <input type="hidden" name="scountry" value="<?php echo isc_html_escape($scountry); ?>" /> <input type="hidden" name="szip" value="<?php echo isc_html_escape($shippingAddress['zip']); ?>" /> <input type="hidden" name="scity" value="<?php echo isc_html_escape($oshippingAddressrder['city']); ?>" /> <input type="hidden" <?php echo $shipstate; ?> /> </form> </body> </html> <?php exit; }
/** * Redirect the customer to eSelectPlus's site to enter their payment details */ public function TransferToProvider() { $total = number_format($this->gettotal(), 2,'.', ''); $this->_hostedpaypageid = $this->GetValue("hostedpaypageid"); $this->_hostedpaypagetoken = $this->GetValue("hostedpaypagetoken"); $testmode_on = $this->GetValue("testmode"); if ($testmode_on == "YES") { $eselectplus_url = "https://esqa.moneris.com/HPPDP/index.php"; } else { $eselectplus_url = "https://www3.moneris.com/HPPDP/index.php"; } $order = LoadPendingOrderByToken($_COOKIE['SHOP_ORDER_TOKEN']); // get the tax and shipping costs $gst = 0; $pst = 0; $hst = 0; $ordersTaxes = $this->getOrderTaxes(); foreach($ordersTaxes as $taxes) { foreach($taxes as $tax) { $id = strtolower($tax['name']); if($id == 'gst' || $id == 'pst' || $id == 'hst') { $$id += $tax['amount']; } } } $shippingAddress = $this->getShippingAddress(); ?> <html> <head> <title><?php echo GetLang('RedirectingToeSelectPlus'); ?></title> </head> <body onload="document.forms[0].submit()"> <a href="javascript:void(0)" onclick="document.forms[0].submit()" style="color:gray; font-size:12px"><?php echo GetLang('ClickIfNotRedirected'); ?></a> <form name="eselectplus" id="eselectplus" action="<?php echo $eselectplus_url; ?>" method="post"> <input type="hidden" name="ps_store_id" value="<?php echo $this->_hostedpaypageid;?>"> <input type="hidden" name="hpp_key" value="<?php echo $this->_hostedpaypagetoken;?>"> <input type="hidden" name="charge_total" value="<?php echo $total;?>"> <input type="hidden" name="bill_company_name" value="<?php echo isc_html_escape($order['ordbillcompany']); ?>" /> <input type="hidden" name="bill_first_name" value="<?php echo isc_html_escape($order['ordbillfirstname']); ?>" /> <input type="hidden" name="bill_last_name" value="<?php echo isc_html_escape($order['ordbilllastname']); ?>" /> <input type="hidden" name="bill_address_one" value="<?php echo isc_html_escape($order['ordbillstreet1']); ?>" /> <input type="hidden" name="bill_city" value="<?php echo isc_html_escape($order['ordbillsuburb']); ?>" /> <input type="hidden" name="bill_state_or_province" value="<?php echo isc_html_escape($order['ordbillstate']); ?>" /> <input type="hidden" name="bill_postal_code" value="<?php echo isc_html_escape($order['ordbillzip']); ?>" /> <input type="hidden" name="bill_country" value="<?php echo isc_html_escape($order['ordbillcountry']); ?>" /> <input type="hidden" name="bill_phone" value="<?php echo isc_html_escape($order['ordbillphone']); ?>" /> <input type="hidden" name="ship_company_name" value="<?php echo isc_html_escape($shippingAddress['company']); ?>" /> <input type="hidden" name="ship_first_name" value="<?php echo isc_html_escape($shippingAddress['first_name']); ?>" /> <input type="hidden" name="ship_last_name" value="<?php echo isc_html_escape($shippingAddress['last_name']); ?>" /> <input type="hidden" name="ship_address_one" value="<?php echo isc_html_escape($shippingAddress['address_1']); ?>" /> <input type="hidden" name="ship_city" value="<?php echo isc_html_escape($shippingAddress['city']); ?>" /> <input type="hidden" name="ship_state_or_province" value="<?php echo isc_html_escape($shippingAddress['state']); ?>" /> <input type="hidden" name="ship_postal_code" value="<?php echo isc_html_escape($shippingAddress['zip']); ?>" /> <input type="hidden" name="ship_country" value="<?php echo isc_html_escape($shippingAddress['country']); ?>" /> <?php if ($gst>0) { ?> <input type="hidden" name="gst" value="<?php echo $gst;?>"> <?php } if ($pst>0) { ?> <input type="hidden" name="pst" value="<?php echo $pst;?>"> <?php } if ($pst>0) { ?> <input type="hidden" name="hst" value="<?php echo $hst;?>"> <?php } if ($shipping_cost>0) { ?> <input type="hidden" name="shipping_cost" value="<?php echo $shipping_cost;?>"> <?php }?> <input type="hidden" name="email" value="<?php echo isc_html_escape($order['ordbillemail']); ?>"> </form> </body> </html> <?php exit; }