Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E00003:The element 'order' in namespace 'Anet .. xsd' has invalid child element 'invoiceNumber' in namespace 'Anet .. xsd'. #286

Open
iamruss opened this issue Mar 23, 2021 · 2 comments

Comments

@iamruss
Copy link

iamruss commented Mar 23, 2021

Hello,

Environment: sandbox

I have no problem creating ARB subscription with an invoice number and get my OK response just fine. But, if I cancel subscription and create new ARB subscription with the same CC details (I am using test 4111....1111) but a different name,
I am getting the following error. If I pass empty invoice number I am not getting this error. I wonder what would be causing this error, as I cannot have empty invoce number on subscriptions that were created after cancelation/expiration of the previous subscription.

E00003:The element 'order' in namespace 'AnetApi/xml/v1/schema/AnetApiSc
hema.xsd' has invalid child element 'invoiceNumber' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'discountAmount, taxIsAfterDiscount, totalTaxTypeCode, purchaserVATRegistrationNumber, merchantVATRegist
rationNumber, vatInvoiceReferenceNumber, purchaserCode, summaryCommodityCode, purchaseOrderDateUTC, supplierOrderReference, authorizedContactName, cardAcceptorRefNumber, amexDataTAA1, amexDataTAA2, amexDataTAA3, amexDataTAA4' in namespace 'AnetApi/
xml/v1/schema/AnetApiSchema.xsd'

I am creating my ARB subscription with parameters configured the following way:

            var interval = new paymentScheduleTypeInterval
            {
                length = (short) options.DurationMonths,
                unit = ARBSubscriptionUnitEnum.months
            };

            var schedule = new paymentScheduleType
            {
                interval = interval,
                // start date should be tomorrow
                // if Starts On date is provided explicitly, then use this value,
                // otherwise the current day will be used
                startDate = options.StartsOn,
                totalOccurrences = options.Occurrences ?? 9999 //if not specified, occurs forever until cancelled
            };

            var creditCard = new creditCardType
            {
                cardNumber = options.CardNumber,
                expirationDate = options.CardExpiration
            };

            //standard api call to retrieve response
            var cc = new paymentType
            {
                Item = creditCard
            };

            var customerType = new customerType
            {
                email = options.Email,
                phoneNumber = options.Phone,
                type = customerTypeEnum.individual
            };

            var addressInfo = new nameAndAddressType
            {
                firstName = options.FirstName,
                lastName = options.LastName,
                address = options.Street,
                city = options.City,
                country = options.Country,
                state = options.State,
                zip = options.ZipCode
            };

            var orderType = new orderType
            {
                invoiceNumber = options.Invoice,
                description = options.Description
            };


            var subscriptionType = new ARBSubscriptionType
            {
                amount = options.Price,
                paymentSchedule = schedule,
                billTo = addressInfo,
                payment = cc,
                customer = customerType,
                name = options.Name,
                order = orderType
            };

           var controller = new ARBCreateSubscriptionController(new ARBCreateSubscriptionRequest
            {
                subscription = subscriptionType,
                merchantAuthentication = GetMerchantAuth()
            });
            controller.Execute(GetEnvironment());

            // get the response from the service (errors contained if any)
            var response = controller.GetApiResponse(); //null returned

Please advise

@omar-tariq-dev
Copy link

@iamruss The ordering matters. I solved my problem by following the exact order as present in the documentation.

@iamruss
Copy link
Author

iamruss commented Feb 24, 2022

@iamruss The ordering matters. I solved my problem by following the exact order as present in the documentation.

I am not talking about "ordering" things in a sequence. I am talking about property named "order" of a type "ARBSubscriptionType".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants