cancel
Showing results for 
Search instead for 
Did you mean: 

Failed update customerpaymentprofile with echeck

I'm attempting to update a CustomerPaymentProfile with validationMode = liveMode. It fails because echeck doesn't seem to support this.

 

Is there any way for me to check if liveMode is supported before attempting an update with validationMode = liveMode?

This processor does not accept zero dollar authorization for this card type.

 

def update_customer_payment_profile(
            self,
            payment,
            customerPaymentProfileId,
            first_name,
            last_name,
            contact_dictionary,
            company_name,
            set_as_default=True,
            validation_mode=ValidationMode.liveMode):

        print('Updating customer payment profile', customerPaymentProfileId)

        address = contact_dictionary.get('address')
        city = contact_dictionary.get('city')
        state = contact_dictionary.get('state')
        zip_code = contact_dictionary.get('zip_code')
        country = 'US'
        phone = contact_dictionary.get('phone')

        paymentProfile = apicontractsv1.customerPaymentProfileExType()
        paymentProfile.billTo = CustomerProfile.make_billTo(
            first_name, last_name, company_name, address,
            city, state, zip_code, country, phone)
        paymentProfile.payment = payment
        paymentProfile.customerPaymentProfileId = customerPaymentProfileId

        action = apicontractsv1.updateCustomerPaymentProfileRequest()
        action.merchantAuthentication = self.merchantAuth
        action.paymentProfile = paymentProfile
        action.customerProfileId = str(
            self.instance.authorizenet_customer_profile_id)
        action.validationMode = validation_mode.value

        controller = updateCustomerPaymentProfileController(action)
        controller.execute()

        response = controller.getresponse()

        if response.messages.resultCode == OK:
            msg = 'Successfully created a customer payment profile with id: {}'
            print(msg.format(customerPaymentProfileId))

            if set_as_default:
                self.instance.authorizenet_default_payment_profile_id = int(
                    customerPaymentProfileId)
                self.instance.save()

            return customerPaymentProfileId
        else:
            raise AuthorizeNetError(response.messages.message[0]['text'].text)

    def update_customer_payment_profile_echeck(
            self,
            customerPaymentProfileId,
            account_type,
            routing_number,
            account_number,
            name_on_account,
            bank_name,
            customer_type,
            first_name,
            last_name,
            contact_dictionary=None,
            company_name=None,
            use_model_address=True,
            set_as_default=True,
            validation_mode=ValidationMode.liveMode):

        contact_dictionary = self.create_contact_dictionary(
            use_model_address, contact_dictionary)

        payment = CustomerProfile.make_bankAccount(
            account_type, routing_number, account_number,
            name_on_account, bank_name)

        return self.update_customer_payment_profile(
            payment,
            customerPaymentProfileId,
            first_name,
            last_name,
            contact_dictionary,
            company_name,
            set_as_default,
            validation_mode)
sanaani
Member
1 REPLY 1

The documentation for validationMode could be improved, it does not mention eChecks. ValidationMode does not work for eCheck payment profiles because eCheck transactions are not authorized in real-time like credit cards.

 

validationMode - 

Indicates the processing mode for the request. If the customer profile contains no payment data, this field should not be sent.

 

String.
Use testMode to perform a Luhn mod-10 check on the card number, without further validation. Use liveMode to submit a zero-dollar or one-cent transaction (depending on card type and processor support) to confirm the card number belongs to an active credit or debit account.

mmcguire
Administrator Administrator
Administrator