示例#1
0
 /// <summary>
 /// Cleans up card file.
 /// </summary>
 public virtual void Close()
 {
     if (Data != null)
     {
         Data.Close();
     }
     CardFile.CleanUp();
     CSAAWeb.Web.ClosableModule.RemoveHandler(this);
 }
示例#2
0
        /// <summary>
        /// Completes the transaction started by Begin_Insurance_Transaction
        /// </summary>
        public void Complete_Transaction(Payment Payment, CCResponse Response)
        {
            try
            {
                SqlCommand Cmd = GetCommand("PAY_Update_Card_Request");
                Response.CopyTo(Cmd);
                Cmd.Parameters["@App_Timestamp"].Value = ApplicationInfoStamp;
                Cmd.Parameters["@PaymentId"].Value     = Payment.PaymentId;

                Cmd.ExecuteNonQuery();

                if (Payment.Operation == ServiceOperation.Auth || Payment.Operation == ServiceOperation.ReAuth)
                {
                    if (Response.IsReauthCandidate)
                    {
                        CardFile.Add(Payment);
                    }
                    else if (Response.IsRequestSuccessful)
                    {
                        CardFile.Remove(Payment);
                    }
                }
            }
            catch (Exception e)
            {
                // Don't throw exceptions from this method.  The payment transaction has been
                // completed successfully, and we don't want to pass any local problems to the
                // application when the payment probably was OK.  Just log the exeception.
                if (e.GetType().Name == "SqlException" && ((SqlException)e).Number == 50000)
                {
                    // This error indicates that the Application information in the database has
                    // changed; the local copy must be updated and then the function re-tried.
                    GetApplications(CardInfo.Applications);
                }
                else
                {
                    Logger.Log(e);
                    Logger.Log("The Response that preceeded the previous exception was:\r\n" + Response.ToString() +
                               "\r\nNote that this exception resulted in an incomplete datalog for the transaction, but wasn't passed to the caller.");
                }
            }
        }
示例#3
0
 /// <summary>
 /// Wrapper for Check_ReAuth stored procedure.  This procedure
 /// will raise an exception if its a duplicate.
 /// </summary>
 /// <param name="Payment">Service Request to check</param>
 public bool CheckReAuth(Payment Payment)
 {
     try
     {
         SqlCommand Cmd = GetCommand("PAY_Check_Card_ReAuth");
         Payment.CopyTo(Cmd);
         Cmd.Parameters["@CheckCard"].Value = CardFile.CheckCard(Payment);
         Cmd.Parameters["@BillTo"].Value    = Payment.BillTo.ToString();
         if (Payment.LineItems != null)
         {
             Cmd.Parameters["@Items"].Value = Payment.LineItems.ToString();
         }
         return(Cmd.ExecuteScalar().ToString().Length != 0);
     }
     catch (SqlException e)
     {
         if (e.Number == 50000)
         {
             throw new BusinessRuleException(e);
         }
         throw;
     }
 }