Skip to content

AttributeError: no such child: {AnetApi/xml/v1/schema/AnetApiSchema.xsd}profileResponse #85

Closed
@nadermx

Description

@nadermx

I'm currently trying to have it make a customer profile on a transaction creation.

It is telling me that the child does not exist, I'm pretty tired by this point, I posted on Stackoverflow, I also posted on the developer thread, either no one replies, or no one has any idea why this isn't working.

Any help?

The following code I am using is

merchantAuth.name = app_config.AUTHORIZE_KEYS['apiLoginId']
merchantAuth.transactionKey = app_config.AUTHORIZE_KEYS['transactionKey']
# Create the payment object for a payment nonce
opaqueData = apicontractsv1.opaqueDataType()
opaqueData.dataDescriptor = request.form['dataDesc']
opaqueData.dataValue = request.form['dataValue']

# Add the payment data to a paymentType object
paymentOne = apicontractsv1.paymentType()
paymentOne.opaqueData = opaqueData

# Create order information
order = apicontractsv1.orderType()
order.invoiceNumber = "invoice_%s" % user.id
order.description = "Awesome"
# Set the customer's identifying information
customerData = apicontractsv1.customerDataType()
customerData.type = "individual"
customerData.id = "cus_%s" % user.id
customerData.email = email
# Giving the credit card info
# Setting billing information
billto = apicontractsv1.nameAndAddressType()
billto.firstName = request.form['firstName']
billto.lastName = request.form['lastName']
billto.address = address1
billto.city = city
billto.state = state
billto.zip = zipcode
billto.country = country
item = request.form['item']
if item == 'dollar':
    amount = "3.00"
if item == "monthly":
    amount = "5.00"
    length = 1
if item == "annual":
    amount = "50.00"
    length = 12
# Create order information
order = apicontractsv1.orderType()
order.invoiceNumber = "invoice_%s" % user.id
order.description = "Awesomeness"

# # Set the customer's Bill To address
customerAddress = apicontractsv1.customerAddressType()
customerAddress.firstName = request.form['firstName']
customerAddress.lastName = request.form['lastName']
customerAddress.address = address1
customerAddress.city = city
customerAddress.state = state
customerAddress.zip = zipcode
customerAddress.country = country

# Create customer profile on transaction
createcustomerprofile = apicontractsv1.customerProfilePaymentType()
createcustomerprofile.createProfile = True

# Create a transactionRequestType object and add the previous objects to it.
transactionrequest = apicontractsv1.transactionRequestType()
transactionrequest.transactionType = "authCaptureTransaction"
transactionrequest.amount = amount
transactionrequest.payment = paymentOne
transactionrequest.order = order
transactionrequest.billTo = customerAddress
transactionrequest.customer = customerData
transactionrequest.profile = createcustomerprofile

# Assemble the complete transaction request
createtransactionrequest = apicontractsv1.createTransactionRequest()
createtransactionrequest.merchantAuthentication = merchantAuth
createtransactionrequest.refId = refId
createtransactionrequest.transactionRequest = transactionrequest

# Create the controller
createtransactioncontroller = createTransactionController(createtransactionrequest)
createtransactioncontroller.setenvironment(app_config.AUTH_NET_ENVIRONMENT)
createtransactioncontroller.execute()

The problem is when I try and parse the response, it tells me that it does not have a profileResponse, but the documenation shows that it should, also the schema does, it prints this things fin

 'messages': {'transId':'%s' % response.transactionResponse.transId,
 'responseCode':'%s' % response.transactionResponse.responseCode,
 'auth_code':'%s' % response.transactionResponse.messages.message[0].code,
                                                    'Description':'%s' % response.transactionResponse.messages.message[0].description,
                                                    

so I know it processes the transaction but it does not create the customer in the CIM, this causes the error

print(response.profileResponse.customerProfileId)
print(response.profileResponse.customerPaymentProfileIdList)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions