Exemplo n.º 1
0
		$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);
	$tdsidThreeDSecureInputData = new ThreeDSecureInputData($MD, $PaRes);
 	$tdsaThreeDSecureAuthentication = new ThreeDSecureAuthentication($rgeplRequestGatewayEntryPointList, 1, null, $mdMerchantDetails, $tdsidThreeDSecureInputData, "Some data to be passed out");

 	$boTransactionProcessed = $tdsaThreeDSecureAuthentication->processTransaction($goGatewayOutput, $tomTransactionOutputMessage);

 	if ($boTransactionProcessed == false)
 	{
  		// could not communicate with the payment gateway
  		$Message = "Couldn't communicate with payment gateway";
		$retCode = -2;
 	}
 	else
 	{
  		switch ($goGatewayOutput->getStatusCode())
  		{
   		case 0:
    			// status code of 0 - means transaction successful
    			$Message = $goGatewayOutput->getMessage();
			write_log(LOGFILE_EPAYMENT, basename(__FILE__).' line:'.__LINE__.$Message );
Exemplo n.º 2
0
 function threeDSecureAuth($mdMerchantDetails, $rgeplRequestGatewayEntryPointList, $CrossReference, $PaRES)
 {
     $tdsidThreeDSecureInputData = new ThreeDSecureInputData($CrossReference, $PaRES);
     $tdsaThreeDSecureAuthentication = new ThreeDSecureAuthentication($rgeplRequestGatewayEntryPointList, 1, null, $mdMerchantDetails, $tdsidThreeDSecureInputData, "Some data to be passed out");
     $boTransactionProcessed = $tdsaThreeDSecureAuthentication->processTransaction($goGatewayOutput, $tomTransactionOutputMessage);
     if ($boTransactionProcessed == false) {
         // could not communicate with the payment gateway
         $Message = "Couldn't communicate with payment gateway";
         $retCode = -2;
     } else {
         switch ($goGatewayOutput->getStatusCode()) {
             case 0:
                 // status code of 0 - means transaction successful
                 $Message = $goGatewayOutput->getMessage();
                 write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . $Message);
                 $retCode = 2;
                 break;
             case 5:
                 // status code of 5 - means transaction declined
                 $Message = $goGatewayOutput->getMessage();
                 write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . $Message);
                 $retCode = -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) {
                     $retCode = 2;
                 } else {
                     $retCode = -2;
                 }
                 $PreviousTransactionMessage = $goGatewayOutput->getPreviousTransactionResult()->getMessage();
                 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>";
                     $retCode = -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);
                 $retCode = -2;
                 break;
         }
     }
     return $retCode;
 }
Exemplo n.º 3
0
 function m_CardSave_3DR()
 {
     $PaymentProcessorDomain = CS_GATEWAY_DOMAIN;
     $PaymentProcessorPort = CS_GATEWAY_PORT;
     $MerchantID = CS_MERCHANT_ID;
     $Password = CS_MERCHANT_PASS;
     $CrossReference = $this->request['CrossReference'];
     $PaRES = $this->request['PaRES'];
     if ($PaymentProcessorPort == 443) {
         $PaymentProcessorFullDomain = $PaymentProcessorDomain . "/";
     } else {
         $PaymentProcessorFullDomain = $PaymentProcessorDomain . ":" . $PaymentProcessorPort . "/";
     }
     $rgeplRequestGatewayEntryPointList = new RequestGatewayEntryPointList();
     $rgeplRequestGatewayEntryPointList->add("https://gw1." . $PaymentProcessorFullDomain, 100, 1);
     $rgeplRequestGatewayEntryPointList->add("https://gw2." . $PaymentProcessorFullDomain, 200, 1);
     $rgeplRequestGatewayEntryPointList->add("https://gw3." . $PaymentProcessorFullDomain, 300, 1);
     $tdsaThreeDSecureAuthentication = new ThreeDSecureAuthentication($rgeplRequestGatewayEntryPointList);
     $tdsaThreeDSecureAuthentication->getMerchantAuthentication()->setMerchantID($MerchantID);
     $tdsaThreeDSecureAuthentication->getMerchantAuthentication()->setPassword($Password);
     $tdsaThreeDSecureAuthentication->getThreeDSecureInputData()->setCrossReference($CrossReference);
     $tdsaThreeDSecureAuthentication->getThreeDSecureInputData()->setPaRES($PaRES);
     $boTransactionProcessed = $tdsaThreeDSecureAuthentication->processTransaction($tdsarThreeDSecureAuthenticationResult, $todTransactionOutputData);
     if ($boTransactionProcessed == false) {
         // could not communicate with the payment gateway
         $NextFormMode = "RESULTS";
         $Message = "Couldn't communicate with payment gateway";
         $_SESSION['cardsave_error'] = $Message;
         $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing");
         $this->libFunc->m_mosRedirect($retUrl);
     } else {
         switch ($tdsarThreeDSecureAuthenticationResult->getStatusCode()) {
             case 0:
                 // status code of 0 - means transaction successful
                 $this->obDb->query = "UPDATE " . ORDERS . " SET iOrderStatus=1,iPayStatus=1 WHERE iOrderid_PK = '" . $_GET['mode'] . "'";
                 $rs = $this->obDb->updateQuery();
                 $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.process&mode=" . $_GET['mode']);
                 $this->libFunc->m_mosRedirect($retUrl);
                 break;
             case 5:
                 // status code of 5 - means transaction declined
                 $NextFormMode = "RESULTS";
                 $Message = $tdsarThreeDSecureAuthenticationResult->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 = $tdsarThreeDSecureAuthenticationResult->getMessage();
                 if ($tdsarThreeDSecureAuthenticationResult->getPreviousTransactionResult()->getStatusCode()->getValue() == 0) {
                     $TransactionSuccessful = true;
                 } else {
                     $TransactionSuccessful = false;
                 }
                 $PreviousTransactionMessage = $tdsarThreeDSecureAuthenticationResult->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
                 $NextFormMode = "RESULTS";
                 $Message = $tdsarThreeDSecureAuthenticationResult->getMessage();
                 if ($tdsarThreeDSecureAuthenticationResult->getErrorMessages()->getCount() > 0) {
                     for ($LoopIndex = 0; $LoopIndex < $tdsarThreeDSecureAuthenticationResult->getErrorMessages()->getCount(); $LoopIndex++) {
                         $Message = $Message . "<br/>" . $tdsarThreeDSecureAuthenticationResult->getErrorMessages()->getAt($LoopIndex) . "</li>";
                     }
                 }
                 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:
                 // unhandled status code
                 $Message = $tdsarThreeDSecureAuthenticationResult->getMessage();
                 $TransactionSuccessful = false;
                 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;
         }
     }
 }