Beispiel #1
0
        /// <summary>
        /// Business Fields Validations (Required and Validation) checked.
        /// </summary>
        /// <param name="eic"></param>
        /// <param name="errorMessageList"></param>
        /// <param name="errorMessages"></param>
        public void BusinessValidation(EIC eic, List <ErrorMessage> errorMessageList,
                                       ErrorMessages errorMessages, int year, FilingStatus filingStatus)
        {
            ErrorMessage errorMessage;

            if (eic != null)
            {
                ////Required Entry #1
                //if (eic.HasTaxableScholarshipCredits != null && eic.HasTaxableScholarshipCredits == true)
                //{
                //    errorMessage =
                //   BusinessValidationRepository.AssertIsNotNull(eic.TaxableScholarshipCredit,
                //       Constants.EIC_TAXABLE_FELLOWSHIP_INCOME, errorMessages);
                //    if (errorMessage != null)
                //        errorMessageList.Add(errorMessage);
                //}

                ////Required Entry #2
                //if (eic.HasPensionAnnuity != null && eic.HasPensionAnnuity == true)
                //{
                //    errorMessage =
                //   BusinessValidationRepository.AssertIsNotNull(eic.PensionAnnuity,
                //       Constants.EIC_PENSION_OR_ANNUITY_NOT_QUALIFIED_COMPENSATION, errorMessages);
                //    if (errorMessage != null)
                //        errorMessageList.Add(errorMessage);
                //}

                //Required Entry #3
                if (eic.HasPenalInstitutionInmateWages != null && eic.HasPenalInstitutionInmateWages == true)
                {
                    errorMessage =
                        BusinessValidationRepository.AssertIsNotNull(eic.PenalInstitutionInmateWages,
                                                                     Constants.EIC_WAGES_FOR_WORK_DONE_WHILE_PENAL_INSTITUTION, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }
                }



                //Required Entry #4
                if (eic.HasReceivedIRSNoticeOnFiling8862 == true && eic.HasIncorrectlyReportedEarnedIncome == null && eic.HasEICForPriorYearDisallowance == true)
                {
                    errorMessage = errorMessages[Constants.EIC_REDUCED_OR_DISALLOWED_FOR_INCORRECTLY_REPORTEED_INCOME];
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }
                }

                //Required Entry #5
                if (eic.HasReceivedIRSNoticeOnFiling8862 == true && eic.HasEICForPriorYearDisallowance == null)
                {
                    errorMessage = errorMessages[Constants.EIC_LIKE_TO_CLAIM_FORM_8862];
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }
                }

                //Required Entry #6
                if (eic.HasReceivedIRSNoticeOnFiling8862 == true && eic.HasEICForPriorYearDisallowance != null && eic.HasEICForPriorYearDisallowance == true)
                {
                    //Taxpayer Lived in US.
                    int noOfDaysInTaxYear = GetDaysInYear(year);

                    if (filingStatus != null)
                    {
                        if (filingStatus == FilingStatus.Single)
                        {
                            errorMessage =
                                BusinessValidationRepository.AssertIsNotNull(eic.NumberOfDaysTaxPayerLivedInUS,
                                                                             Constants.EIC_NUMBER_OF_DAYS_TaxPayer_LIVED_IN_US, errorMessages);
                            if (errorMessage != null)
                            {
                                errorMessageList.Add(errorMessage);
                            }

                            else
                            {
                                //07Aug2014-Validation Changed for Number Of Days
                                errorMessage =
                                    BusinessValidationRepository.AssertIsWithinRange(Utilities.ConvertToInteger32(eic.NumberOfDaysTaxPayerLivedInUS), 1, noOfDaysInTaxYear,
                                                                                     Constants.EIC_NUMBER_OF_DAYS_TAXPAYER_LIVED_IN_US_VALID, errorMessages);
                                if (errorMessage != null)
                                {
                                    errorMessageList.Add(errorMessage);
                                }
                            }
                        }
                        if (filingStatus == FilingStatus.MarriedFilingJointly)
                        {
                            errorMessage =
                                BusinessValidationRepository.AssertIsNotNull(eic.NumberOfDaysTaxPayerLivedInUS,
                                                                             Constants.EIC_NUMBER_OF_DAYS_TaxPayer_LIVED_IN_US, errorMessages);
                            if (errorMessage != null)
                            {
                                errorMessageList.Add(errorMessage);
                            }

                            else
                            {
                                errorMessage =
                                    BusinessValidationRepository.AssertIsWithinRange(Utilities.ConvertToInteger32(eic.NumberOfDaysTaxPayerLivedInUS), 1, noOfDaysInTaxYear,
                                                                                     Constants.EIC_NUMBER_OF_DAYS_TAXPAYER_LIVED_IN_US_VALID, errorMessages);
                                if (errorMessage != null)
                                {
                                    errorMessageList.Add(errorMessage);
                                }
                            }

                            //Spouse Lived in US

                            errorMessage =
                                BusinessValidationRepository.AssertIsNotNull(eic.NumberOfDaysSpouseLivedInUS,
                                                                             Constants.EIC_NUMBER_OF_DAYS_SPOUSE_LIVED_IN_US, errorMessages);
                            if (errorMessage != null)
                            {
                                errorMessageList.Add(errorMessage);
                            }


                            else
                            {
                                errorMessage =
                                    BusinessValidationRepository.AssertIsWithinRange(Utilities.ConvertToInteger32(eic.NumberOfDaysSpouseLivedInUS), 1, noOfDaysInTaxYear,
                                                                                     Constants.EIC_NUMBER_OF_DAYS_SPOUSE_LIVED_IN_US_VALID, errorMessages);
                                if (errorMessage != null)
                                {
                                    errorMessageList.Add(errorMessage);
                                }
                            }
                        }
                    }
                }


                //Waring Rules
                //This Business rule is related to Form 8862
                if (eic.HasReceivedIRSNoticeOnFiling8862 == true && eic.HasEICForPriorYearDisallowance == false)
                {
                    errorMessage = errorMessages[Constants.EIC_PRIOR_YEAR_DISALLOWANCE];
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }
                }


                if (eic.HasReceivedIRSNoticeOnFiling8862 == true && eic.HasEICForPriorYearDisallowance == true)
                {
                    if (eic.HasIncorrectlyReportedEarnedIncome == true)
                    {
                        errorMessage = errorMessages[Constants.EIC_INCORRECTLY_REPORTED_YOUR_EARNED_INCOME];
                        if (errorMessage != null)
                        {
                            errorMessageList.Add(errorMessage);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        //// 28May2014 Check Taxable income eligibility
        //public Tuple<string, bool> TaxableIncomeEligibilityCheck(UserDTO userDTO)
        //{
        //    Tuple<string, bool> taxableIncomeEligibility = null;
        //    try
        //    {
        //        BusinessObject.Tax1040 taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userDTO.UserId, userDTO.UserDataId);

        //        if (taxObject != null)
        //        {
        //            dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
        //            input.Tax1040Object = taxObject;
        //            var output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(
        //                                                        WorkflowInvoker.Invoke(new FederalSummaryWithNoValidation(), input));

        //            hasEligibilityDiagnostics = HasEligibilityTaxIncome(userDTO, taxObject);
        //        }
        //        taxableIncomeEligibility = new Tuple<string, bool>(Utilities.GetTaxPayerFirstNameOrNickName(taxObject), hasEligibilityDiagnostics);
        //    }
        //    catch (Exception ex)
        //    {
        //        ExceptionHandling.LogException(userDTO.UserId, "Class:TaxesAndWrapUpRepository,Method Name:TaxableIncomeEligibilityCheck", ex);
        //    }
        //    return taxableIncomeEligibility;
        //}

        #endregion

        #region Validation

        public void BusinessValidation(TaxesAndPenalties taxesAndPenalties, List <ErrorMessage> errorMessageList,
                                       ErrorMessages errorMessages)
        {
            if (taxesAndPenalties != null)
            {
                ErrorMessage errorMessage;


                if (taxesAndPenalties.HasFiledForm4868.HasValue && taxesAndPenalties.HasFiledForm4868.Value)
                {
                    errorMessage = BusinessValidationRepository.AssertIsNotNullOrEmpty(
                        Convert.ToString(taxesAndPenalties.FederalExtensionFiledDate),
                        Constants.TAX_AND_WRAP_UP_REQUIRED_EXTENSION_FILED_DATE, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }

                    if (taxesAndPenalties.FederalExtensionFiledDate.HasValue && taxesAndPenalties.FederalExtensionFiledDate.Value != null)
                    {
                        errorMessage =
                            BusinessValidationRepository.AssertDateIsLesser(taxesAndPenalties.FederalExtensionFiledDate.Value, DUE_DATE,
                                                                            Constants.TAX_AND_WRAP_UP_VALIDATION_EXTENSION_FILED_DATE, errorMessages);
                        if (errorMessage != null)
                        {
                            errorMessageList.Add(errorMessage);
                        }
                    }
                }

                if (taxesAndPenalties.HasPaidFederalExtensionWithForm4868.HasValue && taxesAndPenalties.HasPaidFederalExtensionWithForm4868.Value)
                {
                    errorMessage = BusinessValidationRepository.AssertIsNotNullOrEmpty(
                        Convert.ToString(taxesAndPenalties.FederalExtensionAmount),
                        Constants.TAX_AND_WRAP_UP_EXTENSTION_AMOUNT, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }

                    errorMessage = BusinessValidationRepository.AssertIsNotNullOrEmpty(
                        Convert.ToString(taxesAndPenalties.FederalExtensionAmountPaidDate),
                        Constants.TAX_AND_WRAP_UP_EXTENSION_DATE, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }

                    if (taxesAndPenalties.FederalExtensionAmountPaidDate.HasValue && taxesAndPenalties.FederalExtensionAmountPaidDate.Value != null)
                    {
                        errorMessage =
                            BusinessValidationRepository.AssertDateIsLesser(taxesAndPenalties.FederalExtensionAmountPaidDate.Value, DUE_DATE,
                                                                            Constants.TAX_AND_WRAP_UP_VALIDATION_EXTENSION_DATE, errorMessages);
                        if (errorMessage != null)
                        {
                            errorMessageList.Add(errorMessage);
                        }
                    }
                }

                if (taxesAndPenalties.IsFilingReturnAfterDueDate.HasValue && taxesAndPenalties.IsFilingReturnAfterDueDate.Value)
                {
                    errorMessage = BusinessValidationRepository.AssertIsNotNullOrEmpty(
                        Convert.ToString(taxesAndPenalties.FilingDate),
                        Constants.TAX_AND_WRAP_UP_FILING_DATE, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }


                    if (taxesAndPenalties.FilingDate.HasValue && taxesAndPenalties.FilingDate.Value != null)
                    {
                        errorMessage =
                            BusinessValidationRepository.AssertDateIsGreater(taxesAndPenalties.FilingDate.Value, DUE_DATE,
                                                                             Constants.TAX_AND_WRAP_UP_VALIDATION_FILED_DATE, errorMessages);
                        if (errorMessage != null)
                        {
                            errorMessageList.Add(errorMessage);
                        }
                    }
                }

                if (taxesAndPenalties.BankDetails != null)
                {
                    errorMessage = BusinessValidationRepository.AssertIsNotNullOrEmpty(
                        taxesAndPenalties.BankDetails.BankName,
                        Constants.TAX_AND_WRAP_UP_BANK_NAME, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }
                    else
                    {
                        errorMessage = BusinessValidationRepository.AssertIsNumbersLettersAndHyphen(
                            taxesAndPenalties.BankDetails.BankName,
                            Constants.TAX_AND_WRAP_UP_INVALID_BANK_NAME, errorMessages);
                        if (errorMessage != null)
                        {
                            errorMessageList.Add(errorMessage);
                        }
                    }



                    errorMessage = BusinessValidationRepository.AssertIsNotNullOrEmpty(
                        taxesAndPenalties.BankDetails.RoutingTransitNumber,
                        Constants.TAX_AND_WRAP_UP_ROUTING_NUMBER, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }
                    else
                    {
                        errorMessage = BusinessValidationRepository.AssertIsValidRTN(
                            taxesAndPenalties.BankDetails.RoutingTransitNumber,
                            Constants.TAX_AND_WRAP_UP_ROUTING_NUMBER_VALIDATION, errorMessages);
                        if (errorMessage != null)
                        {
                            errorMessageList.Add(errorMessage);
                        }
                    }

                    errorMessage = BusinessValidationRepository.AssertIsNotNullOrEmpty(
                        taxesAndPenalties.BankDetails.AccountNumber,
                        Constants.TAX_AND_WRAP_UP_ACCOUNT_NUMBER, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }
                    else
                    {
                        errorMessage = BusinessValidationRepository.AssertIsAccountNumber(
                            taxesAndPenalties.BankDetails.AccountNumber,
                            Constants.TAX_AND_WRAP_UP_ACCOUNT_NUMBER_VALIDATION, errorMessages);
                        if (errorMessage != null)
                        {
                            errorMessageList.Add(errorMessage);
                        }
                    }

                    if (Utilities.ConvertToInteger32(taxesAndPenalties.BankDetails.BankAccountTypeCode) == 0)
                    {
                        if (taxesAndPenalties.BankDetails.BankAccountTypeCode != AccountType.Checking &&
                            taxesAndPenalties.BankDetails.BankAccountTypeCode != AccountType.Saving)
                        {
                            errorMessage = BusinessValidationRepository.AssertGreaterThanZero(Utilities.ConvertToDouble(taxesAndPenalties.BankDetails.BankAccountTypeCode),
                                                                                              Constants.TAX_AND_WRAP_UP_TYPE_OF_ACCOUNT, errorMessages);
                            if (errorMessage != null)
                            {
                                errorMessageList.Add(errorMessage);
                            }
                        }
                    }
                }

                if (taxesAndPenalties.ThirdPartyDesignee != null)
                {
                    errorMessage = BusinessValidationRepository.AssertIsNotNullOrEmpty(
                        taxesAndPenalties.ThirdPartyDesignee.DesigneeName,
                        Constants.TAX_AND_WRAP_UP_DESIGNEE_NAME, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }

                    else
                    {
                        errorMessage = BusinessValidationRepository.AssertIsNumbersLettersAndHyphen(
                            taxesAndPenalties.ThirdPartyDesignee.DesigneeName,
                            Constants.TAX_AND_WRAP_UP_INVALID_DESIGNEE_NAME, errorMessages);
                        if (errorMessage != null)
                        {
                            errorMessageList.Add(errorMessage);
                        }
                    }

                    errorMessage = BusinessValidationRepository.AssertIsNotNullOrEmpty(
                        taxesAndPenalties.ThirdPartyDesignee.PIN,
                        Constants.TAX_AND_WRAP_UP_DESIGNEE_PERSONAL_IDENTIFICATION_NUMBER, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }

                    else
                    {
                        errorMessage = BusinessValidationRepository.AssertIsWithinRange(
                            taxesAndPenalties.ThirdPartyDesignee.PIN, 5, 5,
                            Constants.TAX_AND_WRAP_UP_INVALID_DESIGNEE_PERSONAL_IDENTIFICATION_NUMBER, errorMessages);
                        if (errorMessage != null)
                        {
                            errorMessageList.Add(errorMessage);
                        }
                    }

                    errorMessage = BusinessValidationRepository.AssertIsNotNullOrEmpty(
                        taxesAndPenalties.ThirdPartyDesignee.PhoneNumber,
                        Constants.TAX_AND_WRAP_UP_DESIGNEE_PHONE_NO, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }
                    else
                    {
                        errorMessage = BusinessValidationRepository.AssertIsWithinPhoneNoRange(
                            taxesAndPenalties.ThirdPartyDesignee.PhoneNumber,
                            12,
                            12,
                            Constants.TAX_AND_WRAP_UP_INVALID_DESIGNEE_PHONE_NUMBER, errorMessages);
                        if (errorMessage != null)
                        {
                            errorMessageList.Add(errorMessage);
                        }
                    }
                }

                if (!Utilities.IsStringEmpty(taxesAndPenalties.InCareOf))
                {
                    errorMessage = BusinessValidationRepository.AssertIsNumbersLettersAndHyphen(
                        taxesAndPenalties.InCareOf,
                        Constants.TAX_AND_WRAP_UP_INVALID_INCARE_OF, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }
                }


                if (!Utilities.IsStringEmpty(taxesAndPenalties.InCareOfPhoneNumber))
                {
                    errorMessage = BusinessValidationRepository.AssertIsWithinPhoneNoRange(
                        taxesAndPenalties.InCareOfPhoneNumber,
                        12,
                        12,
                        Constants.TAX_AND_WRAP_UP_INVALID_INCARE_PHONE_NUMBER, errorMessages);
                    if (errorMessage != null)
                    {
                        errorMessageList.Add(errorMessage);
                    }
                }
            }
        }