From 5d912e83d4069fc99864a8daa62f4a2fa12064dd Mon Sep 17 00:00:00 2001 From: Garr Godfrey Date: Wed, 23 Mar 2022 13:21:59 -0700 Subject: [PATCH 1/2] use correct image size when calling PromptForSignature --- src/GlobalPayments.Api/Terminals/PAX/PaxInterface.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 src/GlobalPayments.Api/Terminals/PAX/PaxInterface.cs diff --git a/src/GlobalPayments.Api/Terminals/PAX/PaxInterface.cs b/src/GlobalPayments.Api/Terminals/PAX/PaxInterface.cs old mode 100644 new mode 100755 index 29b52734..e052dab3 --- a/src/GlobalPayments.Api/Terminals/PAX/PaxInterface.cs +++ b/src/GlobalPayments.Api/Terminals/PAX/PaxInterface.cs @@ -54,7 +54,7 @@ public override ISignatureResponse PromptForSignature(string transactionId = nul ControlCodes.FS, 300 )); - var signatureResponse = new SignatureResponse(response); + var signatureResponse = new SignatureResponse(response, _controller.DeviceType.Value); if (signatureResponse.DeviceResponseCode == "000000") return GetSignatureFile(); return signatureResponse; From 4f0fa2d1a46abd1e7e559e4ca261adefb2dec514 Mon Sep 17 00:00:00 2001 From: Garr Godfrey Date: Wed, 23 Mar 2022 13:31:14 -0700 Subject: [PATCH 2/2] fix unrecoverable exceptions after connection timeout --- .../PAX/Interfaces/PaxTcpInterface.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) mode change 100644 => 100755 src/GlobalPayments.Api/Terminals/PAX/Interfaces/PaxTcpInterface.cs diff --git a/src/GlobalPayments.Api/Terminals/PAX/Interfaces/PaxTcpInterface.cs b/src/GlobalPayments.Api/Terminals/PAX/Interfaces/PaxTcpInterface.cs old mode 100644 new mode 100755 index e152efcf..30c22a5f --- a/src/GlobalPayments.Api/Terminals/PAX/Interfaces/PaxTcpInterface.cs +++ b/src/GlobalPayments.Api/Terminals/PAX/Interfaces/PaxTcpInterface.cs @@ -19,12 +19,24 @@ public PaxTcpInterface(ITerminalConfiguration settings) { _settings = settings; } - public void Connect() { - if (_client == null) { - _client = new TcpClient(); - _client.ConnectAsync(_settings.IpAddress, int.Parse(_settings.Port)).Wait(_settings.Timeout); - _stream = _client.GetStream(); - _stream.ReadTimeout = _settings.Timeout; + public void Connect() + { + if (_client == null) + { + try + { + _client = new TcpClient(); + _client.ConnectAsync(_settings.IpAddress, int.Parse(_settings.Port)).Wait(_settings.Timeout); + _stream = _client.GetStream(); + _stream.ReadTimeout = _settings.Timeout; + } + catch (Exception) + { + // don't leave _client set without a _stream + _client?.Dispose(); + _client = null; + throw; + } } _connectionCount++; }