Skip to content

Commit 3a2b1bd

Browse files
author
brianmc
committed
merged PR
2 parents d9d5243 + aa0b55c commit 3a2b1bd

10 files changed

Lines changed: 89 additions & 36 deletions

File tree

src/main/java/net/authorize/AuthNetField.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ public enum AuthNetField {
273273
X_SHIP_TO_STATE("x_ship_to_state"),
274274
X_SHIP_TO_ZIP("x_ship_to_zip"),
275275
X_SHOW_FORM("x_show_form"),
276+
X_SOLUTION_ID("x_solution_id"),
277+
X_SOLUTION_NAME("x_solution_name"),
276278
X_SPLIT_TENDER_ID("x_split_tender_id"),
277279
X_STATE("x_state"),
278280
X_TAX("x_tax"),

src/main/java/net/authorize/Result.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public static boolean isAuthorizeNetResponse(String md5Value, String apiLoginId,
5454
}
5555

5656
boolean result = md5Check != null && md5Check.equalsIgnoreCase( transHash);
57-
58-
return result;
57+
58+
return result;
5959
}
6060

6161
public static final String MessageDigestAlgorithm = "MD5";

src/main/java/net/authorize/aim/Transaction.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import net.authorize.data.creditcard.CreditCard;
2828
import net.authorize.data.echeck.ECheck;
2929
import net.authorize.data.echeck.ECheckType;
30+
import net.authorize.data.reporting.Solution;
3031
import net.authorize.util.BasicXmlDocument;
3132
import net.authorize.util.DeepCopy;
3233
import net.authorize.util.HttpClient;
@@ -58,6 +59,7 @@ public class Transaction extends net.authorize.Transaction implements Serializab
5859
private Order order;
5960
private ShippingAddress shippingAddress;
6061
private ShippingCharges shippingCharges;
62+
private Solution solution;
6163
protected TransactionType transactionType;
6264
private boolean cardPresent = false;
6365
protected String MD5Value = null;
@@ -736,5 +738,25 @@ public String getMD5Value() {
736738
return MD5Value;
737739
}
738740

741+
/**
742+
* Set a solution field.
743+
*
744+
* @param solution
745+
*/
746+
public void setSolutionField(Solution solution) {
747+
this.solution = solution;
748+
749+
if(solution != null) {
750+
this.requestMap.put(AuthNetField.X_SOLUTION_ID.getFieldName(), solution.getId()!=null?solution.getId():EMPTY_STRING);
751+
}
752+
}
739753

754+
/**
755+
* Get a solution field.
756+
* @return Return the solution field.
757+
*
758+
*/
759+
public Solution getSolutionField() {
760+
return this.solution;
761+
}
740762
}

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

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

1919
//validate required fields
2020
if ( null == request.getProfile()) throw new NullPointerException("Profile cannot be null");
21-
//if ( null == request.getRefId()) throw new NullPointerException("RefId cannot be null");
21+
2222
if ( null == request.getValidationMode() || ValidationModeEnum.NONE == request.getValidationMode()) throw new NullPointerException("ValidationMode cannot be null");
2323
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-
46-
}
24+
}
4725

4826
@Override
4927
protected Class<CreateCustomerProfileResponse> getResponseType() {

src/main/java/net/authorize/util/HttpClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ private static HttpPost createHttpPost(Environment env, Transaction transaction)
6969
}
7070

7171
httpPost = new HttpPost(postUrl);
72-
httpPost.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
72+
73+
httpPost.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
7374
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
75+
7476
httpPost.setEntity(new StringEntity(transaction.toNVPString()));
7577
} else if (transaction instanceof net.authorize.arb.Transaction ||
7678
transaction instanceof net.authorize.cim.Transaction ||

src/test/java/net/authorize/aim/cardpresent/CardPresentXMLTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import net.authorize.data.creditcard.CreditCard;
1313
import net.authorize.data.xml.reporting.CardCodeResponseType;
1414
import net.authorize.util.BasicXmlDocument;
15+
import net.authorize.data.reporting.Solution;
1516

1617
import org.junit.Before;
1718
import org.junit.Test;
@@ -20,6 +21,7 @@ public class CardPresentXMLTest extends UnitTestData {
2021

2122
private Customer customer;
2223
private Order order;
24+
private Solution solution;
2325

2426
@Before
2527
public void setUp() {
@@ -36,6 +38,10 @@ public void setUp() {
3638
order = Order.createOrder();
3739
order.setDescription(orderDescription);
3840
order.setInvoiceNumber(invoiceNumber);
41+
42+
// create solution
43+
solution = Solution.createSolution();
44+
solution.setId("AAA100302");
3945
}
4046

4147
@Test
@@ -54,6 +60,7 @@ public void testApproval() {
5460
authCaptureTransaction.setCustomer(customer);
5561
authCaptureTransaction.setOrder(order);
5662
authCaptureTransaction.setCreditCard(creditCard);
63+
authCaptureTransaction.setSolutionField(solution);
5764
Assert.assertEquals("B1234123412341234^CARDUSER/JOHN^030510100000019301000000877000000", authCaptureTransaction.getCreditCard().getTrack1());
5865
Assert.assertEquals("1234123412341234=0305101193010877", authCaptureTransaction.getCreditCard().getTrack2());
5966

@@ -100,6 +107,7 @@ public void testDecline() {
100107
authCaptureTransaction.setCustomer(customer);
101108
authCaptureTransaction.setOrder(order);
102109
authCaptureTransaction.setCreditCard(creditCard);
110+
authCaptureTransaction.setSolutionField(solution);
103111

104112
net.authorize.aim.cardpresent.Result<net.authorize.aim.Transaction> result =
105113
Result.createResult(authCaptureTransaction, xmlResponse);
@@ -138,6 +146,7 @@ public void testError() {
138146
authCaptureTransaction.setCustomer(customer);
139147
authCaptureTransaction.setOrder(order);
140148
authCaptureTransaction.setCreditCard(creditCard);
149+
authCaptureTransaction.setSolutionField(solution);
141150

142151
net.authorize.aim.cardpresent.Result<net.authorize.aim.Transaction> result =
143152
Result.createResult(authCaptureTransaction, xmlResponse);

src/test/java/net/authorize/aim/cardpresent/functional_test/SimpleAuthCaptureTest.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import net.authorize.data.Order;
1717
import net.authorize.data.creditcard.CardType;
1818
import net.authorize.data.creditcard.CreditCard;
19+
import net.authorize.data.reporting.Solution;
1920

2021
import org.junit.Before;
2122
import org.junit.Test;
@@ -28,6 +29,7 @@ public class SimpleAuthCaptureTest extends UnitTestData {
2829
private Customer customer;
2930
private Order order;
3031
private CreditCard creditCard = CreditCard.createCreditCard();
32+
private Solution solution;
3133

3234
@Before
3335
public void setUp() {
@@ -48,13 +50,17 @@ public void setUp() {
4850
// create credit card
4951
creditCard = CreditCard.createCreditCard();
5052
creditCard.setCardType(CardType.VISA);
51-
creditCard.setTrack1("%B4111111111111111^CARDUSER/JOHN^1803101000000000020000831000000?");
52-
creditCard.setTrack2(";4111111111111111=1803101000020000831?");
53-
54-
merchant = Merchant.createMerchant(Environment.SANDBOX, apiLoginID, transactionKey);
55-
merchant.setDeviceType(DeviceType.VIRTUAL_TERMINAL);
56-
merchant.setMarketType(MarketType.RETAIL);
57-
merchant.setMD5Value(merchantMD5Key);
53+
creditCard.setTrack1("%B4111111111111111^CARDUSER/JOHN^1803101000000000020000831000000?");
54+
creditCard.setTrack2(";4111111111111111=1803101000020000831?");
55+
56+
merchant = Merchant.createMerchant(Environment.SANDBOX, apiLoginID, transactionKey);
57+
merchant.setDeviceType(DeviceType.VIRTUAL_TERMINAL);
58+
merchant.setMarketType(MarketType.RETAIL);
59+
merchant.setMD5Value(merchantMD5Key);
60+
61+
// create solution
62+
solution = Solution.createSolution();
63+
solution.setId("AAA100302");
5864
}
5965

6066
@Test
@@ -68,6 +74,7 @@ public void testCreditCardAuthCapture() {
6874
authCaptureTransaction.setCreditCard(creditCard);
6975

7076
authCaptureTransaction.setMerchantDefinedField("super", "duper");
77+
authCaptureTransaction.setSolutionField(solution);
7178

7279
Result<Transaction> result = (Result<Transaction>) merchant.postTransaction(authCaptureTransaction);
7380

@@ -101,6 +108,7 @@ public void testAuthOnly() {
101108
authCaptureTransaction.setOrder(order);
102109
authCaptureTransaction.setCreditCard(creditCard);
103110
authCaptureTransaction.setMerchantDefinedField(mdfKey, mdfValue);
111+
authCaptureTransaction.setSolutionField(solution);
104112

105113
Result<Transaction> result = (Result<Transaction>)merchant
106114
.postTransaction(authCaptureTransaction);
@@ -127,6 +135,7 @@ public void testCaptureOnly() {
127135
captureTransaction.setCreditCard(creditCard);
128136
captureTransaction.setTransactionId(transactionId);
129137
captureTransaction.setAuthorizationCode(authCode);
138+
captureTransaction.setSolutionField(solution);
130139

131140
Result<Transaction> result = (Result<Transaction>)merchant
132141
.postTransaction(captureTransaction);

src/test/java/net/authorize/aim/functional_test/MultiOrderAuth_Capture_Void_CreditTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import net.authorize.data.ShippingAddress;
1818
import net.authorize.data.ShippingCharges;
1919
import net.authorize.data.creditcard.CreditCard;
20+
import net.authorize.data.reporting.Solution;
2021

2122
import org.junit.Before;
2223
import org.junit.Test;
@@ -34,6 +35,7 @@ public class MultiOrderAuth_Capture_Void_CreditTest extends UnitTestData {
3435
private ShippingCharges shippingCharges;
3536
private EmailReceipt emailReceipt;
3637
private static String splitTenderId = null;
38+
private Solution solution;
3739

3840
@Before
3941
public void setUp() throws Exception {
@@ -124,6 +126,10 @@ public void setUp() throws Exception {
124126
emailReceipt.setFooterEmailReceipt(footerEmailReceipt);
125127
emailReceipt.setHeaderEmailReceipt(headerEmailReceipt);
126128
emailReceipt.setMerchantEmail(merchantEmail);
129+
130+
// create solution
131+
solution = Solution.createSolution();
132+
solution.setId("AAA100302");
127133
}
128134

129135
/**
@@ -159,6 +165,7 @@ public void testCreateSplitTenderAuthCapture() {
159165
authCaptureTransaction.setShippingCharges(shippingCharges);
160166
authCaptureTransaction.setEmailReceipt(emailReceipt);
161167
authCaptureTransaction.setMerchantDefinedField(mdfKey, mdfValue);
168+
authCaptureTransaction.setSolutionField(solution);
162169

163170
Result<Transaction> result = (Result<Transaction>)merchant.postTransaction(authCaptureTransaction);
164171

@@ -179,6 +186,7 @@ public void testCreateSplitTenderAuthCapture() {
179186
authCaptureTransaction.setShippingCharges(shippingCharges);
180187
authCaptureTransaction.setEmailReceipt(emailReceipt);
181188
authCaptureTransaction.setMerchantDefinedField(mdfKey, mdfValue);
189+
authCaptureTransaction.setSolutionField(solution);
182190

183191
result = (Result<Transaction>)merchant.postTransaction(authCaptureTransaction);
184192
Assert.assertTrue(result.isApproved());
@@ -204,6 +212,7 @@ private void getAuthCode() {
204212
authCaptureTransaction.setShippingCharges(shippingCharges);
205213
authCaptureTransaction.setEmailReceipt(emailReceipt);
206214
authCaptureTransaction.setMerchantDefinedField(mdfKey, mdfValue);
215+
authCaptureTransaction.setSolutionField(solution);
207216

208217
Result<Transaction> result = (Result<Transaction>)merchant.postTransaction(authCaptureTransaction);
209218

@@ -243,6 +252,7 @@ private void getCapture() {
243252
captureTransaction.setEmailReceipt(emailReceipt);
244253
captureTransaction.setAuthorizationCode(MultiOrderAuth_Capture_Void_CreditTest.authCode);
245254
captureTransaction.setMerchantDefinedField(mdfKey, mdfValue);
255+
captureTransaction.setSolutionField(solution);
246256

247257
Result<Transaction> result = (Result<Transaction>)merchant
248258
.postTransaction(captureTransaction);
@@ -276,6 +286,7 @@ public void testVoid() {
276286
voidTransaction.setShippingCharges(shippingCharges);
277287
voidTransaction.setEmailReceipt(emailReceipt);
278288
voidTransaction.setTransactionId(MultiOrderAuth_Capture_Void_CreditTest.transactionId);
289+
voidTransaction.setSolutionField(solution);
279290

280291
Result<Transaction> result = (Result<Transaction>)merchant
281292
.postTransaction(voidTransaction);
@@ -312,6 +323,7 @@ public void testCredit() {
312323
creditTransaction.setShippingCharges(shippingCharges);
313324
creditTransaction.setEmailReceipt(emailReceipt);
314325
creditTransaction.setTransactionId(MultiOrderAuth_Capture_Void_CreditTest.transactionId);
326+
creditTransaction.setSolutionField(solution);
315327

316328
Result<Transaction> result = (Result<Transaction>)merchant
317329
.postTransaction(creditTransaction);
@@ -340,6 +352,7 @@ public void testUnlinkedCredit() {
340352
Transaction creditTransaction = merchant.createAIMTransaction(
341353
TransactionType.UNLINKED_CREDIT, new BigDecimal(10.00));
342354
creditTransaction.setCreditCard(creditCard);
355+
creditTransaction.setSolutionField(solution);
343356

344357
Result<Transaction> result = (Result<Transaction>)merchant
345358
.postTransaction(creditTransaction);

src/test/java/net/authorize/aim/functional_test/SimpleAuthCaptureTest.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import net.authorize.data.Order;
1212
import net.authorize.data.creditcard.CreditCard;
1313
import net.authorize.data.echeck.ECheck;
14+
import net.authorize.data.reporting.Solution;
1415

1516
import org.junit.Before;
1617
import org.junit.Test;
@@ -19,6 +20,7 @@ public class SimpleAuthCaptureTest extends UnitTestData {
1920

2021
private Customer customer;
2122
private Order order;
23+
private Solution solution;
2224

2325
@Before
2426
public void setUp() {
@@ -35,6 +37,10 @@ public void setUp() {
3537
order = Order.createOrder();
3638
order.setDescription(orderDescription);
3739
order.setInvoiceNumber(invoiceNumber);
40+
41+
// create solution
42+
solution = Solution.createSolution();
43+
solution.setId("AAA100302");
3844
}
3945

4046
@Test
@@ -54,7 +60,8 @@ public void testCreditCardAuthCapture() {
5460
authCaptureTransaction.setCreditCard(creditCard);
5561

5662
authCaptureTransaction.setMerchantDefinedField("super", "duper");
57-
63+
authCaptureTransaction.setSolutionField(solution);
64+
5865
Result<Transaction> result = (Result<Transaction>) merchant.postTransaction(authCaptureTransaction);
5966

6067
Assert.assertNotNull(result);
@@ -64,7 +71,7 @@ public void testCreditCardAuthCapture() {
6471
.getReasonResponseCode());
6572
Assert.assertNotNull(result.getTarget().getAuthorizationCode());
6673
Assert.assertNotNull(result.getTarget().getTransactionId());
67-
Assert.assertNotNull(result.getTarget().getCreditCard().getAvsCode());
74+
Assert.assertNotNull(result.getTarget().getCreditCard().getAvsCode());
6875
}
6976

7077
@Test
@@ -86,6 +93,7 @@ public void testECheckAuthCapture() {
8693
authCaptureTransaction.setCustomer(customer);
8794
authCaptureTransaction.setOrder(order);
8895
authCaptureTransaction.setECheck(eCheck);
96+
authCaptureTransaction.setSolutionField(solution);
8997

9098
Result<Transaction> result = (Result<Transaction>)merchant.postTransaction(authCaptureTransaction);
9199

0 commit comments

Comments
 (0)