Skip to content

Commit 73d964e

Browse files
author
brianmc
committed
merged changes for PR 66 into Future rather than Master
2 parents 5f6c067 + 64cdd0e commit 73d964e

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

src/main/java/net/authorize/api/controller/CreateCustomerProfileController.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ protected void validateRequest() {
1818

1919
//validate required fields
2020
if ( null == request.getProfile()) throw new NullPointerException("Profile cannot be null");
21-
22-
if ( null == request.getValidationMode() || ValidationModeEnum.NONE == request.getValidationMode()) throw new NullPointerException("ValidationMode cannot be null");
23-
if ( null == request.getProfile().getPaymentProfiles() || 0 == request.getProfile().getPaymentProfiles().size()) throw new NullPointerException("Payment Profile cannot be null or empty");
24-
}
25-
21+
}
22+
2623
@Override
2724
protected Class<CreateCustomerProfileResponse> getResponseType() {
2825
return CreateCustomerProfileResponse.class;

src/test/java/net/authorize/api/controller/test/CustomerProfileTest.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import net.authorize.api.contract.v1.GetCustomerProfileResponse;
1616
import net.authorize.api.contract.v1.MerchantAuthenticationType;
1717
import net.authorize.api.contract.v1.ValidationModeEnum;
18+
import net.authorize.api.controller.ARBGetSubscriptionListController;
1819
import net.authorize.api.controller.CreateCustomerProfileController;
1920
import net.authorize.api.controller.DeleteCustomerProfileController;
2021
import net.authorize.api.controller.GetCustomerProfileController;
@@ -47,7 +48,7 @@ public void tearDown() throws Exception {
4748
super.tearDown();
4849
}
4950

50-
@Test
51+
// @Test
5152
public void testProcessCreateAndDeleteCustomerProfileRequest() {
5253

5354
//create a new customer profile
@@ -57,7 +58,26 @@ public void testProcessCreateAndDeleteCustomerProfileRequest() {
5758
//delete the customer profile created earlier
5859
deleteCustomerProfile(merchantAuthenticationType, customerProfileId, refId);
5960
}
61+
62+
63+
/**
64+
* CreateCustomerProfileController disallows creating profile without payment methods (#64)
65+
* Repro and Fix
66+
* @Zalak
67+
*/
68+
@Test
69+
public void createCustomerProfileWithoutPaymentProfileFix()
70+
{
71+
CreateCustomerProfileRequest createRequest = new CreateCustomerProfileRequest();
72+
createRequest.setMerchantAuthentication( merchantAuthenticationType);
73+
createRequest.setRefId(refId);
74+
createRequest.setProfile( customerProfileType);
75+
CreateCustomerProfileController nullController = new CreateCustomerProfileController(createRequest);
76+
Assert.assertNotNull(nullController);
77+
}
6078

79+
80+
6181
static String createCustomerProfile(
6282
MerchantAuthenticationType merchantAuthenticationType, CustomerPaymentProfileType paymentProfileType,
6383
CustomerProfileType customerProfile, String referenceId) {

0 commit comments

Comments
 (0)