function getResponse($retData) { $oPGSearchResphp = new PGSearchResponse(); $oPGResphp = new PGResponse(); $retData = trim($retData); $token = strtok($retData, "\n"); $index = 1; while ($token) { $oPGResphp = $oPGResphp->getResponse($token); $token = strtok("\n"); if ($index == 1) { $mstrRespCode = $oPGResphp->getRespCode(); $mstrRespMessage = $oPGResphp->getRespMessage(); if ($mstrRespCode == 0) { $arraylistphp = array(); } else { $arraylistphp = array(); array_push($arraylistphp, $oPGResphp); } } else { array_push($arraylistphp, $oPGResphp); } $index++; } $oPGSearchResphp->setPGResponseObjects($arraylistphp); return $oPGSearchResphp; }
function postStatusInq($aoMerchant) { if ($this->verbose != null && trim($this->verbose) == "true") { error_log("PostLibPHP postStatusInq Entered", 0); } $oPGSearchResphp = new PGSearchResponse(); # Mandetory checks for Merchant and Merchant object containing # checks for Merchant id and and merchant transaction ID # # if ($aoMerchant == null || $aoMerchant == "") { if ($this->verbose != null && trim($this->verbose) == "true") { error_log("PostLibPHP postStatusInq Error. Merchant object passed is null or Invalid.Transaction cannot proceed.", 0); } $oPGSearchResphp->setRespCode("2"); $oPGSearchResphp->setRespMessage("Merchant object passed is null or Invalid.Transaction cannot proceed."); return $oPGSearchResphp; } if ($aoMerchant->getMerchantID() == null || $aoMerchant->getMerchantID() == "") { if ($this->verbose != null && trim($this->verbose) == "true") { error_log("PostLibPHP postStatusInq Error. Merchant id is Invalid.Transaction cannot proceed.", 0); } $oPGSearchResphp->setRespCode("2"); $oPGSearchResphp->setRespMessage("Merchant id is Invalid.Transaction cannot proceed."); return $oPGSearchResphp; } if ($aoMerchant->getMerchantTxnID() == null || $aoMerchant->getMerchantTxnID() == "") { if ($this->verbose != null && trim($this->verbose) == "true") { error_log("PostLibPHP postStatusInq Error. Merchant Transaction id is Invalid.Transaction cannot proceed.", 0); } $oPGSearchResphp->setRespCode("2"); $oPGSearchResphp->setRespMessage("Merchant Transaction id is Invalid.Transaction cannot proceed."); return $oPGSearchResphp; } $strData = ""; # Merchant details $strData = $strData . 'MerchantID=' . $aoMerchant->getMerchantID(); $strData = $strData . '&MerchantTxnID=' . $aoMerchant->getMerchantTxnID(); $oEncryptionUtilenc = new EncryptionUtil(); $strEncryptedData = trim($aoMerchant->getMerchantID()) . trim($aoMerchant->getMerchantTxnID()); $sDigest = $oEncryptionUtilenc->getHMAC($strEncryptedData, 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); } $oPGSearchResphp->setRespCode("2"); $oPGSearchResphp->setRespMessage(" Error while encrypting/hashing data. Transaction cannot be processed."); return $oPGSearchResphp; } $strData = $strData . '&EncryptedData=' . $sDigest; $strData = $strData . '&IntfVer=ASPV2.0'; $strData = $strData . '&OsType=' . trim($this->mstrOSType); $strData = $strData . '&LanguageType=php'; $strData = $strData . '&RequestType=SFAStatusInquiry'; $retData = $this->postData(trim($this->epgURL), trim($strData)); # The function return PGResponse object of php Sfa. if ($retData == null || $retData == "") { $oPGSearchResphp->setRespCode("2"); $oPGSearchResphp->setRespMessage(" No response From Payment Gateway or URL not Found"); if ($this->verbose != null && trim($this->verbose) == "true") { error_log("PostLibPHP postStatusInq Exiting", 0); } return $oPGSearchResphp; } else { $oPGSearchResphp = $oPGSearchResphp->getResponse($retData); if ($this->verbose != null && trim($this->verbose) == "true") { error_log("PostLibPHP postStatusInq Exiting", 0); } return $oPGSearchResphp; } }