Connecting Serial To Terminal

  1. Create a new Serial Class
  2. Retried list of serial ports
  3. Get the serial port associated with terminal
  4. Open port and proceed to send transaction commands
  5. 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 LanguageCarriage Return Line
Feed Symbol
Code Example
C#\r\n“\r\n” + “Transaction Command”
Visual BasicvbCrLfvbCrLf & “Transaction Command”
JAVA\r\n“\r\n” + “Transaction Command”
Visual Fox Pro(CHR(13) + CHR(10))CHR(13)+ CHR(10)) +
“Transaction Command”