AuthorizeNet / sdk-python

Python SDK for the Authorize.Net API
Other
53 stars 82 forks source link

Get Transaction Details Info Errror #109

Open rpoole opened 6 years ago

rpoole commented 6 years ago

We are getting a Create Document Exception: <class 'pyxb.exceptions_.ContentNondeterminismExceededError'>, (<authorizenet.apicontractsv1. customerAddressType object at 0x7f2ecf0129b0> every time we pull transaction details from the API. The error is occurring on line 149 of apicontrollersbase.py.

The code being used to fetch the transaction details is (some login settings omitted)

from authorizenet import apicontractsv1
from authorizenet.apicontrollers import getTransactionDetailsController

    def verify_transaction(self, transaction_id, amount):
        logging.debug("Verifyng transaction id %s" % transaction_id)
        transaction_details_request = apicontractsv1.getTransactionDetailsRequest()
        transaction_details_request.merchantAuthentication = self.merchantAuth
        transaction_details_request.transId = transaction_id

        transaction_details_controller = getTransactionDetailsController(transaction_details_request)
        transaction_details_controller.setenvironment(self.environment)

        transaction_details_controller.execute()

        transaction_details_response = transaction_details_controller.getresponse()

        if transaction_details_response is None or transaction_details_response.messages.resultCode != apicontractsv1.messageTypeEnum.Ok or transaction_details_response.transaction.transactionStatus != 'capturedPendingSettlement' or transaction_details_response.transaction.authAmount != amount:
                    return False

        return True

The XML being returned from the sandbox API is:

<?xml version="1.0" encoding="UTF-8"?>
<getTransactionDetailsResponse xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <messages>
      <resultCode>Ok</resultCode>
      <message>
         <code>I00001</code>
         <text>Successful.</text>
      </message>
   </messages>
   <transaction>
      <transId>40014999477</transId>
      <submitTimeUTC>2018-06-15T15:07:53.33Z</submitTimeUTC>
      <submitTimeLocal>2018-06-15T08:07:53.33</submitTimeLocal>
      <transactionType>authCaptureTransaction</transactionType>
      <transactionStatus>capturedPendingSettlement</transactionStatus>
      <responseCode>1</responseCode>
      <responseReasonCode>1</responseReasonCode>
      <responseReasonDescription>Approval</responseReasonDescription>
      <authCode>THPCHV</authCode>
      <AVSResponse>Y</AVSResponse>
      <cardCodeResponse>P</cardCodeResponse>
      <authAmount>240.00</authAmount>
      <settleAmount>240.00</settleAmount>
      <taxExempt>false</taxExempt>
      <payment>
         <creditCard>
            <cardNumber>XXXX1111</cardNumber>
            <expirationDate>XXXX</expirationDate>
            <cardType>Visa</cardType>
         </creditCard>
      </payment>
      <billTo>
         <firstName>2</firstName>
         <lastName>2</lastName>
         <address>add</address>
         <city>City</city>
         <state>VA</state>
         <zip>20176</zip>
         <country>USA</country>
         <phoneNumber>2222222222</phoneNumber>
      </billTo>
      <recurringBilling>false</recurringBilling>
      <customerIP>11.111.1.11</customerIP>
      <product>Card Not Present</product>
      <marketType>eCommerce</marketType>
   </transaction>
   <clientId>accept-hosted</clientId>
</getTransactionDetailsResponse>

We are seeing this error when hitting the live API as well. It doesn't appear to cause any issues, as payments still process fine, but seeing the error in our logs is concerning.

Sapbasu15 commented 6 years ago

@rpoole the error is coming from the pyxb library but doesn't seem to interrupt the flow. We'll be looking into the error.

sanaani commented 6 years ago

I get the same error.

PauloPeres commented 5 years ago

I'm still getting the same error, i know it does not affect anything but the error is still triggering. Using latest versions of PyXB and AuthorizeNet/SDK-Python

PyXB==1.2.6
authorizenet==1.1.2

I believe the XML line numbers are not matching anymore.

[error_report] [Django] ERROR: Create Document Exception:<class 'pyxb.exceptions_.ContentNondeterminismExceededError'>,(<lib.authorize_net_sdk.authorizenet.apicontractsv1.customerAddressTypeobject at 0x7f853427c7b8>,)
dhanashreeyadav1 commented 1 month ago

TCS-Dev Dhanashree- This issue has been fixed in v1.1.5.