Skip to content

Commit aad93a2

Browse files
OctopusDeploy release: 14.0.1
1 parent 4a8c04f commit aad93a2

File tree

6 files changed

+106
-18
lines changed

6 files changed

+106
-18
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
2-
## Latest Version - V14.0.0 (09/10/2024)
2+
## Latest Version - V14.0.1 (09/20/2024)
3+
### Bug Fixes
4+
- [VAPS/NTS] - Fixed Java Memory leak issue by implementing cache thread pool to optimize memory utilization(10331).
5+
- [Portico] - Added mapping for 3DSecure (Version 2) to Transaction Summary Report.
6+
7+
## V14.0.0 (09/10/2024)
38
### Enhacements
49
- [UPA] Add new UPA commands
510
### Bug Fixes

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.heartlandpaymentsystems</groupId>
55
<artifactId>globalpayments-sdk</artifactId>
6-
<version>14.0.0</version>
6+
<version>14.0.1</version>
77
<packaging>jar</packaging>
88
<name>Heartland &amp; Global Payments SDK</name>
99
<description>API for processing payments through Global Payments</description>

src/main/java/com/global/api/entities/TransactionSummary.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public class TransactionSummary {
121121
private String taxType;
122122
private String tranNo;
123123
private String terminalId;
124+
private ThreeDSecure threeDSecure;
124125
private String tokenPanLastFour;
125126
private DateTime transactionDate;
126127
private DateTime transactionLocalDate;

src/main/java/com/global/api/gateways/NetworkGateway.java

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class NetworkGateway {
4545
private IGatewayEventHandler gatewayEventHandler;
4646
@Getter @Setter
4747
private Target target;
48+
private final ExecutorService executorService = Executors.newCachedThreadPool();
4849

4950
public String getPrimaryEndpoint() {
5051
return primaryEndpoint;
@@ -130,19 +131,16 @@ private void connect(String endpoint, Integer port) throws GatewayComsException
130131
try {
131132
SSLSocketFactory factory = new SSLSocketFactoryEx();
132133
client = (SSLSocket) factory.createSocket();
133-
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
134134
Callable<Integer> task = () -> {
135135
client.connect(new InetSocketAddress(endpoint, port), 5000);
136136
return 0;
137137
};
138-
try {
139-
Future<Integer> future = executorService.submit(task);
140-
future.get(5000, TimeUnit.MILLISECONDS);
141-
client.startHandshake();
142-
raiseGatewayEvent(new SslHandshakeEvent(connectorName, null));
143-
} catch (TimeoutException | InterruptedException | ExecutionException e) {
144-
throw new GatewayTimeoutException();
145-
}
138+
Future<Integer> future = executorService.submit(task);
139+
future.get(5000, TimeUnit.MILLISECONDS);
140+
client.startHandshake();
141+
raiseGatewayEvent(new SslHandshakeEvent(connectorName, null));
142+
} catch (TimeoutException | InterruptedException e) {
143+
throw new GatewayTimeoutException();
146144
}
147145
catch(Exception exc) {
148146
raiseGatewayEvent(new SslHandshakeEvent(connectorName, exc));
@@ -282,7 +280,6 @@ private byte[] getGatewayResponse() throws IOException, GatewayTimeoutException
282280
}
283281

284282
private int awaitResponse(InputStream in, byte[] buffer) throws GatewayTimeoutException {
285-
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
286283
Callable<Integer> task = () -> {
287284
long t = System.currentTimeMillis();
288285

@@ -320,14 +317,25 @@ private int awaitResponse(InputStream in, byte[] buffer) throws GatewayTimeoutEx
320317

321318
throw new GatewayTimeoutException();
322319
};
323-
int result;
320+
Future<Integer> future = executorService.submit(task);
324321
try {
325-
Future<Integer> future = executorService.submit(task);
326-
result = future.get( timeout, TimeUnit.MILLISECONDS);
322+
return future.get( timeout, TimeUnit.MILLISECONDS);
327323
} catch (TimeoutException | InterruptedException | ExecutionException e) {
328324
throw new GatewayTimeoutException();
325+
} finally {
326+
shutdownExecutorService();
327+
}
328+
}
329+
330+
public void shutdownExecutorService(){
331+
executorService.shutdown();
332+
try {
333+
if(!executorService.awaitTermination(1,TimeUnit.SECONDS)){
334+
executorService.shutdownNow();
335+
}
336+
} catch (InterruptedException e) {
337+
executorService.shutdownNow();
329338
}
330-
return result;
331339
}
332340

333341
private void raiseGatewayEvent(final IGatewayEvent event) {

src/main/java/com/global/api/gateways/PorticoConnector.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,30 @@ private TransactionSummary hydrateTransactionSummary(Element root) {
13491349
summary.setBillingAddress(address);
13501350
}
13511351

1352+
// 3DSecure
1353+
if (root.has("Secure3D")) {
1354+
ThreeDSecure secure3D = new ThreeDSecure();
1355+
secure3D.setAuthenticationValue(root.getString("AuthenticationValue"));
1356+
secure3D.setDirectoryServerTransactionId(root.getString("DirectoryServerTxnId"));
1357+
secure3D.setEci(root.getString("ECI"));
1358+
1359+
try {
1360+
// account for default value of Version One. No value will be returned from Portico in this case.
1361+
String versionString = root.getString("Version");
1362+
if (versionString == null || versionString.isEmpty()) {
1363+
// Default to version One.
1364+
secure3D.setVersion(Secure3dVersion.ONE);
1365+
} else {
1366+
int versionNumber = Integer.parseInt(root.getString("Version"));
1367+
secure3D.setVersion(getSecure3dVersion(versionNumber));
1368+
}
1369+
} catch (ApiException e) {
1370+
throw new RuntimeException("No Matching Version Found");
1371+
}
1372+
1373+
summary.setThreeDSecure(secure3D);
1374+
}
1375+
13521376
return summary;
13531377
}
13541378

@@ -1404,6 +1428,19 @@ private int getSecure3DVersion(Secure3dVersion version) {
14041428
}
14051429
}
14061430

1431+
public static Secure3dVersion getSecure3dVersion(int versionNumber) {
1432+
switch (versionNumber) {
1433+
case 0:
1434+
return Secure3dVersion.NONE;
1435+
case 1:
1436+
return Secure3dVersion.ONE;
1437+
case 2:
1438+
return Secure3dVersion.TWO;
1439+
default:
1440+
return Secure3dVersion.ANY;
1441+
}
1442+
}
1443+
14071444
private boolean isAppleOrGooglePay(PaymentDataSourceType paymentDataSource) {
14081445
return paymentDataSource == PaymentDataSourceType.APPLEPAY
14091446
|| paymentDataSource == PaymentDataSourceType.APPLEPAYAPP

src/test/java/com/global/api/tests/portico/PorticoEcommerceTests.java

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void ecomWithWalletData_02() throws ApiException {
126126
}
127127

128128
@Test
129-
public void ecomWithSecure3D_03() throws ApiException {
129+
public void ecomWithSecure3D_03DefaultVersionOne() throws ApiException {
130130
ThreeDSecure ecom = new ThreeDSecure();
131131
ecom.setCavv("XXXXf98AAajXbDRg3HSUMAACAAA=");
132132
ecom.setXid("0l35fwh1sys3ojzyxelu4ddhmnu5zfke5vst");
@@ -139,8 +139,18 @@ public void ecomWithSecure3D_03() throws ApiException {
139139
.withInvoiceNumber("1234567890")
140140
.withAllowDuplicates(true)
141141
.execute();
142+
143+
TransactionSummary txnDetails = ReportingService.transactionDetail(response.getTransactionId()).execute();
144+
142145
assertNotNull(response);
146+
assertNotNull(txnDetails);
147+
143148
assertEquals("00", response.getResponseCode());
149+
150+
assertNotNull(txnDetails.getThreeDSecure().getAuthenticationValue());
151+
assertNotNull(txnDetails.getThreeDSecure().getDirectoryServerTransactionId());
152+
assertNotNull(txnDetails.getThreeDSecure().getEci());
153+
assertNotNull(txnDetails.getThreeDSecure().getVersion());
144154
}
145155

146156
@Test
@@ -161,6 +171,33 @@ public void testCardHolderEmail() throws ApiException {
161171
assertNotNull(txnSummary);
162172
assertEquals(customerEmail, txnSummary.getEmail() );
163173
}
174+
175+
@Test
176+
public void ecomWithSecure3D_03Version2() throws ApiException {
177+
ThreeDSecure ecom = new ThreeDSecure();
178+
ecom.setCavv("XXXXf98AAajXbDRg3HSUMAACAAA=");
179+
ecom.setXid("0l35fwh1sys3ojzyxelu4ddhmnu5zfke5vst");
180+
ecom.setEci("5");
181+
ecom.setVersion(Secure3dVersion.TWO);
182+
card.setThreeDSecure(ecom);
183+
184+
Transaction response = card.charge(new BigDecimal("10"))
185+
.withCurrency("USD")
186+
.withInvoiceNumber("1234567890")
187+
.withAllowDuplicates(true)
188+
.execute();
189+
190+
TransactionSummary txnDetails = ReportingService.transactionDetail(response.getTransactionId()).execute();
191+
192+
assertNotNull(response);
193+
assertNotNull(txnDetails);
194+
195+
assertEquals("00", response.getResponseCode());
196+
assertNotNull(txnDetails.getThreeDSecure().getAuthenticationValue());
197+
assertNotNull(txnDetails.getThreeDSecure().getDirectoryServerTransactionId());
198+
assertNotNull(txnDetails.getThreeDSecure().getEci());
199+
assertNotNull(txnDetails.getThreeDSecure().getVersion());
200+
}
164201
@Test
165202
public void testCardHolderEmailIfCustomerDataIsNull() throws ApiException {
166203
Customer customerData = null;
@@ -242,4 +279,4 @@ public void UniqueTokenRequest() throws ApiException {
242279
assertNotNull(response2.getToken());
243280
assertNotEquals(response1.getToken(),response3.getToken());
244281
}
245-
}
282+
}

0 commit comments

Comments
 (0)