Exemplo n.º 1
0
    public MainWindow(PointOfSaleService service, ReceiptFactory factory)
        : base(Gtk.WindowType.Toplevel)
    {
        Build();
        this.service = service;
        this.factory = factory;
        this.items   = new ListStore(typeof(string), typeof(string), typeof(string));
        this.service.BarcodeEvent      += BarcodeHandler;
        this.service.CompleteSaleEvent += CompleteSaleHandler;

        SetupWidgets();
    }
Exemplo n.º 2
0
        /// <summary>
        /// Verifica a resposta do autorizador. Se a transação foi bem sucedida,
        /// grava a transação na lista da transações da classe.
        /// </summary>
        /// <param name="report">Resposta do autorizador.</param>
        private void VerifyPoiResponse(IAuthorizationReport report)
        {
            if (report == null)
            {
                return;
            }

            // Verifica o retorno do autorizador:
            if (report.WasSuccessful == true)
            {
                // Transaction approved:
                this.Log("Transação aprovada.");

                // Envia comprovante da transação por e-mail:
                if (string.IsNullOrEmpty(this.uxTbxCustomerEmail.Text) == false)
                {
                    try
                    {
                        ReceiptFactory.Build(ReceiptType.Transaction, this.uxTbxCustomerEmail.Text)
                        .AddBodyParameters(this.GetReceipt(report))
                        .Send();
                    }
                    catch (Exception e)
                    {
                        this.Log(e.Message);
                    }
                }

                // Salva em uma collection:
                this.approvedTransactions.Add(report);

                // Adiciona o ATK (identificador unico da transação) ao log:
                this.uxCbbxTransactions.Items.Add(report.AcquirerTransactionKey);
            }
            else
            {
                this.Log("Transação negada!");
                this.Log(report.ResponseCode + " " + report.ResponseReason);
            }
        }