Esempio n. 1
0
 private void radioAuthorization_Click(object sender, EventArgs e)
 {
     radioSale.Checked          = false;
     radioAuthorization.Checked = true;
     radioVoid.Checked          = false;
     radioReturn.Checked        = false;
     radioForce.Checked         = false;
     textRefNumber.Visible      = false;
     labelRefNumber.Visible     = false;
     _trantype = PayConnectService.transType.AUTH;
     if (radioWebService.Checked)
     {
         textCardNumber.Focus();                //Usually transaction type is chosen before card number is entered, but textCardNumber box must be selected in order for card swipe to work.
     }
     else
     {
         textAmount.Focus();
     }
 }
Esempio n. 2
0
 private void radioReturn_Click(object sender, EventArgs e)
 {
     radioSale.Checked          = false;
     radioAuthorization.Checked = false;
     radioVoid.Checked          = false;
     radioReturn.Checked        = true;
     radioForce.Checked         = false;
     textRefNumber.Visible      = true;
     labelRefNumber.Visible     = true;
     labelRefNumber.Text        = Lan.g(this, "Ref Number");
     _trantype = PayConnectService.transType.RETURN;
     //If a security code (cvv) is provided for returns, PayConnect will throw an error saying it shouldn't have been provided.
     textSecurityCode.Text = "";
     if (radioWebService.Checked)
     {
         textCardNumber.Focus();                //Usually transaction type is chosen before card number is entered, but textCardNumber box must be selected in order for card swipe to work.
     }
     else
     {
         textAmount.Focus();
     }
 }
Esempio n. 3
0
        /// <summary>Only used to void or refund transactions from PayConnectPortal. Creates new cloned payment and paysplits for the refund or void.
        /// Returns true if the transaction was successful, otherwise false.</summary
        public static bool VoidOrRefundPayConnectPortalTransaction(PayConnectResponseWeb pcResponseWeb, Payment payment, PayConnectService.transType transType, string refNum, decimal amount)
        {
            if (!transType.In(PayConnectService.transType.RETURN, PayConnectService.transType.VOID))
            {
                return(false);
            }
            List <PaySplit> listPaySplits = PaySplits.GetForPayment(payment.PayNum);

            PayConnectService.creditCardRequest _payConnectRequest = new PayConnectService.creditCardRequest();
            PayConnectResponse response   = null;
            string             receiptStr = "";

            _payConnectRequest.TransType = transType;
            _payConnectRequest.RefNumber = refNum;
            _payConnectRequest.Amount    = amount;
            PayConnectService.transResponse transResponse = PayConnect.ProcessCreditCard(_payConnectRequest, payment.ClinicNum, x => MsgBox.Show(x));
            response   = new PayConnectResponse(transResponse, _payConnectRequest);
            receiptStr = PayConnect.BuildReceiptString(_payConnectRequest, transResponse, null, payment.ClinicNum);
            if (response == null || response.StatusCode != "0")         //error in transaction
            {
                return(false);
            }
            //Record a new payment for the voided transaction
            Payment clonePayment = payment.Clone();

            clonePayment.PayAmt *= -1;           //The negated amount of the original payment
            clonePayment.PayDate = DateTime.Now;
            clonePayment.Receipt = receiptStr;
            clonePayment.PayNote = Lan.g("PayConnectL", "Transaction Type") + ": " + Enum.GetName(typeof(PayConnectService.transType), transType)
                                   + Environment.NewLine + Lan.g("PayConnectL", "Status") + ": " + response.Description + Environment.NewLine
                                   + Lan.g("PayConnectL", "Amount") + ": " + clonePayment.PayAmt + Environment.NewLine
                                   + Lan.g("PayConnectL", "Auth Code") + ": " + response.AuthCode + Environment.NewLine
                                   + Lan.g("PayConnectL", "Ref Number") + ": " + response.RefNumber;
            clonePayment.PaymentSource = pcResponseWeb.CCSource;
            clonePayment.ProcessStatus = ProcessStat.OfficeProcessed;
            clonePayment.PayNum        = Payments.Insert(clonePayment);
            List <PaySplit> listClonedPaySplits = new List <PaySplit>();

            foreach (PaySplit paySplit in listPaySplits)
            {
                PaySplit copy = paySplit.Copy();
                copy.SplitAmt *= -1;
                copy.PayNum    = clonePayment.PayNum;
                copy.DatePay   = clonePayment.PayDate;
                listClonedPaySplits.Add(copy);
            }
            PaySplits.InsertMany(listClonedPaySplits);
            PayConnectResponseWeb newPCResponseWeb = new PayConnectResponseWeb()
            {
                PatNum            = payment.PatNum,
                PayNum            = clonePayment.PayNum,
                CCSource          = pcResponseWeb.CCSource,
                Amount            = clonePayment.PayAmt,
                PayNote           = Lan.g("PayConnectL", clonePayment.PayNote + Environment.NewLine + "From within Open Dental Proper."),
                ProcessingStatus  = PayConnectWebStatus.Completed,
                DateTimeEntry     = DateTime.Now,
                DateTimeCompleted = DateTime.Now,
                IsTokenSaved      = false,
                RefNumber         = transResponse.RefNumber,
                TransType         = transType,
                PaymentToken      = pcResponseWeb.PaymentToken,
            };

            PayConnectResponseWebs.Insert(newPCResponseWeb);
            SecurityLogs.MakeLogEntry(Permissions.PaymentCreate, clonePayment.PatNum,
                                      Patients.GetLim(clonePayment.PatNum).GetNameLF() + ", " + clonePayment.PayAmt.ToString("c"));
            return(true);
        }
Esempio n. 4
0
 private void FormPayConnect_Load(object sender, EventArgs e)
 {
     _progCur = Programs.GetCur(ProgramName.PayConnect);
     if (_progCur == null)
     {
         MsgBox.Show(this, "PayConnect does not exist in the database.");
         DialogResult = DialogResult.Cancel;
         return;
     }
     if (PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, "TerminalProcessingEnabled", _clinicNum)))
     {
         try {
             //If the config file for the DentalXChange credit card processing .dll doesn't exist, construct it from the included resource.
             if (!File.Exists("DpsPos.dll.config"))
             {
                 File.WriteAllText("DpsPos.dll.config", Properties.Resources.DpsPos_dll_config);
             }
         }
         catch (Exception ex) {
             FriendlyException.Show("Unable to create the config file for the terminal. Trying running the program as an administrator.", ex);
             //We will still allow them to run the transaction. Probably the worse that will happen is the timeout variable will be less than desired.
         }
     }
     if (!PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, "TerminalProcessingEnabled", _clinicNum)) ||
         _isAddingCard)                    //When adding a card, the web service must be used.
     {
         groupProcessMethod.Visible = false;
         Height -= 55;              //All the controls except for the Transaction Type group box should be anchored to the bottom, so they will move themselves up.
     }
     else
     {
         string procMethod = ProgramProperties.GetPropValForClinicOrDefault(_progCur.ProgramNum,
                                                                            PayConnect.ProgramProperties.DefaultProcessingMethod, _clinicNum);
         if (procMethod == "0")
         {
             radioWebService.Checked = true;
         }
         else if (procMethod == "1")
         {
             radioTerminal.Checked = true;
         }
     }
     textAmount.Text = POut.Decimal(_amountInit);
     if (_patCur == null)           //Prepaid card
     {
         radioAuthorization.Enabled = false;
         radioVoid.Enabled          = false;
         radioReturn.Enabled        = false;
         textZipCode.ReadOnly       = true;
         textNameOnCard.ReadOnly    = true;
         checkSaveToken.Enabled     = false;
         sigBoxWrapper.Enabled      = false;
     }
     else              //Other cards
     {
         textZipCode.Text       = _patCur.Zip;
         textNameOnCard.Text    = _patCur.GetNameFL();
         checkSaveToken.Checked = PrefC.GetBool(PrefName.StoreCCtokens);
         if (PrefC.GetBool(PrefName.StoreCCnumbers))
         {
             labelStoreCCNumWarning.Visible = true;
         }
         FillFieldsFromCard();
     }
     if (_isAddingCard)             //We will run a 0.01 authorization so we will not allow the user to change the transaction type or the amount.
     {
         radioAuthorization.Checked = true;
         _trantype = PayConnectService.transType.AUTH;
         groupTransType.Enabled      = false;
         labelAmount.Visible         = false;
         textAmount.Visible          = false;
         checkSaveToken.Checked      = true;
         checkSaveToken.Enabled      = false;
         checkForceDuplicate.Checked = true;
         checkForceDuplicate.Enabled = false;
     }
     if (PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, PayConnect.ProgramProperties.PayConnectPreventSavingNewCC, _clinicNum)))
     {
         textCardNumber.ReadOnly = true;
     }
 }