Skip to content

Commit c250e26

Browse files
OctopusDeploy release: 12.0.2
1 parent 09399d8 commit c250e26

File tree

17 files changed

+351
-63
lines changed

17 files changed

+351
-63
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Changelog
22

3-
## Latest Version - V12.0.1 (07/30/2024)
3+
## Latest Version - V12.0.2 (08/08/2024)
4+
### Enhancements
5+
- [PAX Devices] Added 'Sequence Number' to transaction response
6+
- [DiamondCloud] Add logger for Diamond Cloud provider payment terminal.
7+
- 10312 - Default timeout has been set to be 30 seconds in sdk and also provided way to override default value for NTS, Vaps 8583, NWS & GNAP.
8+
9+
### Fixes
10+
- [VAPS] Fixed 10327 - prompts are getting appended with 00 hps wex fleet emv are removed.
11+
12+
## V12.0.1 (07/30/2024)
413
### Bug Fixes
514
- [VAPS]: VAPS 8583 Currency Code - Issue 10325
615
- [Portico] : Added capture condition for Debit & Credit EMV transaction - Issue 10326

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>12.0.1</version>
6+
<version>12.0.2</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/builders/requestbuilder/gpApi/GpApiAuthorizationRequestBuilder.java

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
import lombok.var;
1616

1717
import java.math.BigDecimal;
18-
import java.util.*;
18+
import java.util.ArrayList;
19+
import java.util.HashMap;
20+
import java.util.Map;
21+
import java.util.UUID;
1922

2023
import static com.global.api.builders.requestbuilder.gpApi.GpApiManagementRequestBuilder.getDccId;
2124
import static com.global.api.entities.enums.TransactionType.Refund;
@@ -238,15 +241,28 @@ public GpApiRequest buildRequest(AuthorizationBuilder builder, GpApiConnector ga
238241
verificationData.set("stored_credential", storedCredential);
239242
}
240243

241-
if (builderPaymentMethod instanceof ITokenizable && !StringUtils.isNullOrEmpty(((ITokenizable) builderPaymentMethod).getToken())) {
244+
if (builderPaymentMethod instanceof ITokenizable) {
242245
verificationData.remove("payment_method");
243-
verificationData.set("payment_method",
244-
new JsonDoc()
245-
.set("entry_mode", getEntryMode(builder, gateway.getGpApiConfig().getChannel().getValue()))
246-
.set("id", ((ITokenizable) builderPaymentMethod).getToken())
247-
.set("fingerprint_mode", builder.getCustomerData() != null ? builder.getCustomerData().getDeviceFingerPrint() : null));
246+
if (!StringUtils.isNullOrEmpty(((ITokenizable) builderPaymentMethod).getToken())) {
247+
paymentMethod
248+
.set("entry_mode", getEntryMode(builder, gateway.getGpApiConfig().getChannel().getValue()))
249+
.set("id", ((ITokenizable) builderPaymentMethod).getToken())
250+
.set("fingerprint_mode", builder.getCustomerData() != null ? builder.getCustomerData().getDeviceFingerPrint() : null);
251+
}
252+
253+
//Authentication
254+
if (builderPaymentMethod instanceof CreditCardData) {
255+
paymentMethod.set("name", ((CreditCardData) builderPaymentMethod).getCardHolderName());
256+
ThreeDSecure secureEcom = ((CreditCardData) builderPaymentMethod).getThreeDSecure();
257+
if (secureEcom != null) {
258+
var authentication = new JsonDoc().set("id", secureEcom.getServerTransactionId());
259+
paymentMethod.set("authentication", authentication);
260+
}
261+
}
248262
}
249263

264+
verificationData.set("payment_method", paymentMethod);
265+
250266
return (GpApiRequest)
251267
new GpApiRequest()
252268
.setVerb(GpApiRequest.HttpMethod.Post)

src/main/java/com/global/api/entities/enums/PaxExtData.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public enum PaxExtData implements IStringConstant {
4141
FPS_SIGN("FPSSIGN"),
4242
FPS("FPS"),
4343
MERCHANT_ID( "MerchantId"),
44-
MERCHANT_NAME( "MerchantName");
44+
MERCHANT_NAME( "MerchantName"),
45+
SEQUENCE_NUMBER("SN");
4546

4647
String value;
4748
PaxExtData(String value) { this.value = value; }

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

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.global.api.gateways.events.*;
99
import com.global.api.terminals.abstractions.IDeviceMessage;
1010
import com.global.api.utils.NtsUtils;
11-
import com.global.api.utils.StringParser;
1211
import com.global.api.utils.StringUtils;
1312
import com.global.api.utils.GnapUtils;
1413
import lombok.Getter;
@@ -23,6 +22,7 @@
2322
import java.net.InetSocketAddress;
2423
import java.util.ArrayList;
2524
import java.util.HashMap;
25+
import java.util.concurrent.*;
2626

2727
public class NetworkGateway {
2828
private SSLSocket client;
@@ -130,10 +130,19 @@ private void connect(String endpoint, Integer port) throws GatewayComsException
130130
try {
131131
SSLSocketFactory factory = new SSLSocketFactoryEx();
132132
client = (SSLSocket) factory.createSocket();
133-
client.connect(new InetSocketAddress(endpoint, port), 5000);
134-
client.startHandshake();
135-
136-
raiseGatewayEvent(new SslHandshakeEvent(connectorName, null));
133+
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
134+
Callable<Integer> task = () -> {
135+
client.connect(new InetSocketAddress(endpoint, port), 5000);
136+
return 0;
137+
};
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+
}
137146
}
138147
catch(Exception exc) {
139148
raiseGatewayEvent(new SslHandshakeEvent(connectorName, exc));
@@ -272,7 +281,9 @@ private byte[] getGatewayResponse() throws IOException, GatewayTimeoutException
272281
return null;
273282
}
274283

275-
private int awaitResponse(InputStream in, byte[] buffer) throws GatewayTimeoutException, IOException {
284+
private int awaitResponse(InputStream in, byte[] buffer) throws GatewayTimeoutException {
285+
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
286+
Callable<Integer> task = () -> {
276287
long t = System.currentTimeMillis();
277288

278289
int position = 0;
@@ -308,6 +319,15 @@ private int awaitResponse(InputStream in, byte[] buffer) throws GatewayTimeoutEx
308319
while((System.currentTimeMillis() - t) <= 20000);
309320

310321
throw new GatewayTimeoutException();
322+
};
323+
int result;
324+
try {
325+
Future<Integer> future = executorService.submit(task);
326+
result = future.get( timeout, TimeUnit.MILLISECONDS);
327+
} catch (TimeoutException | InterruptedException | ExecutionException e) {
328+
throw new GatewayTimeoutException();
329+
}
330+
return result;
311331
}
312332

313333
private void raiseGatewayEvent(final IGatewayEvent event) {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,12 +2384,14 @@ private <T extends TransactionBuilder<Transaction>> DE48_MessageControl mapMessa
23842384
if(cardType != null && cardType.getValue().trim().equals("VF")){
23852385
customerData.set(DE48_CustomerDataType.Vehicle_Number_Code3, fleetData.getVehicleNumber() == null ? fleetData.getVehicleNumber() : StringUtils.padLeft(fleetData.getVehicleNumber(),6,'0'));
23862386
customerData.set(DE48_CustomerDataType.Id_Number_Code3, fleetData.getIdNumber() == null ? fleetData.getIdNumber() : StringUtils.padLeft(fleetData.getIdNumber(),6,'0'));
2387+
customerData.set(DE48_CustomerDataType.DriverId_EmployeeNumber, fleetData.getDriverId() == null ? fleetData.getDriverId() : StringUtils.padLeft(fleetData.getDriverId(),6,'0'));
2388+
customerData.set(DE48_CustomerDataType.Odometer_Reading, fleetData.getOdometerReading() == null ? fleetData.getOdometerReading() : StringUtils.padLeft(fleetData.getOdometerReading(),6,'0'));
23872389
}else {
23882390
customerData.set(DE48_CustomerDataType.Vehicle_Number, fleetData.getVehicleNumber());
2391+
customerData.set(DE48_CustomerDataType.DriverId_EmployeeNumber, fleetData.getDriverId());
2392+
customerData.set(DE48_CustomerDataType.Odometer_Reading, fleetData.getOdometerReading());
23892393
}
23902394
customerData.set(DE48_CustomerDataType.VehicleTag, fleetData.getVehicleTag());
2391-
customerData.set(DE48_CustomerDataType.DriverId_EmployeeNumber, fleetData.getDriverId() == null ? fleetData.getDriverId() : StringUtils.padLeft(fleetData.getDriverId(),6,'0'));
2392-
customerData.set(DE48_CustomerDataType.Odometer_Reading, fleetData.getOdometerReading() == null ? fleetData.getOdometerReading() : StringUtils.padLeft(fleetData.getOdometerReading(),6,'0'));
23932395
customerData.set(DE48_CustomerDataType.DriverLicense_Number, fleetData.getDriversLicenseNumber());
23942396
customerData.set(DE48_CustomerDataType.WORKORDER_PONUMBER, fleetData.getWorkOrderPoNumber());
23952397
customerData.set(DE48_CustomerDataType.TrailerHours_ReferHours, fleetData.getTrailerReferHours());

src/main/java/com/global/api/logging/IRequestLogger.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44

55
public interface IRequestLogger {
66
void RequestSent(String request) throws IOException;
7+
78
void ResponseReceived(String response) throws IOException;
89
}

src/main/java/com/global/api/logging/RequestConsoleLogger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public String responseFormat(String response) {
2121
}
2222

2323
private void logInConsole(String text) {
24-
System.out.println(super.AppendText("%s", new String[]{text}));
24+
System.out.println(super.AppendText("%s", new String[]{text}));
2525
}
2626

2727
}

src/main/java/com/global/api/terminals/ConnectionConfig.java

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.global.api.ConfiguredServices;
44
import com.global.api.entities.enums.*;
55
import com.global.api.entities.exceptions.ConfigurationException;
6+
import com.global.api.logging.IRequestLogger;
67
import com.global.api.serviceConfigs.Configuration;
78
import com.global.api.terminals.abstractions.ITerminalConfiguration;
89
import com.global.api.terminals.diamond.DiamondCloudConfig;
@@ -29,40 +30,54 @@ public class ConnectionConfig extends Configuration implements ITerminalConfigur
2930
private DeviceType deviceType;
3031
private IRequestIdProvider requestIdProvider;
3132
private MitcConfig geniusMitcConfig;
33+
private IRequestLogger logManagementProvider;
34+
35+
public ConnectionConfig() {
36+
timeout = 30000;
37+
}
3238

3339
public void setConnectionMode(ConnectionModes connectionModes) {
3440
this.connectionMode = connectionModes;
3541
}
42+
3643
public void setBaudRate(BaudRate baudRate) {
3744
this.baudRate = baudRate;
3845
}
46+
3947
public void setParity(Parity parity) {
4048
this.parity = parity;
4149
}
50+
4251
public void setStopBits(StopBits stopBits) {
4352
this.stopBits = stopBits;
4453
}
54+
4555
public void setDataBits(DataBits dataBits) {
4656
this.dataBits = dataBits;
4757
}
58+
4859
public void setIpAddress(String ipAddress) {
4960
this.ipAddress = ipAddress;
5061
}
62+
5163
public void setPort(int port) {
5264
this.port = port;
5365
}
66+
5467
public void setDeviceType(DeviceType deviceType) {
5568
this.deviceType = deviceType;
5669
}
70+
5771
public void setRequestIdProvider(IRequestIdProvider requestIdProvider) {
5872
this.requestIdProvider = requestIdProvider;
5973
}
60-
public void setGeniusMitcConfig(MitcConfig geniusMitcConfig) {
61-
this.geniusMitcConfig = geniusMitcConfig;
74+
75+
public void setLogManagementProvider(IRequestLogger logManagementProvider) {
76+
this.logManagementProvider = logManagementProvider;
6277
}
6378

64-
public ConnectionConfig(){
65-
timeout = 30000;
79+
public void setGeniusMitcConfig(MitcConfig geniusMitcConfig) {
80+
this.geniusMitcConfig = geniusMitcConfig;
6681
}
6782

6883
public void configureContainer(ConfiguredServices services) throws ConfigurationException {
@@ -94,13 +109,13 @@ public void configureContainer(ConfiguredServices services) throws Configuration
94109

95110
@Override
96111
public void validate() throws ConfigurationException {
97-
if(connectionMode == ConnectionModes.TCP_IP || connectionMode == ConnectionModes.HTTP) {
98-
if(StringUtils.isNullOrEmpty(ipAddress))
112+
if (connectionMode == ConnectionModes.TCP_IP || connectionMode == ConnectionModes.HTTP) {
113+
if (StringUtils.isNullOrEmpty(ipAddress))
99114
throw new ConfigurationException("IpAddress is required for TCP or HTTP communication modes.");
100-
if(port == 0)
115+
if (port == 0)
101116
throw new ConfigurationException("Port is required for TCP or HTTP communication modes.");
102-
} else if(connectionMode == ConnectionModes.MEET_IN_THE_CLOUD){
103-
if(this.geniusMitcConfig == null){
117+
} else if (connectionMode == ConnectionModes.MEET_IN_THE_CLOUD) {
118+
if (this.geniusMitcConfig == null) {
104119
throw new ConfigurationException("meetInTheCloudConfig object is required for this connection method");
105120
}
106121
}

src/main/java/com/global/api/terminals/DeviceController.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.global.api.entities.enums.DeviceType;
55
import com.global.api.entities.exceptions.ApiException;
66
import com.global.api.entities.exceptions.ConfigurationException;
7+
import com.global.api.logging.IRequestLogger;
78
import com.global.api.terminals.abstractions.*;
89
import com.global.api.terminals.builders.TerminalAuthBuilder;
910
import com.global.api.terminals.builders.TerminalManageBuilder;
@@ -13,37 +14,43 @@ public abstract class DeviceController implements IDisposable {
1314
protected ITerminalConfiguration settings;
1415
protected IDeviceCommInterface _interface;
1516
protected IRequestIdProvider requestIdProvider;
17+
protected IRequestLogger logManagementProvider;
18+
19+
public DeviceController(ITerminalConfiguration settings) throws ConfigurationException {
20+
settings.validate();
21+
this.settings = settings;
22+
this.requestIdProvider = settings.getRequestIdProvider();
23+
this.logManagementProvider = settings.getLogManagementProvider();
24+
}
1625

1726
public ConnectionModes getConnectionModes() {
18-
if(settings != null)
27+
if (settings != null)
1928
return settings.getConnectionMode();
2029
return null;
2130
}
31+
2232
public DeviceType getDeviceType() {
23-
if(settings != null)
33+
if (settings != null)
2434
return settings.getDeviceType();
2535
return null;
2636
}
2737

28-
public DeviceController(ITerminalConfiguration settings) throws ConfigurationException {
29-
settings.validate();
30-
this.settings = settings;
31-
this.requestIdProvider = settings.getRequestIdProvider();
32-
}
33-
3438
public byte[] send(IDeviceMessage message) throws ApiException {
35-
if(_interface != null)
39+
if (_interface != null)
3640
return _interface.send(message);
3741
return null;
3842
}
3943

4044
public abstract IDeviceInterface configureInterface() throws ConfigurationException;
45+
4146
public abstract TerminalResponse processTransaction(TerminalAuthBuilder builder) throws ApiException;
47+
4248
public abstract TerminalResponse manageTransaction(TerminalManageBuilder builder) throws ApiException;
49+
4350
public abstract ITerminalReport processReport(TerminalReportBuilder builder) throws ApiException;
4451

4552
public void dispose() {
46-
if(_interface != null)
53+
if (_interface != null)
4754
_interface.disconnect();
4855
}
4956
}

0 commit comments

Comments
 (0)