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

Unexpected Element Error #138

Closed
no-fate opened this issue Jun 20, 2018 · 11 comments
Closed

Unexpected Element Error #138

no-fate opened this issue Jun 20, 2018 · 11 comments

Comments

@no-fate
Copy link

no-fate commented Jun 20, 2018

Hi,

There is error on create customer payment profile. If profile have any property length error then response = null, and 2 log messages from net.authorize.util.XmlUtility.

For example, if you create customer payment profile with bankAccount.routingNumber like '1111-1111-1' you will have this error. And if routingNumber is incorrect, but length is ok, like '111-111-1' then response is not null and this is ok. If routingNumber is correct then curstomer payment profile create, and response is ok.
This affects not only bankAccount.routingNumber, I saw same one on billTo.company too.

anet-sdk-java v.1.9.6
anet-sdk-java v.1.9.7

2018-06-20 07:33:14.373  INFO 14744 --- [ool-10-thread-1] net.authorize.util.XmlUtility            :
Exception - while deserializing text:
'<?xml version="1.0" encoding="utf-8"?>
<ErrorResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
  <messages>
    <resultCode>Error</resultCode>
    <message>
      <code>E00003</code>
      <text>The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:routingNumber' element is invalid - The value XXXXXXXXXXXXX is invalid according to its datatype 'String' - The actual length is greater than the MaxLength value.</text>
    </message>
  </messages>
</ErrorResponse>
'
2018-06-20 07:33:14.373  WARN 14744 --- [ool-10-thread-1] net.authorize.util.XmlUtility            :
Exception Details->
  Code:'null',
  Message:'unexpected element (uri:"AnetApi/xml/v1/schema/AnetApiSchema.xsd", local:"ErrorResponse"). Expected elements are <{AnetApi/xml/v1/schema/AnetApiSchema.xsd}ARBCancelSubscriptionResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}ARBCreateSubscriptionResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}ARBGetSubscriptionListResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}ARBGetSubscriptionResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}ARBGetSubscriptionStatusResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}ARBUpdateSubscriptionResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}authenticateTestResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}createCustomerPaymentProfileResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}createCustomerProfileResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}createCustomerProfileTransactionResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}createCustomerShippingAddressResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}createTransactionResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}decryptPaymentDataResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}deleteCustomerPaymentProfileResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}deleteCustomerProfileResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}deleteCustomerShippingAddressResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getAUJobDetailsResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getAUJobSummaryResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getBatchStatisticsResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getCustomerPaymentProfileListResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getCustomerPaymentProfileResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getCustomerProfileIdsResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getCustomerProfileResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getCustomerShippingAddressResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getHostedPaymentPageResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getHostedProfilePageResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getMerchantDetailsResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getSettledBatchListResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getTransactionDetailsResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getTransactionListResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}getUnsettledTransactionListResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}isAliveResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}logoutResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}mobileDeviceLoginResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}mobileDeviceRegistrationResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}securePaymentContainerResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}sendCustomerTransactionReceiptResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}updateCustomerPaymentProfileResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}updateCustomerProfileResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}updateCustomerShippingAddressResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}updateHeldTransactionResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}updateMerchantDetailsResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}updateSplitTenderGroupResponse>,<{AnetApi/xml/v1/schema/AnetApiSchema.xsd}validateCustomerPaymentProfileResponse>'
@gnongsie
Copy link
Contributor

gnongsie commented Jun 20, 2018

Hi,

Thank you for reaching out to us.

  • The routing number that you provide in the request must be a numeric string of 9 digits. This is specified as part of the standards set by the ABA.
  • This means that you cannot use special characters in the middle of the string.
  • When you give 1111-1111-1 as input, the length validation is violated. The error message for this is what you get and what you have attached in the issue.
  • When you give 111-111-1 as input, the string is detected as an invalid ABA routing number, which you will get as an error message.

For the billTo.company, the expected input is a string, which may include special characters. I do not see the error you are talking about.

Can you provide me the input that you provided for this field?

Your second error message is an error message for ARBCancelSubscriptionResponse, but I do not understand how this relates to the question.

[Edit : Ok, I checked again and I honestly don't know what this message is referring to. It would really help to get the context for what request you were sending when you got this message.]

Can you elaborate on how you got this message?

@no-fate
Copy link
Author

no-fate commented Jun 20, 2018

Please check create customer payment profile with bankAccount.routingNumber '1111-1111-1'.
There is no error message. CreateCustomerPaymentProfileResponse is null. Is that ok?

@no-fate
Copy link
Author

no-fate commented Jun 20, 2018

If you do not understand that this issue about I will create example tommorow, my local time is 9 p.m.

@gnongsie
Copy link
Contributor

gnongsie commented Jun 20, 2018

Hi,

That is what I meant. The input '1111-1111-1' is wrong.

The correct input should be '111111111'.

The API expects a numeric string, which cannot include '-' or any other special characters.

[EDIT:] I will check whether an error message is returned.

@no-fate
Copy link
Author

no-fate commented Jun 20, 2018

I understand this is wrong. But why is CreateCustomerPaymentProfileResponse = null after execute CreateCustomerPaymentProfileController.executeWithApiResponse? And why there is log messages about parse errors from net.authorize.util.XmlUtility? Shouldn't api return CreateCustomerPaymentProfileResponse with error messages?

@no-fate
Copy link
Author

no-fate commented Jun 20, 2018

It is about response = null. If string is too long. My company couldn't add some customer payment profiles, because companyName was too long. And it is no errors in response, because it is no response.

gnongsie added a commit to gnongsie/sdk-java that referenced this issue Jun 21, 2018
@gnongsie
Copy link
Contributor

Hi @no-fate , just to keep you updated, I've sent a fix for this and it will be available with the next release.

You are free to check out CreateCustomerProfile Sample Code for how the current version handles error messages. Of course, this will change when the next version is released to make it more intuitive for the user to handle error messages.

@no-fate
Copy link
Author

no-fate commented Jun 27, 2018

Thank you. I will check it after release.

@no-fate no-fate closed this as completed Jun 27, 2018
@no-fate
Copy link
Author

no-fate commented Oct 12, 2018

I am sorry, but version with fix is still not released.

@no-fate no-fate reopened this Oct 12, 2018
@gnongsie
Copy link
Contributor

Hi @no-fate, unfortunately, the PR which I sent did not consider existing use cases. For example, there might be merchants who expect an empty response if there is a validation error.

For now, there does not seem to be any plan to change the behavior of the API in that regard.

As a workaround, please consider CreateCustomerProfile sample code as an example. This is the best that I can come up with for now, so as to satisfy all use cases.

@no-fate
Copy link
Author

no-fate commented Oct 16, 2018

Ok, but I still not think it is proper behaviour, not to parse response from server.

And I work with existing project of your client, so your example didn't help me.

Finally I found restrictions to company name field, on https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-payment-profile.
billTo.company -> up to 50 characters.
This field didn't truncate in our side.

Ok, maybe it is not error on your side, not to parse server response. But I think it is.

It is not easy to understand what is going on, if you literally have no error messages, and nothing worth in your production logs.

@no-fate no-fate closed this as completed Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants