private void voidPaymentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.PaymentCreate))
            {
                return;
            }
            if (gridMain.SelectedIndices.Length < 1 ||
                !MsgBox.Show(this, MsgBoxButtons.YesNo, "Void this payment?"))
            {
                return;
            }
            long   patNum          = PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["PatNum"].ToString());
            long   xWebResponseNum = PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["XWebResponseNum"].ToString());
            string payNote         = Lan.g(this, "Void XWeb payment made from within Open Dental") + "\r\n"
                                     + Lan.g(this, "Amount:") + " " + PIn.Double(_tableTrans.Rows[gridMain.SelectedIndices[0]]["Amount"].ToString()).ToString("f") + "\r\n"
                                     + Lan.g(this, "Transaction ID:") + " " + _tableTrans.Rows[gridMain.SelectedIndices[0]]["TransactionID"].ToString() + "\r\n"
                                     + Lan.g(this, "Card Number:") + " " + _tableTrans.Rows[gridMain.SelectedIndices[0]]["MaskedAcctNum"].ToString() + "\r\n"
                                     + Lan.g(this, "Processed:") + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();

            try {
                Cursor = Cursors.WaitCursor;
                XWebs.VoidPayment(patNum, payNote, xWebResponseNum);
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Void successful");
                FillGrid();
            }
            catch (ODException ex) {
                Cursor = Cursors.Default;
                MessageBox.Show(ex.Message);
            }
        }
 private void voidPaymentToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.PaymentCreate))
     {
         return;
     }
     if (gridMain.SelectedIndices.Length < 1 ||
         !MsgBox.Show(this, MsgBoxButtons.YesNo, "Void this payment?"))
     {
         return;
     }
     try {
         Cursor = Cursors.WaitCursor;
         if (IsXWebTransaction(gridMain.SelectedIndices[0]))
         {
             long   patNum      = PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["PatNum"].ToString());
             long   responseNum = PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["ResponseNum"].ToString());
             string payNote     = Lan.g(this, "Void XWeb payment made from within Open Dental") + "\r\n"
                                  + Lan.g(this, "Amount:") + " " + PIn.Double(_tableTrans.Rows[gridMain.SelectedIndices[0]]["Amount"].ToString()).ToString("f") + "\r\n"
                                  + Lan.g(this, "Transaction ID:") + " " + _tableTrans.Rows[gridMain.SelectedIndices[0]]["TransactionID"].ToString() + "\r\n"
                                  + Lan.g(this, "Card Number:") + " " + _tableTrans.Rows[gridMain.SelectedIndices[0]]["MaskedAcctNum"].ToString() + "\r\n"
                                  + Lan.g(this, "Processed:") + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
             XWebs.VoidPayment(patNum, payNote, responseNum);
         }
         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.VOID, refNum, amt))
             {
                 Cursor = Cursors.Default;
                 return;
             }
         }
         Cursor = Cursors.Default;
         MsgBox.Show(this, "Void successful");
         FillGrid();
     }
     catch (ODException ex) {
         Cursor = Cursors.Default;
         MessageBox.Show(ex.Message);
     }
 }
Exemple #3
0
        ///<summary>Processes the selected XWeb transaction. Returns true if the payment was successful, false otherwise.</summary>
        private bool ProcessSelectedTransaction()
        {
            double amount = PIn.Double(textAmount.Text);

            try {
                Cursor = Cursors.WaitCursor;
                if (_tranType == XWebTransactionType.CreditReturnTransaction)
                {
                    ResponseResult = XWebs.ReturnPayment(_creditCard.PatNum, textPayNote.Text, amount, _creditCard.CreditCardNum, _createPayment);
                }
            }
            catch (ODException ex) {
                Cursor = Cursors.Default;
                MessageBox.Show(ex.Message);
                return(false);
            }
            Cursor = Cursors.Default;
            return(true);
        }