Skip to content

Instantly share code, notes, and snippets.

@MarceloPrado
Created July 3, 2018 19:32
Show Gist options
  • Save MarceloPrado/22e25436a300e4443f379d5bec1afc07 to your computer and use it in GitHub Desktop.
Save MarceloPrado/22e25436a300e4443f379d5bec1afc07 to your computer and use it in GitHub Desktop.
Debugging PagarMe TLS update
/* Método para iniciar sistema e maquininha */
public async Task IniciarPinPad()
{
string storagePath = "C:\\Storage\\";
Directory.CreateDirectory(storagePath);
// Pega a porta COM associada a maquininha
while (pinPadComPort == null)
{
await Task.Delay(1000);
Console.WriteLine("Searching pinpad");
pinPadComPort = GetPinPadComPort();
}
Console.WriteLine("Done searching pinpad");
form.setSystemStatus(form.STATUS_INITIALIZING_PIN_PAD);
SerialPort _port = new SerialPort(pinPadComPort, 140000, Parity.None, 8, StopBits.One);
Console.WriteLine("Port instance created");
Console.WriteLine(pinPadComPort);
_port.Open();
Console.WriteLine("Port opened!");
this._mpos = new Mpos(_port.BaseStream, Constants.getEncryptionKey(), storagePath);
/* Evento de Erros */
_mpos.Errored += _mpos_Errored;
_mpos.NotificationReceived += (sender, e) => Console.WriteLine("MPOS Notification Received, Status: {0}", e);
Console.WriteLine("initializing");
await _mpos.Initialize();
Console.WriteLine("done");
await _mpos.SynchronizeTables(true);
_mpos.Display(" LAPAG");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment