AuthorizeNet / sdk-dotnet

.Net SDK for Authorize.Net API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

iamruss opened this issue · comments

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

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

@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".