My setup:
Clover Flex with Network Pay integration.
C# with version 4.0.6.0 (latest) of the SDK.
Clover device is connect to our network via the ambilocal cord to a network cable and power supply.
When I send the transaction the the Clover device, the device displays the amount owning to the customer. If I unplug and plug in the network cord and the customer then process their credit card the OnSaleResponse response is not called. The credit card is processed and then the Clover device displays a never ending rotating circle.
My understanding is it should call the OnSaleReponse with a status of Disconnected and void the payment.
If I am incorrect then how should this be handled.
Here is a very simple version of the code to repeat this issue:
public class CloverFlexExample
{
private static ICloverConnector _cloverConnector;
public CloverFlexExample()
{
}
public void Process()
{
var endpoint = "wss://10.0.1.109:12345/remote_pay";
var websocketConfiguration = new WebSocketCloverDeviceConfiguration(endpoint, //endpoint
"com.cloverconnector.windows.simple.sample:1.3.1", //remoteApplicationID
false, //enableLogging
1, //pingSleepSeconds
"Aisle 2", //posName
"ABC123", //serialNumber
null, //pairingAuthToken
OnPairingCode, //pairingCodeHandler
OnPairingSuccess, //pairingSuccessHandler
OnPairingState); //pairingStateHandler
_cloverConnector = CloverConnectorFactory.createICloverConnector(websocketConfiguration);
var listener = new SomeCloverConnectorListener(_cloverConnector);
_cloverConnector.AddCloverConnectorListener(listener);
_cloverConnector.InitializeConnection();
while (!listener.DeviceReady)
{
System.Threading.Thread.Sleep(1000);
}
var pendingSale = new SaleRequest();
pendingSale.ExternalId = 999 + " - " + ExternalIDUtil.GenerateRandomString(12);
pendingSale.Amount = 100;
pendingSale.AutoAcceptSignature = true;
pendingSale.DisableDuplicateChecking = true;
pendingSale.DisableReceiptSelection = true;
pendingSale.DisablePrinting = true;
_cloverConnector.Sale(pendingSale);
}
private void OnPairingCode(string pairingCode)
{
MessageBox.Show($"paring code: {pairingCode}");
}
private void OnPairingState(string state, string message)
{
}
private void OnPairingSuccess(string authToken)
{
}
}
public class SomeCloverConnectorListener : DefaultCloverConnectorListener
{
private readonly ICloverConnector _cloverConnector;
public bool DeviceReady { get; set; }
public bool SaleDone { get; set; }
public SomeCloverConnectorListener(ICloverConnector cloverConnector) : base(cloverConnector)
{
_cloverConnector = cloverConnector;
}
public override void OnDeviceReady(MerchantInfo merchantInfo)
{
base.OnDeviceReady(merchantInfo);
DeviceReady = true;
}
public override void OnDeviceError(CloverDeviceErrorEvent error)
{
base.OnDeviceError(error);
}
public override void OnDeviceConnected()
{
base.OnDeviceConnected();
}
public override void OnDeviceDisconnected()
{
base.OnDeviceDisconnected();
}
public override void OnDeviceActivityStart(CloverDeviceEvent deviceEvent)
{
}
public override void OnConfirmPaymentRequest(ConfirmPaymentRequest request)
{
_cloverConnector.AcceptPayment(request.Payment);
}
public override void OnSaleResponse(SaleResponse response)
{
base.OnSaleResponse(response);
SaleDone = true;
}
}