Inheritance: POSExchange
 protected void OnPreAuthChanged(POSPayment payment, PreAuthAction action)
 {
     if (PreAuthListChange != null)
     {
         PreAuthListChange(payment, action);
     }
 }
 public void RemovePreAuth(POSPayment payment)
 {
     if (PreAuths.Remove(payment))
     {
         OnPreAuthChanged(payment, PreAuthAction.REMOVED);
     }
 }
 private void OK_Button_Click(object sender, EventArgs e)
 {
     if(PreAuthsListView.SelectedItems.Count == 1)
     {
         selectedPayment = (POSPayment)PreAuthsListView.SelectedItems[0].Tag;
     }
     this.Close();
     this.Dispose();
 }
Exemple #4
0
        public void OnSaleResponse(SaleResponse response)
        {
            if (TransactionResponse.SUCCESS.Equals(response.Code))
            {
                cloverConnector.ShowThankYouScreen();
                Store.CurrentOrder.Status = POSOrder.OrderStatus.CLOSED;
                POSPayment payment = new POSPayment(response.Payment.id, response.Payment.order.id, response.Payment.employee.id, response.Payment.amount, response.Payment.tipAmount, response.Payment.cashbackAmount);
                payment.PaymentStatus = POSPayment.Status.PAID;
                Store.CurrentOrder.AddPayment(payment);


                uiThread.Send(delegate(object state)
                {
                    if (payment.CashBackAmount > 0)
                    {
                        //cloverConnector.OpenCashDrawer("Cash Back"); // not needed here, as the device will automatically open cash drawer with cash back
                        MessageBox.Show(this, "Cash Back" + (payment.CashBackAmount / 100.0).ToString("C2"), "Cash Back");
                    }
                    RegisterTabs.SelectedIndex = 0;
                    PaymentReset();
                    NewOrder();
                }, null);

                BackgroundWorker bgWorker = new BackgroundWorker();
                bgWorker.DoWork += new DoWorkEventHandler(
                    delegate(object o, DoWorkEventArgs args)
                {
                    Thread.Sleep(3000);    // wait for 3 seconds, then switch to the welcome screen unless the next order has items
                    if (Store.CurrentOrder.Items.Count == 0)
                    {
                        cloverConnector.ShowWelcomeScreen();
                    }
                }
                    );

                bgWorker.RunWorkerAsync();
            }
            else if (TransactionResponse.FAIL.Equals(response.Code))
            {
                uiThread.Send(delegate(object state)
                {
                    MessageBox.Show("Card authentication failed or was declined.");
                    PaymentReset();
                }, null);
            }
            else if (TransactionResponse.CANCEL.Equals(response.Code))
            {
                uiThread.Send(delegate(object state)
                {
                    MessageBox.Show("User canceled transaction.");
                    PaymentReset();
                }, null);
            }
        }
Exemple #5
0
        //////////////// Payment Refund methods /////////////
        private void PaymentRefundButton_Click(object sender, EventArgs e)
        {
            RefundPaymentRequest request = new RefundPaymentRequest();

            if (OrderPaymentsView.SelectedItems.Count == 1)
            {
                POSPayment payment = ((POSPayment)OrderPaymentsView.SelectedItems[0].Tag);
                request.PaymentId = payment.PaymentID;
                POSOrder order = (POSOrder)OrdersListView.SelectedItems[0].Tag;
                request.OrderId = payment.OrderID;
                TempObjectMap.Add(payment.OrderID, order);
                cloverConnector.RefundPayment(request);
            }
        }
Exemple #6
0
        //////////////// Void methods /////////////
        private void VoidButton_Click(object sender, EventArgs e)
        {
            VoidPaymentRequest request = new VoidPaymentRequest();

            if (OrderPaymentsView.SelectedItems.Count == 1)
            {
                POSPayment payment = ((POSPayment)OrderPaymentsView.SelectedItems[0].Tag);
                request.PaymentId  = payment.PaymentID;
                request.EmployeeId = payment.EmployeeID;
                request.OrderId    = payment.OrderID;
                request.VoidReason = "USER_CANCEL";

                cloverConnector.VoidPayment(request);
            }
        }
        public void OnSaleResponse(SaleResponse response)
        {
            if (TransactionResponse.SUCCESS.Equals(response.Code))
            {
                cloverConnector.ShowThankYouScreen();
                Store.CurrentOrder.Status = POSOrder.OrderStatus.CLOSED;
                POSPayment payment = new POSPayment(response.Payment.id, response.Payment.order.id, response.Payment.employee.id, response.Payment.amount, response.Payment.tipAmount, response.Payment.cashbackAmount);
                payment.PaymentStatus = POSPayment.Status.PAID;
                Store.CurrentOrder.AddPayment(payment);

                uiThread.Send(delegate (object state)
                {
                    if (payment.CashBackAmount > 0)
                    {
                        //cloverConnector.OpenCashDrawer("Cash Back"); // not needed here, as the device will automatically open cash drawer with cash back
                        MessageBox.Show(this, "Cash Back" + (payment.CashBackAmount / 100.0).ToString("C2"), "Cash Back");
                    }
                    RegisterTabs.SelectedIndex = 0;
                    PaymentReset();
                    NewOrder();
                }, null);

                BackgroundWorker bgWorker = new BackgroundWorker();
                bgWorker.DoWork += new DoWorkEventHandler(
                    delegate (object o, DoWorkEventArgs args)
                    {
                        Thread.Sleep(3000);// wait for 3 seconds, then switch to the welcome screen unless the next order has items
                        if(Store.CurrentOrder.Items.Count == 0)
                        {
                            cloverConnector.ShowWelcomeScreen();
                        }
                    }
                );

                bgWorker.RunWorkerAsync();
            }
            else if (TransactionResponse.FAIL.Equals(response.Code))
            {
                uiThread.Send(delegate (object state)
                {
                    MessageBox.Show("Card authentication failed or was declined.");
                    PaymentReset();
                }, null);
            }
            else if (TransactionResponse.CANCEL.Equals(response.Code))
            {
                uiThread.Send(delegate (object state)
                {
                    MessageBox.Show("User canceled transaction.");
                    PaymentReset();
                }, null);
            }
        }
 public void AddPayment(POSPayment payment)
 {
     Payments.Add(payment);
     onOrderChange(this, OrderChangeTarget.PAYMENT);
 }
        public void PreAuthListChanged(POSPayment payment, Store.PreAuthAction action)
        {
            if (action == Store.PreAuthAction.ADDED)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Tag = payment;
                lvi.SubItems.Add(new ListViewItem.ListViewSubItem());

                lvi.SubItems[0].Text = "PRE-AUTH";
                lvi.SubItems[1].Text = (payment.Amount / 100.0).ToString("C2");

                PreAuthListView.Items.Add(lvi);
            }
            else if (action == Store.PreAuthAction.REMOVED)
            {
                foreach (ListViewItem lvi in PreAuthListView.Items)
                {
                    if (lvi.Tag.Equals(payment))
                    {
                        PreAuthListView.Items.Remove(lvi);
                        break;
                    }
                }
            }
            SaleButton.ContextMenu.MenuItems[1].Enabled = Store.PreAuths.Count > 0;
            autoResizeColumns(PreAuthListView);
        }
 private void Cancel_Button_Click(object sender, EventArgs e)
 {
     selectedPayment = null;
     this.Close();
     this.Dispose();
 }
Exemple #11
0
 public void AddPayment(POSPayment payment)
 {
     Payments.Add(payment);
 }
 public void AddPreAuth(POSPayment payment)
 {
     PreAuths.Add(payment);
     OnPreAuthChanged(payment, PreAuthAction.ADDED);
 }
Exemple #13
0
 protected void OnPreAuthChanged(POSPayment payment, PreAuthAction action)
 {
     if (PreAuthListChange != null)
     {
         PreAuthListChange(payment, action);
     }
 }
Exemple #14
0
 public void RemovePreAuth(POSPayment payment)
 {
     if(PreAuths.Remove(payment))
     {
         OnPreAuthChanged(payment, PreAuthAction.REMOVED);
     }
 }
Exemple #15
0
 public void AddPreAuth(POSPayment payment)
 {
     PreAuths.Add(payment);
     OnPreAuthChanged(payment, PreAuthAction.ADDED);
 }
Exemple #16
0
 public void ModifyPaymentStatus(string paymentID, POSPayment.Status status)
 {
     foreach (Object paymentObject in Payments)
     {
         if (paymentObject is POSPayment && ((POSPayment)paymentObject).PaymentID == paymentID)
         {
             ((POSPayment)paymentObject).PaymentStatus = status;
             onOrderChange(this, OrderChangeTarget.PAYMENT);
         }
     }
 }
Exemple #17
0
 public void AddPayment(POSPayment payment)
 {
     Payments.Add(payment);
     onOrderChange(this, OrderChangeTarget.PAYMENT);
 }
        public void OnPreAuthResponse(PreAuthResponse response)
        {
            if (response.Success)
            {

                if (Result.AUTH.Equals(response.Payment.result))
                {
                    uiThread.Send(delegate (object state) {
                        AlertForm.Show(this, "Card Authorized", "Payment was Pre-Authorized");
                        POSPayment preAuth = new POSPayment(response.Payment.id, response.Payment.order.id, null, response.Payment.amount);
                        Store.AddPreAuth(preAuth);

                    }, null);
                }
            }
            else if (response.Result.Equals(ResponseCode.FAIL))
            {
                uiThread.Send(delegate (object state)
                {
                    AlertForm.Show(this, response.Reason, response.Message);
                    PaymentReset();
                }, null);
            }
            else if (response.Result.Equals(ResponseCode.CANCEL))
            {
                uiThread.Send(delegate (object state)
                {
                    AlertForm.Show(this, response.Reason, response.Message);
                    PaymentReset();
                }, null);
            }
        }
        public void OnSaleResponse(SaleResponse response)
        {
            if (response.Success)
            {
                POSPayment payment = new POSPayment(response.Payment.id, response.Payment.order.id, response.Payment.employee.id, response.Payment.amount, response.Payment.tipAmount, response.Payment.cashbackAmount);
                if (response.IsAuth) //Tip Adjustable
                {
                    Store.CurrentOrder.Status = POSOrder.OrderStatus.AUTHORIZED;
                    payment.PaymentStatus = POSPayment.Status.AUTHORIZED;
                }
                else
                {
                    Store.CurrentOrder.Status = POSOrder.OrderStatus.CLOSED;
                    payment.PaymentStatus = POSPayment.Status.PAID;
                }
                Store.CurrentOrder.AddPayment(payment);

                uiThread.Send(delegate (object state)
                {
                    if (payment.CashBackAmount > 0)
                    {
                        ShowCashBackForm(payment.CashBackAmount);
                    }
                    RegisterTabs.SelectedIndex = 0;
                    NewOrder();
                }, null);
            }
            else if (response.Result.Equals(ResponseCode.FAIL))
            {
                uiThread.Send(delegate (object state)
                {
                    AlertForm.Show(this, response.Reason, response.Message);
                    PaymentReset();
                }, null);
            }
            else if (response.Result.Equals(ResponseCode.CANCEL))
            {
                uiThread.Send(delegate (object state)
                {
                    AlertForm.Show(this, response.Reason, response.Message);
                    PaymentReset();
                }, null);
            }
        }
        public void OnSaleResponse(SaleResponse response)
        {
            Store.CurrentOrder.Status = POSOrder.OrderStatus.CLOSED;
            POSPayment payment = new POSPayment(response.Payment.id, response.Payment.order.id, response.Payment.employee.id, response.Payment.amount);
            payment.PaymentStatus = POSPayment.Status.PAID;
            Store.CurrentOrder.AddPayment(payment);
            Store.CreateOrder();

            uiThread.Send(delegate (object state) {
                PaymentFinished();
            }, null);
        }
Exemple #21
0
 public void AddPayment(POSPayment payment)
 {
     Payments.Add(payment);
 }