Skip to content

Commit 1b79ed3

Browse files
committed
CreateCustomerProfileController disallows creating profile without payment methods (#64)
1 parent c18640f commit 1b79ed3

2 files changed

Lines changed: 21 additions & 25 deletions

File tree

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,6 @@ protected void validateRequest() {
1919
//validate required fields
2020
if ( null == request.getProfile()) throw new NullPointerException("Profile cannot be null");
2121
if ( null == request.getRefId()) throw new NullPointerException("RefId cannot be null");
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-
//validate not-required fields
26-
27-
28-
//creditCardOne.setCardCode("");
29-
30-
//keyBlock.setValue(value);
31-
32-
//paymentOne.setBankAccount(bankAccountOne);
33-
//paymentOne.setTrackData(trackDataOne);
34-
//paymentOne.setEncryptedTrackData(encryptedTrackDataOne);
35-
//paymentOne.setPayPal( payPalOne);
36-
37-
// driversLicenseOne = new DriversLicenseType();
38-
// driversLicenseOne.setNumber(getRandomString("DLNumber"));
39-
// driversLicenseOne.setState(getRandomString("WA"));
40-
// driversLicenseOne.setDateOfBirth(nowString);
41-
42-
// customerPaymentProfileOne.setBillTo(customerAddressOne);
43-
// customerPaymentProfileOne.setDriversLicense(driversLicenseOne);
44-
// customerPaymentProfileOne.setTaxId(getRandomString("XX"));
45-
4622
}
4723

4824
@Override

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)