Esempio n. 1
0
 private async Task SpawnLogon(LogonType type, ReceiptCutModeType cutMode, ReceiptPrintModeType printMod, CancellationToken token)
 {
     while (!token.IsCancellationRequested)
     {
         await Task.Delay(10);
         await Logon(type, cutMode, printMod, true);
     }
 }
Esempio n. 2
0
 public async Task Logon(LogonType logonType, ReceiptCutModeType cutMode, ReceiptPrintModeType printMode, bool autoApproveDialogs)
 {
     await SendRequest <EFTLogonResponse>(new EFTLogonRequest()
     {
         LogonType        = logonType,
         CutReceipt       = cutMode,
         ReceiptAutoPrint = printMode
     }, autoApproveDialogs);
 }
Esempio n. 3
0
 public async Task LastReceipt(ReceiptCutModeType cutMode, ReceiptPrintModeType printMode, ReprintType type)
 {
     await SendRequest <EFTReprintReceiptResponse>(new EFTReprintReceiptRequest()
     {
         CutReceipt       = cutMode,
         ReceiptAutoPrint = printMode,
         ReprintType      = type,
         OriginalTxnRef   = _data.OriginalTransactionReference,
         Merchant         = _data.LastReceiptMerchantNumber
     });
 }
Esempio n. 4
0
 public async Task DoSettlement(SettlementType settlement, ReceiptCutModeType cutMode,
                                PadField padInfo, ReceiptPrintModeType printMode, bool resetTotals)
 {
     await SendRequest <EFTSettlementResponse>(new EFTSettlementRequest
     {
         SettlementType       = settlement,
         CutReceipt           = cutMode,
         PurchaseAnalysisData = padInfo,
         ReceiptAutoPrint     = printMode,
         ResetTotals          = resetTotals
     });
 }
Esempio n. 5
0
        public async Task DisplayControlPanel(ControlPanelType option, ReceiptCutModeType cutMode, ReceiptPrintModeType printMode)
        {
            try
            {
                await _eft.WriteRequestAsync(new EFTControlPanelRequest()
                {
                    ControlPanelType = option,
                    ReceiptCutMode   = cutMode,
                    ReceiptPrintMode = printMode,
                    ReturnType       = ControlPanelReturnType.Immediately
                });


                bool waiting = true;
                do
                {
                    var timeoutToken = new CancellationTokenSource(new TimeSpan(0, 5, 0)).Token;                     // 5 minute timeout
                    var r            = await _eft.ReadResponseAsync(timeoutToken);

                    if (r is EFTDisplayResponse)
                    {
                        if (_data.Settings.DemoDialogOption != DemoDialogMode.Hide)
                        {
                            EFTDisplayResponse res = r as EFTDisplayResponse;
                            _data.DisplayDetails = res;
                            _data.DisplayDialog(true);
                        }
                    }
                    else if (r is EFTReceiptResponse || r is EFTReprintReceiptResponse)
                    {
                        string[] receiptText = (r is EFTReceiptResponse) ? (r as EFTReceiptResponse).ReceiptText : (r as EFTReprintReceiptResponse).ReceiptText;

                        StringBuilder receipt = new StringBuilder();
                        foreach (var s in receiptText)
                        {
                            if (s.Length > 0)
                            {
                                receipt.AppendLine(s);
                            }
                        }

                        if (!string.IsNullOrEmpty(receipt.ToString()))
                        {
                            _data.Receipt = receipt.ToString();
                        }
                    }
                    else
                    {
                        _data.LastTxnResult = DictionaryFromType(r);
                        _data.DisplayDialog(false);
                    }
                }while (waiting);
            }
            catch (Exception ex)
            {
                ShowError(ex.HResult.ToString(), ex.Message);
            }
        }
Esempio n. 6
0
 public async Task StartLogonTest(LogonType type, ReceiptCutModeType cutMode, ReceiptPrintModeType printMod)
 {
     _ct = new CancellationTokenSource();
     await SpawnLogon(type, cutMode, printMod, _ct.Token);
 }