Connecting Serial To Terminal
- Create a new Serial Class
- Retried list of serial ports
- Get the serial port associated with terminal
- Open port and proceed to send transaction commands
- Before sending transaction commands, always concatenate with a ‘Carriage Return”
NB:
Response received from terminal must be a fully valid xml, as partial response or broken xml will not be accepted. Terminal might send the response in pieces sometimes. A proper logic should be done to concatenate these responses together as a second response is a continuation from the first. See example below.
Broken Response
Response1:
<transResponse>
<Stan>000003</Stan>
<AuthCode>123456</AuthCode>
<RespMessage>Transaction Approved</RespMessage>
<Res
Response2:
pCode>00</RespCode>
<Amount>100</Amount>
<TerminalId>2056XYZ1</TerminalId>
<Paycode>1210****234</Paycode>
<staff>123S89</staff>
<paymentOption>paycode</paymentOption>
</transResponse>
fullyValidXml = Response1 + Response2;
Example Carriage Return
Programming Language | Carriage Return Line Feed Symbol | Code Example |
---|---|---|
C# | \r\n | “\r\n” + “Transaction Command” |
Visual Basic | vbCrLf | vbCrLf & “Transaction Command” |
JAVA | \r\n | “\r\n” + “Transaction Command” |
Visual Fox Pro | (CHR(13) + CHR(10)) | CHR(13)+ CHR(10)) + “Transaction Command” |
Updated about 13 hours ago
What’s Next