示例#1
0
 function postAuth($aoMerchant, $aoCInfo, $aoPGResp, $oPSD, $aoReserveData)
 {
     $ojMerchant = new Merchant();
     $ojCInfo = new CardInfo();
     //$oPGResp = new Java('com.opus.epg.sfa.java.PGResponse');
     //$ojPSD = new Java('com.opus.epg.sfa.java.PaySecureDetails');
     $ojReserveData = new PGReserveData();
     $oPostLib = new PostLibPHP();
     $oPGResphp = new PGResponse();
     ## Mandetory checks for Merchant objects
     #  check for Merchant id and the Message type
     #
     ##
     if ($aoMerchant == null) {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Merchant object is null");
         return $oPGResphp;
     }
     if ($aoMerchant->getMerchantID() == null || $aoMerchant->getMerchantID() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Merchant id is null or Invalid");
         return $oPGResphp;
     }
     if ($aoMerchant->getMessageType() == null || $aoMerchant->getMessageType() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Message type is null.");
         return $oPGResphp;
     }
     if ($oPSD->getPaysecureResp() == null || $oPSD->getPaysecureResp() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Invalid Paysecure Response. Transaction cannot be processed.");
         return $oPGResphp;
     }
     if ($oPSD->getPaySecureTxnID() == null || $oPSD->getPaySecureTxnID() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Invalid PaySecure Txn Id. Transaction cannot be processed.");
         return $oPGResphp;
     }
     if ($oPSD->getAuthAmount() == null || $oPSD->getAuthAmount() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Error. Auth Amount is Invalid.");
         return $oPGResphp;
     }
     if ($oPSD->getCardAcceptorID() == null || $oPSD->getCardAcceptorID() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Error. Card Acceptor/Merchant Id is Invalid.");
         return $oPGResphp;
     }
     if ($oPSD->getCurrCode() == null || $oPSD->getCurrCode() == "") {
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Invalid Currency code. Transaction cannot be processed.");
         return $oPGResphp;
     }
     #  Assigning Merchant object of php to Merchant object of java Sfa
     $ojMerchant->setMerchantDetails($aoMerchant->getMerchantID(), $aoMerchant->getVendor(), $aoMerchant->getPartner(), $aoMerchant->getCustIPAddress(), $aoMerchant->getMerchantTxnID(), $aoMerchant->getOrderReferenceNo(), $aoMerchant->getRespURL(), $aoMerchant->getRespMethod(), $aoMerchant->getCurrCode(), $aoMerchant->getInvoiceNo(), $aoMerchant->getMessageType(), $aoMerchant->getAmount(), $aoMerchant->getGMTTimeOffset(), $aoMerchant->getExt1(), $aoMerchant->getExt2(), $aoMerchant->getExt3(), $aoMerchant->getExt4(), $aoMerchant->getExt5());
     #   Assigning Card Info object of php to Card info object of java Sfa
     if ($aoCInfo != null || $aoCInfo != "") {
         $ojCInfo->setCardDetails($aoCInfo->getCardType(), $aoCInfo->getCardNum(), $aoCInfo->getCVVNum(), $aoCInfo->getExpDtYr(), $aoCInfo->getExpDtMon(), $aoCInfo->getNameOnCard(), $aoCInfo->getInstrType());
     }
     if ($aoReserveData != null || $aoReserveData != "") {
         $ojReserveData->setReserveObj($aoReserveData->getReserveField1(), $aoReserveData->getReserveField2(), $aoReserveData->getReserveField3(), $aoReserveData->getReserveField4(), $aoReserveData->getReserveField5(), $aoReserveData->getReserveField6(), $aoReserveData->getReserveField7(), $aoReserveData->getReserveField8(), $aoReserveData->getReserveField9(), $aoReserveData->getReserveField10());
     }
     $strData = $this->buildMerchantBillShip($aoMerchant, null, null);
     $oEncryptionUtilenc = new EncryptionUtil();
     $strMotoEncryptedData = $aoMerchant->getMerchantID() . trim($aoMerchant->getMerchantTxnID()) . trim($aoMerchant->getCustIPAddress()) . trim($aoMerchant->getAmount()) . trim($aoMerchant->getMessageType()) . trim($aoMerchant->getCurrCode()) . trim($aoMerchant->getInvoiceNo()) . trim($aoCInfo->getCardNum()) . trim($aoCInfo->getExpDtYr()) . trim($aoCInfo->getExpDtMon()) . $aoCInfo->getCVVNum();
     $sDigest = $oEncryptionUtilenc->getHMAC($strMotoEncryptedData, trim($this->mstrKeyDir) . $aoMerchant->getMerchantID() . '.key', $aoMerchant->getMerchantID());
     if ($sDigest == null || $sDigest == "") {
         if ($this->verbose != null && trim($this->verbose) == "true") {
             error_log("Error in Encrypting/Hashing Merchant Data.Transaction cannot proceed.", 0);
         }
         $oPGResphp->setRespCode("2");
         $oPGResphp->setRespMessage(" Error while encrypting/hashing data. Transaction cannot be processed.");
         return $oPGResphp;
     }
     $strData = $strData . '&EncryptedData=' . $sDigest;
     $strData = $strData . '&IntfVer=ASPV2.0';
     $strData = $strData . '&OsType=' . trim($this->mstrOSType);
     $strData = $strData . '&LanguageType=php';
     $strData = $strData . '&CustIPAddress=' . $aoMerchant->getCustIPAddress();
     $strData = $strData . '&InstrType=' . $aoCInfo->getInstrType();
     $strData = $strData . '&CardType=' . $aoCInfo->getCardType();
     $strData = $strData . '&CardNum=' . $aoCInfo->getCardNum();
     $strData = $strData . '&ExpDtYr=' . $aoCInfo->getExpDtYr();
     $strData = $strData . '&ExpDtMon=' . $aoCInfo->getExpDtMon();
     $strData = $strData . '&CVVNum=' . $aoCInfo->getCVVNum();
     $strData = $strData . '&NameOnCard=' . $aoCInfo->getNameOnCard();
     if ($aoMPI == null || $aoMPI == "") {
         $strData = $strData . '&status=""';
         $strData = $strData . '&cavv=""';
         $strData = $strData . '&eci=""';
         $strData = $strData . '&xid=""';
         $strData = $strData . '&purchaseAmount=""';
         $strData = $strData . '&currencyVal=""';
         $strData = $strData . '&shoppingcontext=""';
     } else {
         $strData = $strData . '&status=' . $aoMPI->getVBVStatus();
         $strData = $strData . '&cavv=' . $aoMPI->getCAVV();
         $strData = $strData . '&eci=' . $aoMPI->getECI();
         $strData = $strData . '&xid=' . $aoMPI->getXID();
         $strData = $strData . '&purchaseAmount=' . $aoMPI->getPurchaseAmount();
         $strData = $strData . '&currencyVal=' . $aoMPI->getCurrencyVal();
         $strData = $strData . '&shoppingcontext=' . $aoMPI->getShoppingContext();
     }
     $strData = $strData . '&Reserve1=' . $aoReserveData->getReserveField1();
     $strData = $strData . '&Reserve2=' . $aoReserveData->getReserveField2();
     $strData = $strData . '&Reserve3=' . $aoReserveData->getReserveField3();
     $strData = $strData . '&Reserve4=' . $aoReserveData->getReserveField4();
     $strData = $strData . '&Reserve5=' . $aoReserveData->getReserveField5();
     $strData = $strData . '&Reserve6=' . $aoReserveData->getReserveField6();
     $strData = $strData . '&Reserve7=' . $aoReserveData->getReserveField7();
     $strData = $strData . '&Reserve8=' . $aoReserveData->getReserveField8();
     $strData = $strData . '&Reserve9=' . $aoReserveData->getReserveField9();
     $strData = $strData . '&Reserve10=' . $aoReserveData->getReserveField10();
     $strData = $strData . '&WsErrCode=' . $aoReserveData->getWsErrCode();
     $strData = $strData . '&WsErrMsg=' . $aoReserveData->getWsErrMsg();
     $strData = $strData . '&WsExponent=' . $aoReserveData->getWsExponent();
     $strData = $strData . '&WsGuid=' . $aoReserveData->getWsGuid();
     $strData = $strData . '&WsModulus=' . $aoReserveData->getWsModulus();
     $strData = $strData . '&WsTxnId=' . $aoReserveData->getWsTxnId();
     $oPGResp = $this->postData(trim($this->motoURL), trim($ojReserveData));
     # Assigning PGResponse objects of java to PGResponse object of php
     $oPGResphp->setRespCode($oPGResp->getRespCode());
     $oPGResphp->setRespMessage($oPGResp->getRespMessage());
     $oPGResphp->setTxnId($oPGResp->getTxnId());
     $oPGResphp->setEpgTxnId($oPGResp->getEpgTxnId());
     $oPGResphp->setAuthIdCode($oPGResp->getAuthIdCode());
     $oPGResphp->setRRN($oPGResp->getRRN());
     $oPGResphp->setCVRespCode($oPGResp->getCVRespCode());
     $oPGResphp->setReserveFld1($oPGResp->getReserveFld1());
     $oPGResphp->setReserveFld2($oPGResp->getReserveFld2());
     $oPGResphp->setReserveFld3($oPGResp->getReserveFld3());
     $oPGResphp->setReserveFld4($oPGResp->getReserveFld4());
     $oPGResphp->setReserveFld5($oPGResp->getReserveFld5());
     $oPGResphp->setReserveFld6($oPGResp->getReserveFld6());
     $oPGResphp->setReserveFld7($oPGResp->getReserveFld7());
     $oPGResphp->setReserveFld8($oPGResp->getReserveFld8());
     $oPGResphp->setReserveFld9($oPGResp->getReserveFld9());
     $oPGResphp->setReserveFld10($oPGResp->getReserveFld10());
     # Returning PGResponse object of php
     return $oPGResphp;
 }
示例#2
0
 function getResponse($retData)
 {
     $oPGResphp = new PGResponse();
     $retData = trim($retData);
     parse_str($retData, $output);
     if (array_key_exists('RespCode', $output) == 1) {
         $oPGResphp->setRespCode($output['RespCode']);
     }
     if (array_key_exists('Message', $output) == 1) {
         $oPGResphp->setRespMessage($output['Message']);
     }
     if (array_key_exists('TxnID', $output) == 1) {
         $oPGResphp->setTxnId($output['TxnID']);
     }
     if (array_key_exists('RedirectionTxnID', $output) == 1) {
         $oPGResphp->setRedirectionTxnId($output['RedirectionTxnID']);
     }
     if (array_key_exists('ePGTxnID', $output) == 1) {
         $oPGResphp->setEpgTxnId($output['ePGTxnID']);
     }
     if (array_key_exists('AuthIdCode', $output) == 1) {
         $oPGResphp->setAuthIdCode($output['AuthIdCode']);
     }
     if (array_key_exists('RRN', $output) == 1) {
         $oPGResphp->setRRN($output['RRN']);
     }
     if (array_key_exists('TxnType', $output) == 1) {
         $oPGResphp->setTxnType($output['TxnType']);
     }
     if (array_key_exists('TxnDateTime', $output) == 1) {
         $oPGResphp->setTxnDateTime($output['TxnDateTime']);
     }
     if (array_key_exists('CVRespCode', $output) == 1) {
         $oPGResphp->setCVRespCode($output['CVRespCode']);
     }
     if (array_key_exists('Reserve1', $output) == 1) {
         $oPGResphp->setReserveFld1($output['Reserve1']);
     }
     if (array_key_exists('Reserve2', $output) == 1) {
         $oPGResphp->setReserveFld2($output['Reserve2']);
     }
     if (array_key_exists('Reserve3', $output) == 1) {
         $oPGResphp->setReserveFld3($output['Reserve3']);
     }
     if (array_key_exists('Reserve4', $output) == 1) {
         $oPGResphp->setReserveFld4($output['Reserve4']);
     }
     if (array_key_exists('Reserve5', $output) == 1) {
         $oPGResphp->setReserveFld5($output['Reserve5']);
     }
     if (array_key_exists('Reserve6', $output) == 1) {
         $oPGResphp->setReserveFld6($output['Reserve6']);
     }
     if (array_key_exists('Reserve7', $output) == 1) {
         $oPGResphp->setReserveFld7($output['Reserve7']);
     }
     if (array_key_exists('Reserve8', $output) == 1) {
         $oPGResphp->setReserveFld8($output['Reserve8']);
     }
     if (array_key_exists('Reserve9', $output) == 1) {
         $oPGResphp->setReserveFld9($output['Reserve9']);
     }
     if (array_key_exists('Reserve10', $output) == 1) {
         $oPGResphp->setReserveFld10($output['Reserve10']);
     }
     /*"WsTxnId:" . $this->mstrWsTxnId ."\n".
     		"WsModulus:" . $this->mstrWsModulus ."\n".
     		"WsExponent:" . $this->mstrWsExponent ."\n".
     		"WsGuid:" . $this->mstrWsGuid ."\n".
     		"WsErrCode:" . $this->mstrWsErrCode ."\n".
     		"WsErrMsg:" . $this->mstrWsErrMsg ."\n".*/
     if (array_key_exists('WsTxnId', $output) == 1) {
         $oPGResphp->setWsTxnId($output['WsTxnId']);
     }
     if (array_key_exists('WsModulus', $output) == 1) {
         $oPGResphp->setWsModulus($output['WsModulus']);
     }
     if (array_key_exists('WsExponent', $output) == 1) {
         $oPGResphp->setWsExponent($output['WsExponent']);
     }
     if (array_key_exists('WsGuid', $output) == 1) {
         $oPGResphp->setWsGuid($output['WsGuid']);
     }
     if (array_key_exists('WsErrCode', $output) == 1) {
         $oPGResphp->setWsErrCode($output['WsErrCode']);
     }
     if (array_key_exists('WsErrMsg', $output) == 1) {
         $oPGResphp->setWsErrMsg($output['WsErrMsg']);
     }
     return $oPGResphp;
 }
示例#3
0
	function getResponse($retData) {
		$oPGResphp	=	new	PGResponse();
		$retData = trim($retData);
		parse_str($retData, $output);

		if( array_key_exists('RespCode', $output) == 1) {
			$oPGResphp->setRespCode($output['RespCode']);
		}
		if( array_key_exists('Message', $output) == 1) {
			$oPGResphp->setRespMessage($output['Message']);
		}
		if( array_key_exists('TxnID', $output) == 1) {
			$oPGResphp->setTxnId($output['TxnID']);
		}
		if( array_key_exists('RedirectionTxnID', $output) == 1) {
			$oPGResphp->setRedirectionTxnId($output['RedirectionTxnID']);
		}
		if( array_key_exists('ePGTxnID', $output) == 1) {
			$oPGResphp->setEpgTxnId($output['ePGTxnID']);
		}
		if( array_key_exists('AuthIdCode', $output) == 1) {
			$oPGResphp->setAuthIdCode($output['AuthIdCode']);
		}
		if( array_key_exists('RRN', $output) == 1) {
			$oPGResphp->setRRN($output['RRN']);
		}
		if( array_key_exists('TxnType', $output) == 1) {
			$oPGResphp->setTxnType($output['TxnType']);
		}
		if( array_key_exists('TxnDateTime', $output) == 1) {
			$oPGResphp->setTxnDateTime($output['TxnDateTime']);
		}
		if( array_key_exists('CVRespCode', $output) == 1) {
			$oPGResphp->setCVRespCode($output['CVRespCode']);
		}

		if( array_key_exists('Reserve1', $output) == 1) {
			$oPGResphp->setReserveFld1($output['Reserve1']);
		}

		if( array_key_exists('Reserve2', $output) == 1) {
			$oPGResphp->setReserveFld2($output['Reserve2']);
		}
		if( array_key_exists('Reserve3', $output) == 1) {
			$oPGResphp->setReserveFld3($output['Reserve3']);
		}

		if( array_key_exists('Reserve4', $output) == 1) {
			$oPGResphp->setReserveFld4($output['Reserve4']);
		}

		if( array_key_exists('Reserve5', $output) == 1) {
			$oPGResphp->setReserveFld5($output['Reserve5']);
		}
		if( array_key_exists('Reserve6', $output) == 1) {
			$oPGResphp->setReserveFld6($output['Reserve6']);
		}

		if( array_key_exists('Reserve7', $output) == 1) {
			$oPGResphp->setReserveFld7($output['Reserve7']);
		}
		if( array_key_exists('Reserve8', $output) == 1) {
			$oPGResphp->setReserveFld8($output['Reserve8']);
		}

		if( array_key_exists('Reserve9', $output) == 1) {
			$oPGResphp->setReserveFld9($output['Reserve9']);
		}

		if( array_key_exists('Reserve10', $output) == 1) {
			$oPGResphp->setReserveFld10($output['Reserve10']);
		}
		return $oPGResphp;
	}