cancel
Showing results for 
Search instead for 
Did you mean: 

IncompleteElementContentError

I'm using what is essentially the sample code from http://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-profile

 

from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
from livesettings import config_value
from decimal import *
import random


def create_customer_profile():
    merchantAuth = apicontractsv1.merchantAuthenticationType()
    merchantAuth.name = config_value('AUTHORIZENET','API_LOGIN')
    merchantAuth.transactionKey = config_value('AUTHORIZENET','TRANSACTION_KEY')

    createCustomerProfile = apicontractsv1.createCustomerProfileRequest()
    createCustomerProfile.merchantAuthentication = merchantAuth
    createCustomerProfile.profile = apicontractsv1.customerProfileType('jdoe' + str(random.randint(0, 10000)),
                                                                       'John2 Doe', 'jdoe@mail.com')

    controller = createCustomerProfileController(createCustomerProfile)
    controller.execute()

    response = controller.getresponse()

    if (response.messages.resultCode == "Ok"):
        print("Successfully created a customer profile with id: %s" % response.customerProfileId)
    else:
        print("Failed to create customer payment profile %s" % response.messages.message[0]['text'].text)

    return response


create_customer_profile()


but I get the exception included in the subject. The stack trace isn't isn't especially informative:

Error Message: Traceback (most recent call last):
File "", line 1, in 
File "/var/www/myecoinsulation-com/myecoinsulation/customer_and_sales/authorize_pasta.py", line 40, in 
create_customer_profile()
File "/var/www/myecoinsulation-com/myecoinsulation/customer_and_sales/authorize_pasta.py", line 28, in create_customer_profile
controller.execute()
File "/var/www/myecoinsulation-com/venv-myecoinsulation/local/lib/python2.7/site-packages/authorizenet/apicontrollersbase.py", line 153, in execute
xmlResponse= self._response.toxml(encoding=constants.xml_encoding, element_name=self.getrequesttype())
File "/var/www/myecoinsulation-com/venv-myecoinsulation/local/lib/python2.7/site-packages/pyxb/binding/basis.py", line 555, in toxml
dom = self.toDOM(bds, element_name=element_name)
File "/var/www/myecoinsulation-com/venv-myecoinsulation/local/lib/python2.7/site-packages/pyxb/binding/basis.py", line 527, in toDOM
self._toDOM_csc(bds, element)
File "/var/www/myecoinsulation-com/venv-myecoinsulation/local/lib/python2.7/site-packages/pyxb/binding/basis.py", line 2661, in _toDOM_csc
order = self._validatedChildren()
File "/var/www/myecoinsulation-com/venv-myecoinsulation/local/lib/python2.7/site-packages/pyxb/binding/basis.py", line 2188, in _validatedChildren
return self.__automatonConfiguration.sequencedChildren()
File "/var/www/myecoinsulation-com/venv-myecoinsulation/local/lib/python2.7/site-packages/pyxb/binding/content.py", line 638, in sequencedChildren
cfg = self._diagnoseIncompleteContent(symbols, symbol_set)
File "/var/www/myecoinsulation-com/venv-myecoinsulation/local/lib/python2.7/site-packages/pyxb/binding/content.py", line 493, in _diagnoseIncompleteContent
raise pyxb.IncompleteElementContentError(self.__instance, cfg, symbols, symbol_set)
IncompleteElementContentError: (, , [], {})

 What am I doing wrong?

preston
Member
1 ACCEPTED SOLUTION

Accepted Solutions

I found the problem. I was using the live credentials on the test url (which the SDK defaults to). I feel like a different sort of error ought to be raised to make that clearer.

View solution in original post

preston
Member
4 REPLIES 4

I found the problem. I was using the live credentials on the test url (which the SDK defaults to). I feel like a different sort of error ought to be raised to make that clearer.

preston
Member

Hi @preston,

 

Thanks for the feedback!

 

I'll raise this as an issue with the SDK team to see if we can make any improvements in this area.

Hi

i have this error, how i can fix this, in sandbox is working but with api and transaction key real happened this error

please i need help

 

pd: i am using sdk python too

dkpapo123
Member

@dkpapo123

 

When you switch to production credentials, are you also setting the environment?

 

Setting Production or Sandbox Environments

 

To set the environment use the setenvironment method on the controller before executing. E.g. for the example above:

# Defaults to constants.SANDBOX for sandbox testing
createtransactioncontroller.setenvironment(constants.PRODUCTION)