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++; } 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;