public function testCreateCardFailure()
 {
     $httpResponse = $this->getMockHttpResponse('CIMCreateCardFailure.txt');
     $response = new CIMCreateCardResponse($this->getMockRequest(), $httpResponse->getBody());
     $this->assertFalse($response->isSuccessful());
     $this->assertEquals('E00041', $response->getReasonCode());
     $this->assertEquals("3", $response->getResultCode());
     $this->assertEquals("One or more fields in the profile must contain a value.", $response->getMessage());
     $this->assertNull($response->getCustomerProfileId());
     $this->assertNull($response->getCustomerPaymentProfileId());
     $this->assertNull($response->getCardReference());
 }
 public function sendData($data)
 {
     $headers = array('Content-Type' => 'text/xml; charset=utf-8');
     $data = $data->saveXml();
     $httpResponse = $this->httpClient->post($this->getEndpoint(), $headers, $data)->send();
     $response = new CIMCreateCardResponse($this, $httpResponse->getBody());
     if (!$response->isSuccessful() && $response->getReasonCode() == 'E00039') {
         // Duplicate profile. Try adding a new payment profile for the same profile and get the response
         $response = $this->createPaymentProfile($response);
     } elseif ($response->isSuccessful()) {
         $parameters = array('customerProfileId' => $response->getCustomerProfileId(), 'customerPaymentProfileId' => $response->getCustomerPaymentProfileId());
         // Get the payment profile for the specified card.
         $response = $this->makeGetPaymentProfileRequest($parameters);
     }
     $response->augmentResponse();
     return $this->response = $response;
 }