/**
  * @covers            \JohnConde\Authnet\TransactionResponse::getTransactionResponseField()
  * @covers            \JohnConde\Authnet\AuthnetJsonResponse::__construct()
  */
 public function testValidationDirectResponse()
 {
     $responseJson = '{
        "customerPaymentProfileId":"28821903",
        "validationDirectResponse":"1,1,1,This transaction has been approved.,902R0T,Y,2230582306,INV000001,description of transaction,10.95,CC,auth_capture,12345,John,Smith,Company Name,123 Main Street,Townsville,NJ,12345,United States,800-555-1234,800-555-1235,user@example.com,John,Smith,Other Company Name,123 Main Street,Townsville,NJ,12345,United States,1.00,2.00,3.00,FALSE,PONUM000001,D3B20D6194B0E86C03A18987300E781C,P,2,,,,,,,,,,,XXXX1111,Visa,,,,,,,,,,,,,,,,,29366174",
        "messages":{
           "resultCode":"Ok",
           "message":[
              {
                 "code":"I00001",
                 "text":"Successful."
              }
           ]
        }
     }';
     $response = new AuthnetJsonResponse($responseJson);
     $this->assertEquals('1', $response->getTransactionResponseField('ResponseCode'));
     $this->assertEquals('1', $response->getTransactionResponseField('ResponseSubcode'));
     $this->assertEquals('1', $response->getTransactionResponseField('ResponseReasonCode'));
     $this->assertEquals('This transaction has been approved.', $response->getTransactionResponseField('ResponseReasonText'));
     $this->assertEquals('902R0T', $response->getTransactionResponseField('AuthorizationCode'));
     $this->assertEquals('Y', $response->getTransactionResponseField('AVSResponse'));
     $this->assertEquals('2230582306', $response->getTransactionResponseField('TransactionID'));
     $this->assertEquals('INV000001', $response->getTransactionResponseField('InvoiceNumber'));
     $this->assertEquals('description of transaction', $response->getTransactionResponseField('Description'));
     $this->assertEquals('10.95', $response->getTransactionResponseField('Amount'));
     $this->assertEquals('CC', $response->getTransactionResponseField('Method'));
     $this->assertEquals('auth_capture', $response->getTransactionResponseField('TransactionType'));
     $this->assertEquals('12345', $response->getTransactionResponseField('CustomerID'));
     $this->assertEquals('John', $response->getTransactionResponseField('FirstName'));
     $this->assertEquals('Smith', $response->getTransactionResponseField('LastName'));
     $this->assertEquals('Company Name', $response->getTransactionResponseField('Company'));
     $this->assertEquals('123 Main Street', $response->getTransactionResponseField('Address'));
     $this->assertEquals('Townsville', $response->getTransactionResponseField('City'));
     $this->assertEquals('NJ', $response->getTransactionResponseField('State'));
     $this->assertEquals('12345', $response->getTransactionResponseField('ZipCode'));
     $this->assertEquals('United States', $response->getTransactionResponseField('Country'));
     $this->assertEquals('800-555-1234', $response->getTransactionResponseField('Phone'));
     $this->assertEquals('800-555-1235', $response->getTransactionResponseField('Fax'));
     $this->assertEquals('*****@*****.**', $response->getTransactionResponseField('EmailAddress'));
     $this->assertEquals('John', $response->getTransactionResponseField('ShipToFirstName'));
     $this->assertEquals('Smith', $response->getTransactionResponseField('ShipToLastName'));
     $this->assertEquals('Other Company Name', $response->getTransactionResponseField('ShipToCompany'));
     $this->assertEquals('123 Main Street', $response->getTransactionResponseField('ShipToAddress'));
     $this->assertEquals('Townsville', $response->getTransactionResponseField('ShipToCity'));
     $this->assertEquals('NJ', $response->getTransactionResponseField('ShipToState'));
     $this->assertEquals('12345', $response->getTransactionResponseField('ShipToZip'));
     $this->assertEquals('United States', $response->getTransactionResponseField('ShipToCountry'));
     $this->assertEquals('1.00', $response->getTransactionResponseField('Tax'));
     $this->assertEquals('2.00', $response->getTransactionResponseField('Duty'));
     $this->assertEquals('3.00', $response->getTransactionResponseField('Freight'));
     $this->assertEquals('FALSE', $response->getTransactionResponseField('TaxExempt'));
     $this->assertEquals('PONUM000001', $response->getTransactionResponseField('PurchaseOrderNumber'));
     $this->assertEquals('D3B20D6194B0E86C03A18987300E781C', $response->getTransactionResponseField('MD5Hash'));
     $this->assertEquals('P', $response->getTransactionResponseField('CardCodeResponse'));
     $this->assertEquals('2', $response->getTransactionResponseField('CardholderAuthenticationVerificationResponse'));
     $this->assertEquals('XXXX1111', $response->getTransactionResponseField('AccountNumber'));
     $this->assertEquals('Visa', $response->getTransactionResponseField('CardType'));
 }
 /**
  * @covers            \JohnConde\Authnet\AuthnetJsonResponse::getErrorMessage()
  */
 public function testGetErrorMessage()
 {
     $responseJson = '{
        "messages":{
           "resultCode":"Error",
           "message":[
              {
                 "code":"E00027",
                 "text":"The transaction was unsuccessful."
              }
           ]
        }
     }';
     $response = new AuthnetJsonResponse($responseJson);
     $this->assertEquals($response->getErrorText(), $response->getErrorMessage());
 }