cancel
Showing results for 
Search instead for 
Did you mean: 

Update Billing Address using CIM Java SDK

I have a business requirement to allow users to update their billing address only, not having to reenter the credit card details.

 

I have similar functionality that updates the credit card only, leaving the old billing address, and it works.

 

When I execute the code below I get an error: E00027 - (TESTMODE) The credit card has expired.

 

Here's my code:

    // fetch current payment profile
    Transaction transaction = merchant.createCIMTransaction(TransactionType.GET_CUSTOMER_PAYMENT_PROFILE);

    transaction.setCustomerProfileId(customerProfileId);
    transaction.setCustomerPaymentProfileId(paymentProfileId);

    Result<Transaction> result = (Result<Transaction>) merchant.postTransaction(transaction);
    final net.authorize.data.cim.PaymentProfile currPaymentProfile = result.getCustomerPaymentProfile();

    currPaymentProfile.setBillTo(newBillingAddress);

    // save billing address updates
    transaction = merchant.createCIMTransaction(TransactionType.UPDATE_CUSTOMER_PAYMENT_PROFILE);
    transaction.setCustomerProfileId(customerProfileId);
    transaction.addPaymentProfile(currPaymentProfile);
    transaction.setValidationMode(ValidationModeType.TEST_MODE);

    result = (Result<Transaction>) merchant.postTransaction(transaction);
    result.printMessages();

 Is this a bug, or am I doing something wrong here?

 

I couldn't find a real documentation for the SDK, but according to the XML and SOAP docs, fetching the existing payment profile, and filling in the updates should be OK, even though the CC details are masked.

 

If it helps, I use the following SDK version:

    <dependency>
      <groupId>net.authorize</groupId>
      <artifactId>anet-java-sdk</artifactId>
      <version>1.4.5</version>
    </dependency>

 

eran
Contributor
22 REPLIES 22

Since the error said the card has expired. have you try the update on a payment profile that is not expired?

RaynorC1emen7
Expert

Thanks for the reply @RaynorC1emen7.

 

Actually this is a payment profile I create, and then try to update in a test.

The creation succeeds, but the update fails, which leeds me to believe that there may be a bug in the SDK.

Not sure if it is the same or not, but on c# code, it need to convert the cc info of "MaskedType" from  GetCustomerPaymentProfile to cc info of "SimpleType" to use in UpdateCustomerPaymentProfile. All it need is copy the data from masked type to the simple type.

There's only a single CreditCard class in the Java SDK.

 

If I strip the non numeric digits I get: E00015 - The field length is invalid for Card Number.

 

Looking at the java tests that ship with the SDK, I see that the tests actually never use a masked CC number, rather send the full CC number :P

 

BTW, is this a c# sdk, or the soap API?

That is from CIM soap API.

What do you get if you just strip the non numeric digits from the expired date("xxxx") or just hardcode to something in the future like "0114"?

This works, but I fear it will only work in TEST_MODE.

 

This isn't really what I want to do...

If hardcoding to a future date work. There probably a bug in the SDK. Fixed it and post the code and see if the MOD will get it into the next SDK update.

I will try to debug the SDK.

 

I didn't realize this code is community driven.

 

Any idea where to post a fix if I manage to find the bug?

The MOD read these discussion once in a while and let the developer know there is a bugs or fixes to the SDKs.