Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE is thrown when retrieving default customer payment profile #173

Open
grimsa opened this issue Jul 15, 2020 · 0 comments
Open

NPE is thrown when retrieving default customer payment profile #173

grimsa opened this issue Jul 15, 2020 · 0 comments

Comments

@grimsa
Copy link

grimsa commented Jul 15, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant