Description
API docs state (https://developer.authorize.net/api/reference/index.html#customer-profiles-get-customer-payment-profile):
Note: If the payment profile has previously been set as the default payment profile, you can submit this request using
customerProfileId
as the only parameter. Submitting this request with only the customer profile ID will cause the information for the default payment profile to be returned if a default payment profile has been previously designated. If no payment profile has been designated as the default payment profile, failing to specify a payment profile will result in an error.
However, the following code:
GetCustomerPaymentProfileRequest apiRequest = new GetCustomerPaymentProfileRequest();
apiRequest.setCustomerProfileId( customerProfileId );
// uncommenting makes it work, but we want the default payment profile
// apiRequest.setCustomerPaymentProfileId( customerPaymentProfileId );
GetCustomerPaymentProfileController controller = new GetCustomerPaymentProfileController(apiRequest);
controller.execute();
Results in NPE thrown from this check in net.authorize.api.controller.GetCustomerPaymentProfileController
:
if ( null == request.getCustomerPaymentProfileId()) throw new NullPointerException("CustomerPaymentProfileId cannot be null");
This makes it impossible to retrieve the default payment profile without specifying its ID explicitly.