예제 #1
0
 /**
  * Test Get a Valid AVS Response Code
  */
 public function testGetValidAVSResponseCode()
 {
     $code = AVSResponseCode::code('14');
     $this->assertInternalType('array', $code);
     $this->assertArrayHasKey('description', $code);
     $this->assertEquals('Postal code matches, address not verified', $code['description']);
 }
예제 #2
0
 /**
  * Process the avs response.
  * 
  * @param  DOMDocument $raw_response
  * @return null
  */
 protected function processAvsResult(\DOMDocument $raw_response, $mode = 'sandbox')
 {
     try {
         $fraud_nodes = $raw_response->getElementsByTagName('avsResult');
         if ($fraud_nodes->length > 0) {
             foreach ($fraud_nodes as $node) {
                 if ($node->nodeName == 'avsResult') {
                     return ResponseCode\AVSResponseCode::code($node->nodeValue);
                 }
             }
             if (!$this->avs) {
                 return ResponseCode\AVSResponseCode::code('34');
             }
         } else {
             if ($mode === 'sandbox') {
                 return ResponseCode\AVSResponseCode::code('01');
             } else {
                 return ResponseCode\AVSResponseCode::code('34');
             }
         }
     } catch (UnknownResponseCodeException $e) {
         return ResponseCode\AVSResponseCode::code('34');
     }
 }