I am quite frustrated at this point, and I thought I would post this as a last resort.
I am in the process of developing a C# .NET 4.5 app that will communicate via USB to a Moneris payment device. Its a Moneris ICT-250 and Moneris refers to this as a "semi-integrated" application. I have been trying to send over a test payment to get the device to work using the Serial Port class but nothing seems to be working.
For starters, Moneris does provide a simulator to get up and running. I can confirm that I can go ahead, set up a test payment - say $100.00 - send it off....and the device lights up. It also outputs a detailed log of both the request and response.
Each request has to be a specifically formatted string that identifies the payment type, amount, etc....I have taken the string that is found in the log and sent that off, but nothing appears to be working. The device doesn't register a fail or a success.
I know that the device is connected properly. If I change the port number or unplug the device, my catch will handle it (below).
Below is a simple Console app. Is something wrong in my code? Has anyone else had any experience in connecting to a semi-integrated Moneris solution? I am open to any ideas. Moneris is unable to provide any support or code snippets. Very frustrating to say the least...
Thanks everyone! Code is below :)
using System;
using System.IO.Ports;
class Moneris_Integration
{
public static void Main()
{
SerialPort port = new SerialPort("COM8");
// These properties are required by the device
port.BaudRate = 19200;
port.Parity = Parity.Even;
port.StopBits = StopBits.One;
port.DataBits = 8;
port.Open();
// This is the request that is sent by the simulator to the device
port.Write("<STX>02<FS>0011000<FS>0020<ETX><LRC>");
port.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);
Console.WriteLine("===| Moneris Test |===");
Console.ReadKey();
}
private static void DataReceivedHandler(
object sender,
SerialDataReceivedEventArgs e)
{
SerialPort sp = (SerialPort)sender;
string incomingData = sp.ReadExisting();
Console.WriteLine("Response:");
Console.Write(incomingData);
}
}