/// <summary>
 /// The parameterized constructor.
 /// </summary>
 /// <param name="accountNumber16"></param>
 /// <param name="amountPaid"></param>
 /// <param name="transactionDate"></param>
 /// <param name="paymentType"></param>
 /// <param name="status"></param>
 public PaymentReceipt(string accountNumber16, double amountPaid,
                       DateTime transactionDate, ePaymentType paymentType, ePaymentStatus status)
 {
     _accountNumber16 = accountNumber16;
     _amountPaid      = amountPaid;
     _transactionDate = transactionDate;
     _paymentType     = paymentType;
     _status          = status;
 }
Example #2
0
 /// <summary>
 ///		Converts the array of integer values to an array of <c>ePaymentType</c>.
 /// </summary>
 /// <param name="x"></param>
 /// <returns></returns>
 public static ePaymentType[] Convert(int[] x)
 {
     // convert
     ePaymentType[] types = new ePaymentType[x.Length];
     for (int i = 0; i < x.Length; i++)
     {
         types[i] = (ePaymentType)x[i];
     }
     return(types);
 }
Example #3
0
 /// <summary>
 ///		Returns the zero-based index of the first occurrence of a <see cref="ePaymentType"/>
 ///		in the <c>PaymentTypeCollection</c>.
 /// </summary>
 /// <param name="item">The <see cref="ePaymentType"/> to locate in the <c>PaymentTypeCollection</c>.</param>
 /// <returns>
 ///		The zero-based index of the first occurrence of <paramref name="item"/>
 ///		in the entire <c>PaymentTypeCollection</c>, if found; otherwise, -1.
 ///	</returns>
 public virtual int IndexOf(ePaymentType item)
 {
     for (int i = 0; i != m_count; ++i)
     {
         if (m_array[i].Equals(item))
         {
             return(i);
         }
     }
     return(-1);
 }
Example #4
0
 /// <summary>
 ///		Determines whether a given <see cref="ePaymentType"/> is in the <c>PaymentTypeCollection</c>.
 /// </summary>
 /// <param name="item">The <see cref="ePaymentType"/> to check for.</param>
 /// <returns><c>true</c> if <paramref name="item"/> is found in the <c>PaymentTypeCollection</c>; otherwise, <c>false</c>.</returns>
 public virtual bool Contains(ePaymentType item)
 {
     for (int i = 0; i != m_count; ++i)
     {
         if (m_array[i].Equals(item))
         {
             return(true);
         }
     }
     return(false);
 }
Example #5
0
        /// <summary>
        ///		Adds a <see cref="ePaymentType"/> to the end of the <c>PaymentTypeCollection</c>.
        /// </summary>
        /// <param name="item">The <see cref="ePaymentType"/> to be added to the end of the <c>PaymentTypeCollection</c>.</param>
        /// <returns>The index at which the value has been added.</returns>
        public virtual int Add(ePaymentType item)
        {
            if (m_count == m_array.Length)
            {
                EnsureCapacity(m_count + 1);
            }

            m_array[m_count] = item;
            m_version++;

            return(m_count++);
        }
Example #6
0
 /// <summary>
 /// Constructor that takes a string for initialization.
 /// It expects either a single string character or a
 /// match to one of the underlying ePaymentType values.
 /// </summary>
 /// <param name="userName"></param>
 /// <param name="mopCode"></param>
 public MopPaymentType(string userName, string mopCode)
 {
     try
     {
         int i = int.Parse(mopCode);
         construct(userName, i);
     }
     catch
     {
         _paymentType = ePaymentType.Unknown;
     }
 }
Example #7
0
        /// <summary>
        ///		Removes the first occurrence of a specific <see cref="ePaymentType"/> from the <c>PaymentTypeCollection</c>.
        /// </summary>
        /// <param name="item">The <see cref="ePaymentType"/> to remove from the <c>PaymentTypeCollection</c>.</param>
        /// <exception cref="ArgumentException">
        ///		The specified <see cref="ePaymentType"/> was not found in the <c>PaymentTypeCollection</c>.
        /// </exception>
        public virtual void Remove(ePaymentType item)
        {
            int i = IndexOf(item);

            if (i < 0)
            {
                throw new System.ArgumentException("Cannot remove the specified item because it was not found in the specified Collection.");
            }

            ++m_version;
            RemoveAt(i);
        }
Example #8
0
            public override void Insert(int pos, ePaymentType x)
            {
                rwLock.AcquireWriterLock(timeout);

                try
                {
                    collection.Insert(pos, x);
                }
                finally
                {
                    rwLock.ReleaseWriterLock();
                }
            }
Example #9
0
            public override void Remove(ePaymentType x)
            {
                rwLock.AcquireWriterLock(timeout);

                try
                {
                    collection.Remove(x);
                }
                finally
                {
                    rwLock.ReleaseWriterLock();
                }
            }
Example #10
0
            public override int Add(ePaymentType x)
            {
                int result = 0;

                rwLock.AcquireWriterLock(timeout);

                try
                {
                    result = collection.Add(x);
                }
                finally
                {
                    rwLock.ReleaseWriterLock();
                }

                return(result);
            }
Example #11
0
            public override int IndexOf(ePaymentType x)
            {
                int result = 0;

                rwLock.AcquireReaderLock(timeout);

                try
                {
                    result = collection.IndexOf(x);
                }
                finally
                {
                    rwLock.ReleaseReaderLock();
                }

                return(result);
            }
Example #12
0
            public override bool Contains(ePaymentType x)
            {
                bool result = false;

                rwLock.AcquireReaderLock(timeout);

                try
                {
                    result = collection.Contains(x);
                }
                finally
                {
                    rwLock.ReleaseReaderLock();
                }

                return(result);
            }
Example #13
0
        /// <summary>
        ///		Removes the element at the specified index of the <c>PaymentTypeCollection</c>.
        /// </summary>
        /// <param name="index">The zero-based index of the element to remove.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        ///		<para><paramref name="index"/> is less than zero</para>
        ///		<para>-or-</para>
        ///		<para><paramref name="index"/> is equal to or greater than <see cref="PaymentTypeCollection.Count"/>.</para>
        /// </exception>
        public virtual void RemoveAt(int index)
        {
            ValidateIndex(index);             // throws

            m_count--;

            if (index < m_count)
            {
                Array.Copy(m_array, index + 1, m_array, index, m_count - index);
            }

            // We can't set the deleted entry equal to null, because it might be a value type.
            // Instead, we'll create an empty single-element array of the right type and copy it
            // over the entry we want to erase.
            ePaymentType[] temp = new ePaymentType[1];
            Array.Copy(temp, 0, m_array, m_count, 1);
            m_version++;
        }
Example #14
0
        /// <summary>
        ///		Inserts an element into the <c>PaymentTypeCollection</c> at the specified index.
        /// </summary>
        /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param>
        /// <param name="item">The <see cref="ePaymentType"/> to insert.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        ///		<para><paramref name="index"/> is less than zero</para>
        ///		<para>-or-</para>
        ///		<para><paramref name="index"/> is equal to or greater than <see cref="PaymentTypeCollection.Count"/>.</para>
        /// </exception>
        public virtual void Insert(int index, ePaymentType item)
        {
            ValidateIndex(index, true);             // throws

            if (m_count == m_array.Length)
            {
                EnsureCapacity(m_count + 1);
            }

            if (index < m_count)
            {
                Array.Copy(m_array, index, m_array, index + 1, m_count - index);
            }

            m_array[index] = item;
            m_count++;
            m_version++;
        }
Example #15
0
        /// <summary>
        /// Common initialization routine
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="mopCode"></param>
        protected void construct([RequiredItem()] string userName, int mopCode)
        {
            // default to unknown
            _paymentType = ePaymentType.Unknown;

            // load validator to validate if the call is valid. if it's not
            // do not throw an error, in other words, just use IsValid().
            MethodValidator validator = new MethodValidator(
                MethodBase.GetCurrentMethod(), userName, mopCode);

            if (validator.IsValid())
            {
                _userName = userName;
                // Test for negative value or zero... these are invalid
                if (mopCode > 0)
                {
                    try
                    {
                        // Now translate it using DAL
                        DalMethodOfPayment dalMop = new DalMethodOfPayment();
                        // get the integer value
                        int paymentType = dalMop.GetPaymentTypeByUserMop(userName, mopCode);
                        // set internal enumerated type
                        _paymentType = (ePaymentType)TypeDescriptor.GetConverter(typeof(
                                                                                     ePaymentType)).ConvertFrom(paymentType);;
                    }                     // try
                    catch                 //( Exception ex )
                    {
                        // Publish to allow support staff to correct the problem
                        // throw away exceptions because we have already set
                        // _paymentType = Unknown
                        //ExceptionManager.Publish( ex );
                    }
                }
            }
        }
Example #16
0
 public static string Get_sPaymentType(ePaymentType xePaymentType)
 {
     return sPaymentTypes[(int)xePaymentType];
 }
Example #17
0
        /// <summary>
        /// This method provides functionality to pay a statement using
        /// electronic check as the method of payment.
        /// </summary>
        /// <param name="strCustomerName"></param>
        /// <param name="strBankRouteNumber"></param>
        /// <param name="strBankAccountNumber"></param>
        /// <param name="ebatAccountType"></param>
        /// <param name="dblAmount"></param>
        /// <returns></returns>
        public PaymentReceipt PayUsingElectronicCheck(
            string strCustomerName,
            [RequiredItem()][StringLength(1, 9)][NumericAttribute()] string strBankRouteNumber,
            [RequiredItem()][StringLength(1, 20)] string strBankAccountNumber,
            [RequiredItem()] eBankAccountType ebatAccountType,
            [RequiredItem()][DoubleRange(0.00, 9999999.99)] double dblAmount)
        {
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.PayCheck,
                this.m_can.AccountNumber16, dblAmount);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    // validate the parameters.
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(),
                                                                    strCustomerName, strBankRouteNumber, strBankAccountNumber, ebatAccountType, dblAmount);
                    validator.Validate();

                    // In this case, we are hard-coding the payment type
                    ePaymentType ept = ePaymentType.ElectronicCheck;
                    logEntry.PaymentType = ept;

                    // set the siteId information
                    logEntry.SiteId = SiteId;

                    //use stopped check dal to verfiy the account does not have a stop on it
                    DalStoppedCheck dalSC = new DalStoppedCheck();
                    if (dalSC.IsStoppedCheck(strBankRouteNumber, strBankAccountNumber))
                    {
                        //the account has a stop placed on it
                        throw new MopAuthorizationFailedException(string.Format(__stoppedCheckErrorMessage + "\nBank Routing Number: {0} \nBank Account Number: {1}", strBankRouteNumber, strBankAccountNumber));
                    }

                    checkNSFStatus(false);

                    // Create a DAL to transalate Mop codes
                    DalMethodOfPayment dal = new DalMethodOfPayment();
                    DalPaymentReceipt  dalPaymentReceipt = new DalPaymentReceipt();

                    string paymentReceiptType = dalPaymentReceipt.GetPaymentReceiptType(_userId);
                    paymentReceiptType = paymentReceiptType == string.Empty?CmConstant.kstrDefaultReceiptType:paymentReceiptType;

                    PaymentReceipt rcpt = new PaymentReceipt();

                    // need to get the customer's name.
                    if (strCustomerName != null)
                    {
                        strCustomerName = strCustomerName.Trim();
                    }
                    if (strCustomerName == null || strCustomerName.Length == 0)
                    {
                        DalAccount dalAccount = new DalAccount();
                        CustomerAccountSchema.CustomerName custName =
                            dalAccount.GetCustomerName(_siteId, _siteCode, m_can.AccountNumber9);
                        if (custName == null)
                        {
                            throw new InvalidAccountNumberException();
                        }
                        strCustomerName = (string)new CustomerName(custName.FirstName, custName.MiddleInitial, custName.LastName);
                        if (strCustomerName == null || strCustomerName.Length == 0)
                        {
                            strCustomerName = CmConstant.kstrDefaultAccountTitle;
                        }
                    }

                    // assure that the length of the customer name does NOT exceed 32 characters!
                    if (strCustomerName.Length >= 32)
                    {
                        strCustomerName = strCustomerName.Substring(0, 31);
                    }

                    // Build input elements
                    Request.INL00047 inl47 = new INL00047Helper(dblAmount, dblAmount,
                                                                (eBankAccountType.Checking == ebatAccountType)?
                                                                CmConstant.kstrAccountTypeChecking:
                                                                CmConstant.kstrAccountTypeSavings,
                                                                CmConstant.kstrNegative, strBankRouteNumber, strBankAccountNumber,
                                                                strCustomerName, dal.GetMopByUserPaymentType(
                                                                    UserName, (int)ept), CmConstant.kstrNegative, m_can.StatementCode,
                                                                paymentReceiptType, CmConstant.kstrDefaultWorkstation);

                    Request.MAC00027 mac27 =
                        new Mac00027Helper(SiteId.ToString(), m_can.AccountNumber9,
                                           CmConstant.kstrDefaultTaskCode, inl47);

                    // Use inherited functions to get a response
                    Response.MAC00027 mac27Response = (Response.MAC00027)
                                                      this.Invoke((Request.MAC00027)mac27);
                    Response.INL00047 inl47Response = mac27Response.Items[0] as Response.INL00047;

                    int intErrorCode = toInt32(inl47Response.IGIRTRNCODE);
                    if (intErrorCode > 0)
                    {
                        throw TranslateCmException(
                                  intErrorCode,
                                  string.Format("Authorization failed with error - ErrorCode: {0} ErrorText: {1}",
                                                inl47Response.IGIRTRNCODE,
                                                inl47Response.IGIMESGTEXT),
                                  null);
                    }

                    rcpt.AccountNumber16 = m_can.AccountNumber16;
                    rcpt.AmountPaid      = (inl47Response.AMNTTOAPLYUSR.Length > 0) ? Double.Parse(inl47Response.AMNTTOAPLYUSR): 0.00;
                    rcpt.PaymentType     = ePaymentType.ElectronicCheck;
                    rcpt.Status          = ePaymentStatus.Success;
                    rcpt.TransactionDate = new IcomsDate(inl47Response.ATHRZTNDATE).Date;

                    return(rcpt);
                }                 // try
                catch (BusinessLogicLayerException blle)
                {
                    //the dal threw an exception
                    logEntry.SetError(blle.Message);
                    throw;
                }
                catch (DataSourceException excDSE)
                {
                    //the dal threw an exception
                    logEntry.SetError(excDSE.Message);
                    throw new DataSourceUnavailableException(excDSE);
                }
                catch (CmErrorException excCm)
                {
                    logEntry.SetError(excCm.Message, excCm.ErrorCode);
                    throw TranslateCmException(excCm);
                }                 // catch( CmErrorException excCm )
                catch (Exception exc)
                {
                    logEntry.SetError(exc.Message);
                    throw;
                } // catch( Exception exc )
            }     // using( Log log =  )
        }         // PayUsingElectronicCheck()
Example #18
0
 public static ltext Get_sPaymentType_ltext(ePaymentType xePaymentType)
 {
     switch (xePaymentType)
     {
         case GlobalData.ePaymentType.CASH:
             return lngRPM.s_PaymentType_CASH;
         case GlobalData.ePaymentType.CASH_OR_PAYMENT_CARD:
             return lngRPM.s_PaymentType_CASH_OR_PAYMENT_CARD;
         case GlobalData.ePaymentType.BANK_ACCOUNT_TRANSFER:
             return lngRPM.s_PaymentType_BANK_ACCOUNT_TRANSFER;
         case GlobalData.ePaymentType.ALLREADY_PAID:
             return lngRPM.s_PaymentType_ALLREADY_PAID;
         case GlobalData.ePaymentType.PAYMENT_CARD:
             return lngRPM.s_PaymentType_PAYMENT_CARD;
         case GlobalData.ePaymentType.NONE:
             LogFile.Error.Show("ERROR:TangentaDB:f_MethodOfPayment:Get:ePaymentType == GlobalData.ePaymentType.NONE!");
             return null;
         default:
             LogFile.Error.Show("ERROR:TangentaDB:f_MethodOfPayment:Get:ePaymentType == " +xePaymentType.ToString() + "!");
             return null;
     }
 }
Example #19
0
 public override bool Contains(ePaymentType x)
 {
     return(m_collection.Contains(x));
 }
Example #20
0
 public override int IndexOf(ePaymentType x)
 {
     return(m_collection.IndexOf(x));
 }
Example #21
0
 public override void Remove(ePaymentType x)
 {
     throw new NotSupportedException("This is a Read Only Collection and can not be modified");
 }
Example #22
0
        /// <summary>
        /// Sets up the CustomerAccount to pay for services on a recurring basis
        /// using a credit card.
        /// </summary>
        /// <param name="strCustomerName"></param>
        /// <param name="strBankRouteNumber"></param>
        /// <param name="strBankAccountNumber"></param>
        /// <param name="ebatAccountType"></param>
        public void ActivateRecurringUsingDirectDebit(
            string strCustomerName,
            [RequiredItem()][StringLength(1, 9)][NumericAttribute()] string strBankRouteNumber,
            [RequiredItem()][StringLength(1, 20)] string strBankAccountNumber,
            [RequiredItem()] eBankAccountType ebatAccountType)
        {
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.RecurringCheck,
                this.m_can.AccountNumber16);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(),
                                                                    strCustomerName, strBankRouteNumber, strBankAccountNumber, ebatAccountType);
                    validator.Validate();

                    // In this case, we are hard-coding the payment type
                    ePaymentType ept = ePaymentType.RecurringDirectDebit;
                    logEntry.PaymentType = ept;

                    // set the siteId information
                    logEntry.SiteId = SiteId;

                    int intStatementCode = 0;
                    try{ intStatementCode = int.Parse(m_can.StatementCode); }
                    catch { /*don't care*/ }

                    //use stopped check dal to verfiy the account does not have a stop on it
                    DalStoppedCheck dalSC = new DalStoppedCheck();
                    if (dalSC.IsStoppedCheck(strBankRouteNumber, strBankAccountNumber))
                    {
                        //the account has a stop placed on it
                        throw new MopAuthorizationFailedException(string.Format(__stoppedCheckErrorMessage + "\nBank Routing Number: {0} \nBank Account Number: {1}", strBankRouteNumber, strBankAccountNumber));
                    }

                    checkNSFStatus(false);

                    // Create a DAL to transalate Mop codes
                    DalMethodOfPayment dal = new DalMethodOfPayment();

                    // need to get the customer's name.
                    if (strCustomerName != null)
                    {
                        strCustomerName = strCustomerName.Trim();
                    }
                    if (strCustomerName == null || strCustomerName.Length == 0)
                    {
                        DalAccount dalAccount = new DalAccount();
                        CustomerAccountSchema.CustomerName custName =
                            dalAccount.GetCustomerName(_siteId, _siteCode, m_can.AccountNumber9);
                        if (custName == null)
                        {
                            throw new InvalidAccountNumberException();
                        }
                        strCustomerName = (string)new CustomerName(custName.FirstName, custName.MiddleInitial, custName.LastName);
                        if (strCustomerName == null || strCustomerName.Length == 0)
                        {
                            strCustomerName = CmConstant.kstrDefaultAccountTitle;
                        }
                    }

                    // assure that the length of the customer name does NOT exceed 32 characters!
                    if (strCustomerName.Length >= 32)
                    {
                        strCustomerName = strCustomerName.Substring(0, 31);
                    }

                    // Build input elements
                    Request.INL00074 inl74 =
                        new INL00074Helper(dal.GetMopByUserPaymentType(UserName, (int)ept),
                                           strBankAccountNumber, strBankRouteNumber, strCustomerName,
                                           (char)TypeDescriptor.GetConverter(typeof(eBankAccountType)).ConvertTo(ebatAccountType, typeof(char)),
                                           intStatementCode, false);
                    Request.MAC00027 mac27 = new Mac00027Helper(SiteId.ToString(),
                                                                m_can.AccountNumber9, CmConstant.kstrDefaultTaskCode, inl74);

                    this.Invoke((Request.MAC00027)mac27);
                }
                catch (BusinessLogicLayerException blle)
                {
                    //the dal threw an exception
                    logEntry.SetError(blle.Message);
                    throw;
                }
                catch (DataSourceException excDSE)
                {
                    //the dal threw an exception
                    logEntry.SetError(excDSE.Message);
                    throw new DataSourceUnavailableException(excDSE);
                }
                catch (CmErrorException excCm)
                {
                    logEntry.SetError(excCm.Message, excCm.ErrorCode);
                    throw TranslateCmException(excCm);
                }
                catch (Exception exc)
                {
                    logEntry.SetError(exc.Message);
                    throw;
                }
            }
        }