Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions src/GlobalPayments.Api/Terminals/PAX/Interfaces/PaxTcpInterface.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/GlobalPayments.Api/Terminals/PAX/PaxInterface.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down