Exemplo n.º 1
0
        private void processReturnToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length < 1)
            {
                return;
            }
            long              patNum    = PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["PatNum"].ToString());
            string            alias     = _tableTrans.Rows[gridMain.SelectedIndices[0]]["Alias"].ToString();
            List <CreditCard> listCards = CreditCards.GetCardsByToken(alias,
                                                                      new List <CreditCardSource> {
                CreditCardSource.XWeb, CreditCardSource.XWebPortalLogin
            });

            if (listCards.Count == 0)
            {
                MsgBox.Show(this, "This credit card is no longer stored in the database. Return cannot be processed.");
                return;
            }
            if (listCards.Count > 1)
            {
                MsgBox.Show(this, "There is more than one card in the database with this token. Return cannot be processed due to the risk of charging the " +
                            "incorrect card.");
                return;
            }
            FormXWeb FormXW = new FormXWeb(patNum, listCards.FirstOrDefault(), XWebTransactionType.CreditReturnTransaction, createPayment: true);

            FormXW.LockCardInfo = true;
            if (FormXW.ShowDialog() == DialogResult.OK)
            {
                FillGrid();
            }
        }
Exemplo n.º 2
0
 private void processReturnToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.PaymentCreate))
     {
         return;
     }
     if (gridMain.SelectedIndices.Length < 1)
     {
         return;
     }
     if (IsXWebTransaction(gridMain.SelectedIndices[0]))
     {
         long              patNum    = PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["PatNum"].ToString());
         string            alias     = _tableTrans.Rows[gridMain.SelectedIndices[0]]["Alias"].ToString();
         List <CreditCard> listCards = CreditCards.GetCardsByToken(alias,
                                                                   new List <CreditCardSource> {
             CreditCardSource.XWeb, CreditCardSource.XWebPortalLogin
         });
         if (listCards.Count == 0)
         {
             MsgBox.Show(this, "This credit card is no longer stored in the database. Return cannot be processed.");
             return;
         }
         if (listCards.Count > 1)
         {
             MsgBox.Show(this, "There is more than one card in the database with this token. Return cannot be processed due to the risk of charging the " +
                         "incorrect card.");
             return;
         }
         FormXWeb FormXW = new FormXWeb(patNum, listCards.FirstOrDefault(), XWebTransactionType.CreditReturnTransaction, createPayment: true);
         FormXW.LockCardInfo = true;
         if (FormXW.ShowDialog() == DialogResult.OK)
         {
             FillGrid();
         }
     }
     else
     {
         Payment payment = Payments.GetPayment(PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["PaymentNum"].ToString()));
         PayConnectResponseWeb pcResponseWeb = PayConnectResponseWebs.GetOne(PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["ResponseNum"].ToString()));
         decimal amt    = PIn.Decimal(_tableTrans.Rows[gridMain.SelectedIndices[0]]["Amount"].ToString());
         string  refNum = _tableTrans.Rows[gridMain.SelectedIndices[0]]["TransactionID"].ToString();              //This is actually PayConnectResponseWeb.RefNumber, it's just stored in the TransactionID column
         if (!PayConnectL.VoidOrRefundPayConnectPortalTransaction(pcResponseWeb, payment, PayConnectService.transType.RETURN, refNum, amt))
         {
             return;
         }
         MsgBox.Show("Return successful.");
         FillGrid();
     }
 }