Ejemplo n.º 1
0
 /**
  * Test bad request.
  */
 public function testBadRequest()
 {
     $resultStr = '<IATSRESPONSE xmlns=""><STATUS>Failure</STATUS><ERRORS>Bad request.</ERRORS><PROCESSRESULT><AUTHORIZATIONRESULT/></PROCESSRESULT></IATSRESPONSE>';
     $result = new \StdClass();
     $result->ProcessCreditCardV1Result = new \StdClass();
     $result->ProcessCreditCardV1Result->any = $resultStr;
     $iats = new ProcessLink(self::$agentCode, self::$password);
     $response = $iats->responseHandler($result, 'ProcessCreditCardV1Result');
     $this->assertEquals('Bad request.', $response);
 }
Ejemplo n.º 2
0
 /**
  * Test getBatchProcessResultFile with an ACH / EFT batch process after
  * sending an incorrectly encoded request.
  *
  * @depends testProcessLinkprocessACHEFTChargeBatchInvalidRequest
  */
 public function testProcessLinkgetBatchProcessResultFileACHEFTInvalidRequest()
 {
     // Create and populate the request object.
     $request = array('customerIPAddress' => '', 'batchId' => self::$ACHEFTBatchId);
     $iats = new ProcessLink(self::$agentCode, self::$password);
     $response = $iats->getBatchProcessResultFile($request);
     $this->assertEquals('Batch Process Has Been Done', trim($response['AUTHORIZATIONRESULT']));
     $this->assertEquals(self::$ACHEFTBatchId, $response['BATCHID']);
     $batchResultFileContents = trim(base64_decode($response['BATCHPROCESSRESULTFILE']));
     $batchData = explode("\r\n", $batchResultFileContents);
     foreach ($batchData as $batchRow) {
         $batchRowData = str_getcsv($batchRow);
         // Get result message from end of array.
         $batchRowMessage = array_pop($batchRowData);
         $this->assertStringStartsWith('Wrong Format', $batchRowMessage);
     }
 }