I am using the sdk-node library.
I am attempting to use the authorize-credit-card.js sample and add track data to the process.
The class PaymentType in apicontracts.js shows setTrackData as an available method.
I've tried applying it to the payment class using:
var creditCard = new ApiContracts.CreditCardType();
creditCard.setCardNumber(transactionData.cardNumber);
creditCard.setExpirationDate(transactionData.expirationDate);
creditCard.setCardCode(transactionData.code);
var trackData = new ApiContracts.CreditCardTrackType();
trackData.setTrack1(transactionData.track1));
trackData.setTrack2(transactionData.track2);
console.log('trackData', trackData);
// CreditCardTrackType {// track1: 'Bxxxxxxxxxxxxxx ^xx0510100000009601000000259000000',
// track2: 'xxxxxxxxxxxxxx=0905101096010259'
// }
var paymentType = new ApiContracts.PaymentType();
paymentType.setCreditCard(creditCard); // THIS console.log shows trackData: null
console.log('paymentType', paymentType);
paymentType.setTrackData(trackData);
console.log('paymentType after setTrackData', paymentType); // THIS console.log shows the CreditCardTrackType, from above
Submitting the data produces the following error:
MessagesType {
resultCode: 'Error',
message: [
{
code: 'E00003',
text: "The element 'payment' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'trackData' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'dataSource' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."
}
]
}