public async Task <int> DoTransaction(float amount, bool testConnFirst) { int testConnResult = 0; if (testConnFirst) { testConnResult = TestConnection(portName); } if (testConnResult == 0) { if (driver == null) { driver = new PaxPOSECRDriver(); } response = null; string msg = ""; string RNo = referenceNumber.GetNewRNo(); int result = driver.POSDoCardTransaction(portName, POSTransType.SALE, ParseAmount(amount), RNo, out response, out msg); Log(RNo, amount, result); referenceNumber.IncrementRNo(); return(result); } return(testConnResult); }
public int TestConnection(string port) { if (driver == null) { driver = new PaxPOSECRDriver(); } List <string> ports = new List <string>(); ports.AddRange(SerialPort.GetPortNames()); if (ports.Contains(port)) { string eftVer = "", libVer = ""; int result = driver.POSTestConnection(port, out eftVer, out libVer); MessageBox.Show(result.ToString()); return(result); } else { return(-1); } }