cloudmanic/codeignitor-authorizenet-cim-library — pull request #7 by caparisi (2014-07-21 19:50:55+00:00)
Title: Fix sequence matter in XML to PaymentProfile

With the actual sequence, we have this error :

E00003

The element 'bankAccount' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'accountNumber' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'accountType, routingNumber' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.

Code Test :

function createCustomerPaymentProfile_BankAccount($dataSend)
{

// SET DATA BEFORE REQUEST
if(is_array($dataSend))
{
// General
$this->authorizecimlib->set_data('customerType'	, 'individual');
$this->authorizecimlib->set_data('customerProfileId'	, $dataSend['customerProfileId']);
$this->authorizecimlib->set_data('billToFirstName'	, 'Test');
$this->authorizecimlib->set_data('billToLastName'	, 'Test');
$this->authorizecimlib->set_data('billToAddress'	, '12 first street');
$this->authorizecimlib->set_data('billToCity'	, 'New York');
$this->authorizecimlib->set_data('billToState'	, 'New York');
$this->authorizecimlib->set_data('billToZip'	, '12345');
$this->authorizecimlib->set_data('billToCountry'	, 'US');
$this->authorizecimlib->set_data('billToPhoneNumber'	, '0123456789');

// SPECIFIC TO BANK ACCOUNT
$this->authorizecimlib->set_data('payment'	, 'BankAccountType');
$this->authorizecimlib->set_data('routingNumber'	, '211770200');
$this->authorizecimlib->set_data('accountNumber'	, '0000000000');
$this->authorizecimlib->set_data('nameOnAccount'	, substr("Test Test",22));
$this->authorizecimlib->set_data('accountType'	, 'checking');
$this->authorizecimlib->set_data('echeckType'	, 'WEB');

} else
{
//TODO ERROR
}

if(! $paymentprofileid = $this->authorizecimlib->create_customer_payment_profile())
{
return $this->authorizecimlib->get_error_msg();
}

$this->authorizecimlib->clear_data();
return $paymentprofileid;
}