Ejemplo n.º 1
0
		exit();

	} else {
		write_log(LOGFILE_EPAYMENT, basename(__FILE__).  ' line:'.__LINE__."- transactionID=$transactionID"." EPAYMENT RESPONSE: TRANSACTIONID = ".$transactionID.  " FROM ".$transaction_data[0][4]."; FOR CUSTOMER ID ".$transaction_data[0][1]."; OF AMOUNT ".$transaction_data[0][2]);

	}

	foreach ($_POST as $field => $value) {
		$$field = $value;
	}

	$MerchantID = MODULE_PAYMENT_IRIDIUM_MERCHANTID;
	$Password = MODULE_PAYMENT_IRIDIUM_PASSWORD;
	$PaymentProcessorDomain = MODULE_PAYMENT_IRIDIUM_GATEWAY;
	$PaymentProcessorPort = MODULE_PAYMENT_IRIDIUM_GATEWAY_PORT;
	$rgeplRequestGatewayEntryPointList = new RequestGatewayEntryPointList();

	if ($PaymentProcessorPort == 443)
	{
		$PaymentProcessorFullDomain = $PaymentProcessorDomain."/";
	}
	else
	{
		$PaymentProcessorFullDomain = $PaymentProcessorDomain.":".$PaymentProcessorPort."/";
	}

	$rgeplRequestGatewayEntryPointList->add("https://gw1.".$PaymentProcessorFullDomain, 100, 2);
	$rgeplRequestGatewayEntryPointList->add("https://gw2.".$PaymentProcessorFullDomain, 200, 2);
	$rgeplRequestGatewayEntryPointList->add("https://gw3.".$PaymentProcessorFullDomain, 300, 2);

	$mdMerchantDetails = new MerchantDetails($MerchantID, $Password);
Ejemplo n.º 2
0
 function process_payment()
 {
     foreach ($_POST as $field => $value) {
         ${$field} = $value;
     }
     $rgeplRequestGatewayEntryPointList = new RequestGatewayEntryPointList();
     if ($PaymentProcessorPort == 443) {
         $PaymentProcessorFullDomain = $PaymentProcessorDomain . "/";
     } else {
         $PaymentProcessorFullDomain = $PaymentProcessorDomain . ":" . $PaymentProcessorPort . "/";
     }
     $rgeplRequestGatewayEntryPointList->add("https://gw1." . $PaymentProcessorFullDomain, 100, 2);
     $rgeplRequestGatewayEntryPointList->add("https://gw2." . $PaymentProcessorFullDomain, 200, 2);
     $rgeplRequestGatewayEntryPointList->add("https://gw3." . $PaymentProcessorFullDomain, 300, 2);
     $mdMerchantDetails = new MerchantDetails($MerchantID, $Password);
     $ttTransactionType = new NullableTRANSACTION_TYPE(TRANSACTION_TYPE::SALE);
     $mdMessageDetails = new MessageDetails($ttTransactionType);
     $boEchoCardType = new NullableBool(true);
     $boEchoAmountReceived = new NullableBool(true);
     $boEchoAVSCheckResult = new NullableBool(true);
     $boEchoCV2CheckResult = new NullableBool(true);
     $boThreeDSecureOverridePolicy = new NullableBool(true);
     $nDuplicateDelay = new NullableInt(60);
     $tcTransactionControl = new TransactionControl($boEchoCardType, $boEchoAVSCheckResult, $boEchoCV2CheckResult, $boEchoAmountReceived, $nDuplicateDelay, "", "", $boThreeDSecureOverridePolicy, "", null, null);
     $nAmount = new NullableInt($Amount);
     $nCurrencyCode = new NullableInt($CurrencyISOCode);
     $nDeviceCategory = new NullableInt(0);
     $tdsbdThreeDSecureBrowserDetails = new ThreeDSecureBrowserDetails($nDeviceCategory, "*/*", $_SERVER["HTTP_USER_AGENT"]);
     $tdTransactionDetails = new TransactionDetails($mdMessageDetails, $nAmount, $nCurrencyCode, $OrderID, $OrderDescription, $tcTransactionControl, $tdsbdThreeDSecureBrowserDetails);
     if ($ExpiryDateMonth != "") {
         $nExpiryDateMonth = new NullableInt($ExpiryDateMonth);
     } else {
         $nExpiryDateMonth = null;
     }
     if ($ExpiryDateYear != "") {
         $nExpiryDateYear = new NullableInt($ExpiryDateYear);
     } else {
         $nExpiryDateYear = null;
     }
     $ccdExpiryDate = new CreditCardDate($nExpiryDateMonth, $nExpiryDateYear);
     if ($StartDateMonth != "") {
         $nStartDateMonth = new NullableInt($StartDateMonth);
     } else {
         $nStartDateMonth = null;
     }
     if ($StartDateYear != "") {
         $nStartDateYear = new NullableInt($StartDateYear);
     } else {
         $nStartDateYear = null;
     }
     $ccdStartDate = new CreditCardDate($nStartDateMonth, $nStartDateYear);
     $cdCardDetails = new CardDetails($CardName, $CardNumber, $ccdExpiryDate, $ccdStartDate, $IssueNumber, $CV2);
     if ($CountryISOCode != "" && $CountryISOCode != -1) {
         $nCountryCode = new NullableInt($CountryISOCode);
     } else {
         $nCountryCode = null;
     }
     $adBillingAddress = new AddressDetails($Address1, $Address2, $Address3, $Address4, $City, $State, $PostCode, $nCountryCode);
     $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
     $cdCustomerDetails = new CustomerDetails($adBillingAddress, $EmailID, $Phone, '');
     $cdtCardDetailsTransaction = new CardDetailsTransaction($rgeplRequestGatewayEntryPointList, 1, null, $mdMerchantDetails, $tdTransactionDetails, $cdCardDetails, $cdCustomerDetails, "");
     $boTransactionProcessed = $cdtCardDetailsTransaction->processTransaction($goGatewayOutput, $tomTransactionOutputMessage);
     if ($boTransactionProcessed == false) {
         // could not communicate with the payment gateway
         $Message = "Couldn't communicate with payment gateway";
         $TransactionSuccessful = -2;
     } else {
         write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . " Payment Gateway status Code : " . $goGatewayOutput->getStatusCode());
         switch ($goGatewayOutput->getStatusCode()) {
             case 0:
                 // status code of 0 - means transaction successful
                 $Message = $goGatewayOutput->getMessage();
                 write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . $Message);
                 $TransactionSuccessful = 2;
                 break;
             case 3:
                 // status code of 3 - means 3D Secure authentication required
                 $Message = $goGatewayOutput->getMessage();
                 write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . $Message);
                 $PaRES = $tomTransactionOutputMessage->getThreeDSecureOutputData()->getPaREQ();
                 $CrossReference = $tomTransactionOutputMessage->getCrossReference();
                 $FormAction = $tomTransactionOutputMessage->getThreeDSecureOutputData()->getACSURL();
                 $return_link = tep_href_link("iridium_threed.php", "", 'SSL', false, false);
                 include dirname(__FILE__) . '/../../customer.smarty.php';
                 /*
                 $ACXCALL_HISTORY = 1; $ACXPAYMENT_HISTORY = 1; $ACXVOUCHER = 1; $ACXINVOICES = 1; $ACXDID = 1; $ACXSPEED_DIAL = 1;
                 $ACXRATECARD = 1; $ACXSIMULATOR  = 1; $ACXCALL_BACK = 1; $ACXCALLER_ID = 1; $ACXPASSWORD = 1; $ACXSUPPORT = 1;
                 $ACXNOTIFICATION = 1; $ACXAUTODIALER = 1;
                 $smarty->assign("ACXCALL_HISTORY", $ACXCALL_HISTORY);
                 $smarty->assign("ACXPAYMENT_HISTORY", $ACXPAYMENT_HISTORY);
                 $smarty->assign("ACXVOUCHER", $ACXVOUCHER);
                 $smarty->assign("ACXINVOICES", $ACXINVOICES);
                 $smarty->assign("ACXDID", $ACXDID);
                 $smarty->assign("ACXSPEED_DIAL", $ACXSPEED_DIAL);
                 $smarty->assign("ACXRATECARD", $ACXRATECARD);
                 $smarty->assign("ACXSIMULATOR", $ACXSIMULATOR);
                 $smarty->assign("ACXCALL_BACK", $ACXCALL_BACK);
                 $smarty->assign("ACXCALLER_ID", $ACXCALLER_ID);
                 $smarty->assign("ACXPASSWORD", $ACXPASSWORD);
                 $smarty->assign("ACXSUPPORT", $ACXSUPPORT);
                 $smarty->assign("ACXNOTIFICATION", $ACXNOTIFICATION);
                 $smarty->assign("ACXAUTODIALER", $ACXAUTODIALER);
                 */
                 $smarty->display('main.tpl');
                 echo " <body onload=\"document.Form.submit();\">\n                    <div style=\"width:800px;margin:auto\">\n                                        <form name=\"Form\" action=\"{$FormAction}\" method=\"post\"  target=\"ACSFrame\">\n                                        <input name=\"PaReq\" type=\"hidden\" value=\"{$PaRES}\" / >\n                                        <input name=\"MD\" type=\"hidden\" value=\"{$CrossReference}\" />\n                                        <input name=\"TermUrl\" type=\"hidden\" value=\"{$return_link}?transactionID={$transactionID}\" />\n                    <iframe id=\"ACSFrame\" name=\"ACSFrame\" width=\"500\" height=\"500\" frameborder=\"0\"></iframe>\n\n                                </form>\n                                </div>\n                </body>";
                 $smarty->display('footer.tpl');
                 $TransactionSuccessful = 0;
                 /*
                                 $TransactionSuccessful = $this->threeDSecureAuth($mdMerchantDetails, $rgeplRequestGatewayEntryPointList,
                                                 $CrossReference, $PaRES);*/
                 break;
             case 5:
                 // status code of 5 - means transaction declined
                 $Message = $goGatewayOutput->getMessage();
                 write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . $Message);
                 $TransactionSuccessful = -2;
                 break;
             case 20:
                 // status code of 20 - means duplicate transaction
                 $Message = $goGatewayOutput->getMessage();
                 write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . $Message);
                 if ($goGatewayOutput->getPreviousTransactionResult()->getStatusCode()->getValue() == 0) {
                     $TransactionSuccessful = 2;
                 } else {
                     $TransactionSuccessful = -2;
                 }
                 $PreviousTransactionMessage = $goGatewayOutput->getPreviousTransactionResult()->getMessage();
                 $DuplicateTransaction = true;
                 break;
             case 30:
                 // status code of 30 - means an error occurred
                 $Message = $goGatewayOutput->getMessage();
                 if ($goGatewayOutput->getErrorMessages()->getCount() > 0) {
                     $Message = $Message . "<br /><ul>";
                     for ($LoopIndex = 0; $LoopIndex < $goGatewayOutput->getErrorMessages()->getCount(); $LoopIndex++) {
                         $Message = $Message . "<li>" . $goGatewayOutput->getErrorMessages()->getAt($LoopIndex) . "</li>";
                     }
                     $Message = $Message . "</ul>";
                     $TransactionSuccessful = -2;
                 }
                 write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . $Message);
                 break;
             default:
                 // unhandled status code
                 $Message = $goGatewayOutput->getMessage();
                 write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . $Message);
                 $TransactionSuccessful = -2;
                 break;
         }
     }
     return $TransactionSuccessful;
 }
Ejemplo n.º 3
0
 function m_CardSave_Direct($orderId2)
 {
     $this->libFunc = new c_libFunctions();
     $orderId = strval($orderId2);
     //constants
     // PS_MERCHANT_ID , PS_MERCHANT_PASS , PS_CURRENCY , PS_GATEWAY_DOMAIN , PS_GATEWAY_PORT
     $Amount = floatval($_SESSION['grandTotal']) * 100;
     $MerchantID = CS_MERCHANT_ID;
     $Password = CS_MERCHANT_PASS;
     $CurrencyShort = CS_CURRENCY;
     $OrderID = $orderId;
     $OrderDescription = SITE_URL . " - Invoice #" . $orderId;
     $CardName = $_SESSION['cardholder_name'];
     $CardNumber = $_SESSION['cc_number'];
     $ExpiryDateMonth = $_SESSION['cc_month'];
     $ExpiryDateYear = substr($_SESSION['cc_year'], 2);
     $StartDateYear = $_SESSION['cc_start_year'];
     $StartDateMonth = $_SESSION['cc_start_month'];
     $IssueNumber = $_SESSION['issuenumber'];
     $CV2 = $_SESSION['cv2'];
     $Address1 = $_SESSION['address1'];
     $Address2 = $_SESSION['address2'];
     $Address3 = '';
     $Address4 = '';
     $City = $_SESSION['city'];
     $this->obDb->query = "SELECT vStateName FROM " . STATES . " where iStateId_PK  = '" . $_SESSION['bill_state_id'] . "'";
     $row_state = $this->obDb->fetchQuery();
     $State = $row_state[0]->vStateName;
     $PostCode = $_SESSION['zip'];
     $this->obDb->query = "SELECT vCountryCode FROM " . COUNTRY . " where iCountryId_PK  = '" . $_SESSION['bill_country_id'] . "'";
     $row_country = $this->obDb->fetchQuery();
     $billcountryiso = $row_country[0]->vCountryCode;
     $CustomerEmail = $_SESSION['email'];
     $CustomerPhone = $_SESSION['phone'];
     $PaymentProcessorDomain = CS_GATEWAY_DOMAIN;
     $PaymentProcessorPort = CS_GATEWAY_PORT;
     if ($PaymentProcessorPort == 443) {
         $PaymentProcessorFullDomain = $PaymentProcessorDomain . "/";
     } else {
         $PaymentProcessorFullDomain = $PaymentProcessorDomain . ":" . $PaymentProcessorPort . "/";
     }
     $iclISOCurrencyList = new ISOCurrencyList();
     $rgeplRequestGatewayEntryPointList = new RequestGatewayEntryPointList();
     $rgeplRequestGatewayEntryPointList->add("https://gw1." . $PaymentProcessorFullDomain, 100, 1);
     $rgeplRequestGatewayEntryPointList->add("https://gw2." . $PaymentProcessorFullDomain, 200, 1);
     $rgeplRequestGatewayEntryPointList->add("https://gw3." . $PaymentProcessorFullDomain, 300, 1);
     $cdtCardDetailsTransaction = new CardDetailsTransaction($rgeplRequestGatewayEntryPointList);
     $cdtCardDetailsTransaction->getMerchantAuthentication()->setMerchantID($MerchantID);
     $cdtCardDetailsTransaction->getMerchantAuthentication()->setPassword($Password);
     $cdtCardDetailsTransaction->getTransactionDetails()->getMessageDetails()->setTransactionType("SALE");
     $cdtCardDetailsTransaction->getTransactionDetails()->getAmount()->setValue($Amount);
     //if ($CurrencyShort != "" && $iclISOCurrencyList->getISOCurrency($CurrencyShort, $icISOCurrency))
     //{
     $cdtCardDetailsTransaction->getTransactionDetails()->getCurrencyCode()->setValue($CurrencyShort);
     //}
     $cdtCardDetailsTransaction->getTransactionDetails()->setOrderID($OrderID);
     $cdtCardDetailsTransaction->getTransactionDetails()->setOrderDescription($OrderDescription);
     $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoCardType()->setValue(true);
     $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAmountReceived()->setValue(true);
     $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAVSCheckResult()->setValue(true);
     $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoCV2CheckResult()->setValue(true);
     $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getThreeDSecureOverridePolicy()->setValue(true);
     $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getDuplicateDelay()->setValue(60);
     $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->getDeviceCategory()->setValue(0);
     $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->setAcceptHeaders("*/*");
     $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->setUserAgent($_SERVER["HTTP_USER_AGENT"]);
     $cdtCardDetailsTransaction->getCardDetails()->setCardName($CardName);
     $cdtCardDetailsTransaction->getCardDetails()->setCardNumber($CardNumber);
     if ($ExpiryDateMonth != "") {
         $cdtCardDetailsTransaction->getCardDetails()->getExpiryDate()->getMonth()->setValue($ExpiryDateMonth);
     }
     if ($ExpiryDateYear != "") {
         $cdtCardDetailsTransaction->getCardDetails()->getExpiryDate()->getYear()->setValue($ExpiryDateYear);
     }
     if ($StartDateMonth != "") {
         $cdtCardDetailsTransaction->getCardDetails()->getStartDate()->getMonth()->setValue($StartDateMonth);
     }
     if ($StartDateYear != "") {
         $cdtCardDetailsTransaction->getCardDetails()->getStartDate()->getYear()->setValue($StartDateYear);
     }
     $cdtCardDetailsTransaction->getCardDetails()->setIssueNumber($IssueNumber);
     $cdtCardDetailsTransaction->getCardDetails()->setCV2($CV2);
     $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress1($Address1);
     $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress2($Address2);
     $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress3($Address3);
     $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress4($Address4);
     $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setCity($City);
     $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setState($State);
     $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setPostCode($PostCode);
     $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->getCountryCode()->setValue($billcountryiso);
     $cdtCardDetailsTransaction->getCustomerDetails()->setEmailAddress($CustomerEmail);
     $cdtCardDetailsTransaction->getCustomerDetails()->setPhoneNumber($CustomerPhone);
     $cdtCardDetailsTransaction->getCustomerDetails()->setCustomerIPAddress($_SERVER["REMOTE_ADDR"]);
     //error_log($cdtrCardDetailsTransactionResult . " |" . $todTransactionOutputData,3,SITE_PATH."ecom/paymentSense.log");
     $boTransactionProcessed = $cdtCardDetailsTransaction->processTransaction($cdtrCardDetailsTransactionResult, $todTransactionOutputData);
     if ($boTransactionProcessed == false) {
         // could not communicate with the payment gateway
         $Message = "Couldn't communicate with payment gateway" . $cdtCardDetailsTransaction->getLastException()->getMessage();
         $_SESSION['cardsave_error'] = $Message;
         $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
         $this->libFunc->m_mosRedirect($retUrl);
     } else {
         switch ($cdtrCardDetailsTransactionResult->getStatusCode()) {
             case 0:
                 // status code of 0 - means transaction successful
                 $this->obDb->query = "UPDATE " . ORDERS . " SET iOrderStatus=1,iPayStatus=1 WHERE iOrderid_PK = '" . $orderId . "'";
                 $rs = $this->obDb->updateQuery();
                 $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.process&mode=" . $orderId);
                 $this->libFunc->m_mosRedirect($retUrl);
                 break;
             case 3:
                 // status code of 3 - means 3D Secure authentication required
                 $_SESSION['PaREQ'] = $todTransactionOutputData->getThreeDSecureOutputData()->getPaREQ();
                 $_SESSION['CrossReference'] = $todTransactionOutputData->getCrossReference();
                 $BodyAttributes = " onload=\"document.Form.submit();\"";
                 $FormAttributes = " target=\"ACSFrame\"";
                 $_SESSION['FormAction'] = $todTransactionOutputData->getThreeDSecureOutputData()->getACSURL();
                 $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . 'ecom/index.php?action=checkout.cs3d&mode=' . $orderId);
                 $this->libFunc->m_mosRedirect($retUrl);
                 break;
             case 5:
                 // status code of 5 - means transaction declined
                 $Message = $cdtrCardDetailsTransactionResult->getMessage();
                 $_SESSION['cardsave_error'] = $Message;
                 $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                 $this->libFunc->m_mosRedirect($retUrl);
                 break;
             case 20:
                 // status code of 20 - means duplicate transaction
                 $NextFormMode = "RESULTS";
                 $Message = $cdtrCardDetailsTransactionResult->getMessage();
                 if ($cdtrCardDetailsTransactionResult->getPreviousTransactionResult()->getStatusCode()->getValue() == 0) {
                     $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.process&mode=" . $orderId);
                     $this->libFunc->m_mosRedirect($retUrl);
                 }
                 $PreviousTransactionMessage = $cdtrCardDetailsTransactionResult->getPreviousTransactionResult()->getMessage();
                 $_SESSION['cardsave_error'] = $Message . " , " . $PreviousTransactionMessage;
                 $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                 $this->libFunc->m_mosRedirect($retUrl);
                 break;
             case 30:
                 // status code of 30 - means an error occurred
                 $Message = $cdtrCardDetailsTransactionResult->getMessage();
                 if ($cdtrCardDetailsTransactionResult->getErrorMessages()->getCount() > 0) {
                     for ($LoopIndex = 0; $LoopIndex < $cdtrCardDetailsTransactionResult->getErrorMessages()->getCount(); $LoopIndex++) {
                         $Message = $Message . "<br/>" . $cdtrCardDetailsTransactionResult->getErrorMessages()->getAt($LoopIndex);
                     }
                 }
                 if ($todTransactionOutputData == null) {
                     $szResponseCrossReference = "";
                 } else {
                     $szResponseCrossReference = $todTransactionOutputData->getCrossReference();
                 }
                 $_SESSION['cardsave_error'] = $Message;
                 $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                 $this->libFunc->m_mosRedirect($retUrl);
                 break;
             default:
                 $Message = $cdtrCardDetailsTransactionResult->getMessage();
                 if ($todTransactionOutputData == null) {
                     $szResponseCrossReference = "";
                 } else {
                     $szResponseCrossReference = $todTransactionOutputData->getCrossReference();
                 }
                 $_SESSION['cardsave_error'] = $Message;
                 $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
                 $this->libFunc->m_mosRedirect($retUrl);
                 break;
         }
     }
 }