Inheritance: POSExchange
Esempio n. 1
0
        public void OnRefundPaymentResponse(RefundPaymentResponse response)
        {
            if (TxState.SUCCESS.Equals(response.Code))
            {
                uiThread.Send(delegate(object state) {
                    object orderObj;
                    TempObjectMap.TryGetValue(response.OrderId, out orderObj);
                    TempObjectMap.Remove(response.OrderId);
                    POSRefund refund = new POSRefund(response.PaymentId, response.OrderId, null, response.RefundObj.amount);

                    ((POSOrder)orderObj).AddRefund(refund);

                    ListViewItem lvi = new ListViewItem();
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());

                    lvi.SubItems[0].Text = "REFUND";
                    lvi.SubItems[3].Text = (response.RefundObj.amount / 100.0).ToString("C2");

                    OrderPaymentsView.Items.Add(lvi);
                }, null);
            }
            else if (TxState.FAIL.Equals(response.Code))
            {
                uiThread.Send(delegate(object state) {
                    MessageBox.Show("Card authentication failed");
                    PaymentReset();
                }, null);
            }
        }
Esempio n. 2
0
 public void AddRefund(POSRefund refund)
 {
     foreach (POSExchange pay in Payments)
     {
         if (pay is POSPayment)
         {
             if (pay.PaymentID == refund.PaymentID)
             {
                 ((POSPayment)pay).PaymentStatus = POSPayment.Status.REFUNDED;
             }
         }
     }
     Payments.Add(refund);
 }
Esempio n. 3
0
 public void AddRefund(POSRefund refund)
 {
     foreach (POSExchange pay in Payments)
     {
         if (pay is POSPayment)
         {
             if (pay.PaymentID == refund.PaymentID)
             {
                 ((POSPayment)pay).PaymentStatus = POSPayment.Status.REFUNDED;
             }
         }
     }
     Payments.Add(refund);
     onOrderChange(this, OrderChangeTarget.PAYMENT);
 }
Esempio n. 4
0
        public void AddRefund(POSRefund refund)
        {
            foreach(POSExchange pay in Payments)
            {
                if(pay is POSPayment)
                {
                    if (pay.PaymentID == refund.PaymentID)
                    {
                        ((POSPayment)pay).PaymentStatus = POSPayment.Status.REFUNDED;
                    }

                }
            }
            Payments.Add(refund);
        }
        public void OnRefundPaymentResponse(RefundPaymentResponse response)
        {
            if (response.Success)
            {
                string paymentID = response.PaymentId;
                string employeeID = null;
                if (paymentID != null)
                {
                    uiThread.Send(delegate (object state) {

                        object orderObj = null;

                        TempObjectMap.TryGetValue(paymentID, out orderObj);
                        if (orderObj != null)
                        {
                            TempObjectMap.Remove(paymentID);
                            if (response.Refund.employee != null)
                            {
                                employeeID = response.Refund.employee.id;
                            }

                            POSRefund refund = new POSRefund(response.Refund.id, response.PaymentId, response.OrderId, employeeID, response.Refund.amount);

                            ((POSOrder)orderObj).Status = POSOrder.OrderStatus.OPEN; //re-open order for editing/payment
                            ((POSOrder)orderObj).AddRefund(refund);
                        }
                        else
                        {
                            AlertForm.Show(this, "Error", "Couldn't find order for refunded payment");
                        }

                    }, null);
                }
                else
                {
                    AlertForm.Show(this, "Error", "Couldn't find paymentID");
                }
            }
            else if (response.Result.Equals(ResponseCode.FAIL))
            {
                uiThread.Send(delegate (object state) {
                    AlertForm.Show(this, "Error", response.Message);
                    PaymentReset();
                }, null);
            }
        }
        public void OnRefundPaymentResponse(RefundPaymentResponse response)
        {
            if (TxState.SUCCESS.Equals(response.Code))
            {
                uiThread.Send(delegate (object state) {
                    object orderObj;
                    TempObjectMap.TryGetValue(response.OrderId, out orderObj);
                    TempObjectMap.Remove(response.OrderId);
                    POSRefund refund = new POSRefund(response.PaymentId, response.OrderId, null, response.RefundObj.amount);

                    ((POSOrder)orderObj).AddRefund(refund);

                    ListViewItem lvi = new ListViewItem();
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());

                    lvi.SubItems[0].Text = "REFUND";
                    lvi.SubItems[3].Text = (response.RefundObj.amount / 100.0).ToString("C2");

                    OrderPaymentsView.Items.Add(lvi);
                }, null);
            }
            else if (TxState.FAIL.Equals(response.Code))
            {
                uiThread.Send(delegate (object state) {
                    MessageBox.Show("Card authentication failed");
                    PaymentReset();
                }, null);
            }
        }
Esempio n. 7
0
        public void AddRefund(POSRefund refund)
        {
            foreach(POSExchange pay in Payments)
            {
                if(pay is POSPayment)
                {
                    if (pay.PaymentID == refund.PaymentID)
                    {
                        ((POSPayment)pay).PaymentStatus = POSPayment.Status.REFUNDED;

                    }

                }
            }
            Payments.Add(refund);
            onOrderChange(this, OrderChangeTarget.PAYMENT);
        }