We're adding billTo in the transactionRequestType:
var billingAddress = new customerAddressType
{
firstName = model.FirstName,
lastName = model.LastName,
address = $"{model.AddressLine1} {model.AddressLine2}",
city = model.City,
state = model.State,
zip = model.ZipCode
};
var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authOnlyTransaction.ToString(),
amount = (decimal)model.PaymentAmount,
payment = paymentType,
order = new orderType
{
description = model.PaymentOrigin.ToString(),
invoiceNumber = model.InvoiceKey
},
billTo = billingAddress,
lineItems = lineItems
};
However, we are consistently receiving errors when we execute the request:
"E00003:The element 'billTo' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'state' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'country, phoneNumber, faxNumber, email' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."
I deserialize the class using this approach:
var serializer =
new XmlSerializer(typeof(customerAddressType));
using (FileStream file = new FileStream("C:/temp/billing.xml", FileMode.Create, System.IO.FileAccess.Write))
{
serializer.Serialize(file, billingAddress);
}
It seems like the xml serialization is outputting the fields in the incorrect order....otherwise please advise on field order or other issues we may be overlooking.
We're adding billTo in the transactionRequestType:
However, we are consistently receiving errors when we execute the request:
"E00003:The element 'billTo' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'state' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'country, phoneNumber, faxNumber, email' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."
I deserialize the class using this approach:
which outputs the following structure:
It seems like the xml serialization is outputting the fields in the incorrect order....otherwise please advise on field order or other issues we may be overlooking.