Ejemplo n.º 1
0
 public function PerformTargetedTransaction($request, $response)
 {
     //
     //	Clear any error tracking that may be leftover in
     //	a re-used request.
     //
     $request->Clear(GatewayRequest::FAILED_SERVER());
     $request->Clear(GatewayRequest::FAILED_RESPONSE_CODE());
     $request->Clear(GatewayRequest::FAILED_REASON_CODE());
     $request->Clear(GatewayRequest::FAILED_GUID());
     //
     //	This transaction must go to the host that processed a
     //	previous referenced transaction.  Get the GUID of the
     //	reference transaction.
     //
     $referenceGUID = $request->Get(GatewayRequest::REFERENCE_GUID());
     if ($referenceGUID == NULL) {
         // Don't have reference?
         $response->SetResults(GatewayCodes__RESPONSE_REQUEST_ERROR, GatewayCodes__REASON_INVALID_REFGUID);
         return FALSE;
         // Transaction failed
     }
     //
     //	Strip off the bits that indicate which server should
     //	be used.
     //
     if (strlen($referenceGUID) > 15) {
         // Server 16 and above?
         $siteNo = substr($referenceGUID, 0, 2);
         // Get first two digits
     } else {
         $siteNo = substr($referenceGUID, 0, 1);
         // Get first digit only
     }
     $siteNo = hexdec($siteNo);
     // Convert to decimal
     //
     //	Build the hostname to which the transaction should
     //	be directed.
     //
     $serverName = $request->Get("gatewayServer");
     if ($serverName == NULL) {
         // Was server specified?
         $serverName = $this->rocketGateHost;
         // No - Use default
         if (($separator = strpos($serverName, ".")) > 0) {
             $prefix = substr($serverName, 0, $separator);
             $serverName = substr($serverName, $separator);
             $serverName = $prefix . "-" . $siteNo . $serverName;
         }
     }
     //
     //	Send the transaction to the named host.
     //
     $hostAddr = gethostbyname($serverName);
     // Decode name if possible
     //////////////////////////////////////////////////////////////////////
     //
     //	05-31-2009	darcy
     //
     //	If gw-16.rocketgate.com or gw-17.rocketgate.com cannot be
     //	resolved, plug-in static IP addresses.
     //
     if ($hostAddr == "gw-16.rocketgate.com") {
         $hostAddr = "69.20.127.91";
     }
     if ($hostAddr == "gw-17.rocketgate.com") {
         $hostAddr = "72.32.126.131";
     }
     //
     //////////////////////////////////////////////////////////////////////
     $results = $this->PerformCURLTransaction($hostAddr, $request, $response);
     if ($results == GatewayCodes__RESPONSE_SUCCESS) {
         return TRUE;
     }
     return FALSE;
 }