public void DateValidationCheck()
        {
            var hasEligibilityDiagnostics = false;
            //Persist Payment Options
            var createIRSTransmission = PersisrIRSTransmission();

            createIRSTransmission.FilingDate = new DateTime(2014, 02, 14);
            createIRSTransmission.PrimaryTaxPayerFilingDate = new DateTime(2014, 02, 14);
            createIRSTransmission.SpouseFilingDate          = new DateTime(2014, 02, 14);
            createIRSTransmission.TaxpayerDateIssuedByIRS   = new DateTime(2014, 02, 14);
            createIRSTransmission.SpouseDateIssuedByIRS     = new DateTime(2014, 02, 14);
            TaxReturnData taxReturnData = new TaxReturnData();

            taxReturnData.TaxData = JsonConvert.SerializeObject(createIRSTransmission);
            var     persistFiling = mEfileRepository.PersistIRSTranmission(userId, taxReturnData);
            UserDTO userDTO       = new UserDTO()
            {
                UserId = persistFiling.Item1, UserDataId = taxReturnData.UserDataId
            };
            var getIRSTransmisson = mEfileRepository.GetPersonAndIRSTransmission(userDTO);

            if (getIRSTransmisson.Item3.FederalFiling.IRS.IRSTransmission.FilingDate != DateTime.Now || getIRSTransmisson.Item3.FederalFiling.IRS.IRSTransmission.PrimaryTaxPayerFilingDate != DateTime.Now || getIRSTransmisson.Item3.FederalFiling.IRS.IRSTransmission.SpouseFilingDate != DateTime.Now || getIRSTransmisson.Item3.FederalFiling.IRS.IRSTransmission.TaxpayerDateIssuedByIRS != DateTime.Now || getIRSTransmisson.Item3.FederalFiling.IRS.IRSTransmission.SpouseDateIssuedByIRS != DateTime.Now)
            {
                hasEligibilityDiagnostics = true;
            }
            Assert.IsTrue(hasEligibilityDiagnostics);
        }
        public void PersistEfileWithNullEntries()
        {
            var           userDataId    = 0L;
            TaxReturnData taxReturnData = new TaxReturnData();
            var           createEfileWithNullEntries = CreateEfileWithNullEntries();

            taxReturnData.TaxData = JsonConvert.SerializeObject(createEfileWithNullEntries);
            //Persist for Filing
            var filing = mEfileRepository.PersistFiling(userId, taxReturnData);

            Assert.AreNotEqual(0, filing.Item1);

            //Persist for IRS Transmission
            var irsTransmission = mEfileRepository.PersistIRSTranmission(userId, taxReturnData);

            Assert.AreNotEqual(0, irsTransmission);

            //Get IRS Tranmission data
            UserDTO userDTO = new UserDTO()
            {
                UserId = userId = taxReturnData.UserDataId
            };
            var irsTransmisiionDetails = mEfileRepository.GetPersonAndIRSTransmission(userDTO);

            Assert.IsNotNull(irsTransmisiionDetails);
        }
        public void EFinRFCheck()
        {
            var hasEligibilityDiagnostics = false;
            //Persist Payment Options
            var createIRSTransmission = PersisrIRSTransmission();

            createIRSTransmission.TaxpayerEFINIssuedByIRS = null;
            createIRSTransmission.SpouseEFINIssuedByIRS   = null;
            TaxReturnData taxReturnData = new TaxReturnData();

            taxReturnData.TaxData = JsonConvert.SerializeObject(createIRSTransmission);
            taxReturnData.TaxData = JsonConvert.SerializeObject(CreateEfile());
            var     persistIRSTransmission = mEfileRepository.PersistIRSTranmission(userId, taxReturnData);
            UserDTO userDTO = new UserDTO()
            {
                UserId = persistIRSTransmission.Item1, UserDataId = taxReturnData.UserDataId
            };
            var getIRSTransmisson = mEfileRepository.GetPersonAndIRSTransmission(userDTO);

            if (getIRSTransmisson.Item3.FederalFiling.IRS.IRSTransmission.TaxpayerEFINIssuedByIRS == null || getIRSTransmisson.Item3.FederalFiling.IRS.IRSTransmission.SpouseEFINIssuedByIRS == null)
            {
                hasEligibilityDiagnostics = true;
            }
            Assert.IsTrue(hasEligibilityDiagnostics);
        }
Esempio n. 4
0
 public void TestInitialize()
 {
     mUserDTO = new UserDTO();
     //New User Persist
     mUserId                       = IT_UserRepository.PersistNewUser();
     mW2Repository                 = new W2Repository();
     mPersonalInfoRepository       = new PersonalInfoRepository();
     mEarnedIncomeCreditRepository = new EarnedIncomeCreditRepository();
     mTaxReturnData                = new TaxReturnData();
 }
        public void PersistIRSTranmission()
        {
            TaxReturnData taxReturnData          = new TaxReturnData();
            var           persistIRSTransmission = PersisrIRSTransmission();

            taxReturnData.TaxData = JsonConvert.SerializeObject(persistIRSTransmission);
            var createIRSTransmission = mEfileRepository.PersistIRSTranmission(userId, taxReturnData);

            Assert.AreNotEqual(0, createIRSTransmission);
        }
 public void TestInitialize()
 {
     mOtherIncomeRepository    = new OtherIncomeRepository();
     mTaxReturnRepository      = new TaxReturnRepository();
     mPersonalInfoRepository   = new PersonalInfoRepository();
     mInterestIncomeRepository = new InterestIncomeRepository();
     mTaxReturnData            = new TaxReturnData();
     mUserData      = new ExpandoObject();
     mUserInputData = new ExpandoObject();
     mUserId        = IT_UserRepository.PersistNewUser();
 }
 public void TestInitialize()
 {
     mTaxesAndWrapUpRepository = new TaxesAndWrapUpRepository();
     mPersonalInfoRepository   = new PersonalInfoRepository();
     mW2Repository             = new W2Repository();
     mInterestIncomeRepository = new InterestIncomeRepository();
     mUnemploymentRepository   = new UnemploymentRepository();
     mUserData      = new ExpandoObject();
     mUserId        = IT_UserRepository.PersistNewUser();
     mTaxReturnData = new TaxReturnData();
 }
        public void PersistEfile()
        {
            var           userDataId    = 0L;
            TaxReturnData taxReturnData = new TaxReturnData();
            var           createEfile   = CreateEfile();

            taxReturnData.TaxData = JsonConvert.SerializeObject(createEfile);
            //Persist for Filing
            var filing = mEfileRepository.PersistFiling(userId, taxReturnData);

            Assert.AreNotEqual(0, filing.Item1);
        }
 public void TestInitialize()
 {
     mPersonalInfoRepository   = new PersonalInfoRepository();
     mInterestIncomeRepository = new InterestIncomeRepository();
     mTaxReturnRepository      = new TaxReturnRepository();
     //Get State. Use it all over the Test methods.
     mStateId         = mPersonalInfoRepository.GetAllState().First().StateId;
     mUserId          = IT_UserRepository.PersistNewUser();
     mUserData        = new ExpandoObject();
     mUserData.userId = mUserId;
     mTaxReturnData   = new TaxReturnData();
 }
 public void TestInitialize()
 {
     mTaxReturnRepository    = new TaxReturnRepository();
     mPersonalInfoRepository = new PersonalInfoRepository();
     mUnemploymentRepository = new UnemploymentRepository();
     //Get State. Use it all over the Test methods.
     mStateId = mPersonalInfoRepository.GetAllState().First().StateId;
     //Get UserId. Use it all over the Test methods.
     mUserId               = IT_UserRepository.PersistNewUser();
     mUserInputData        = new ExpandoObject();
     mUserInputData.userId = mUserId;
     mTaxReturnData        = new TaxReturnData();
     mErrorMessages        = new StringCollection();
 }
Esempio n. 11
0
        //UserDTO
        public static UserDTO GetUserDTOEfileWithNullEntries()
        {
            var           userDataId    = 0L;
            TaxReturnData taxReturnData = new TaxReturnData();

            taxReturnData.TaxData = JsonConvert.SerializeObject(CreateEfileWithNullEntries());
            var     value   = mEfileRepository.PersistFiling(userId, taxReturnData);
            UserDTO userdto = new UserDTO();

            userdto.UserId     = userId;
            userdto.UserDataId = value.Item1;

            return(userdto);
        }
Esempio n. 12
0
 public void TestInitialize()
 {
     paymentDTO = new PaymentDTO();
     userDTO    = new UserDTO();
     mUserId    = IT_UserRepository.PersistNewUser();
     //mW2Repository = new W2Repository();
     //mInterestIncomeRepository = new InterestIncomeRepository();
     mPersonalInfoRepository = new PersonalInfoRepository();
     mUserRepository         = new UserRepository();
     mPaymentRepository      = new PaymentRepository();
     //mEarnedIncomeCreditRepository = new EarnedIncomeCreditRepository();
     //mTaxReturnRepository = new TaxReturnRepository();
     //mOtherIncomeRepository = new OtherIncomeRepository();
     taxReturnData = new TaxReturnData();
     //mUnemploymentRepository = new UnemploymentRepository();
 }
Esempio n. 13
0
        public void AccountTypeRFCheck()
        {
            //var hasEligibilityDiagnostics = false;
            //Persist Payment Options
            var           persistPaymentDTO = PersistPaymentDTO();
            TaxReturnData taxReturnData     = new TaxReturnData();

            taxReturnData.TaxData = JsonConvert.SerializeObject(persistPaymentDTO);
            var persistPaymentDetails = mEfileRepository.PersistIRSPaymentOption(persistPaymentDTO);

            Assert.IsTrue(persistPaymentDetails.Item1 > 0);
            //persistPaymentDetails.Item2
            BusinessObject.Tax1040 taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(persistPaymentDTO.UserId, persistPaymentDetails.Item1);
            //Required Field validation #1
            bool hasAccountType = persistPaymentDetails.Item2.Any(em => (em.ErrorCode == "Efile_RF1"));

            Assert.IsTrue(hasAccountType);
            //Required Field validation #2
            bool hasAccountNumber = persistPaymentDetails.Item2.Any(em => (em.ErrorCode == "Efile_RF2"));

            Assert.IsTrue(hasAccountNumber);
            //Required Field validation #3
            bool hasRoutingNumber = persistPaymentDetails.Item2.Any(em => (em.ErrorCode == "Efile_RF3"));

            Assert.IsTrue(hasRoutingNumber);
            //Required Field validation #4
            bool hasBankName = persistPaymentDetails.Item2.Any(em => (em.ErrorCode == "Efile_RF4"));

            Assert.IsTrue(hasBankName);
            //Required Field validation #5
            bool hasIRSPaymentOptionAgreedWithPaymentDebit = persistPaymentDetails.Item2.Any(em => (em.ErrorCode == "Efile_RF5"));

            Assert.IsTrue(hasIRSPaymentOptionAgreedWithPaymentDebit);
            //Required Field validation #6
            bool hasIRSPaymentOptionAgreedWithPaymentEFTS = persistPaymentDetails.Item2.Any(em => (em.ErrorCode == "Efile_RF6"));

            Assert.IsTrue(hasIRSPaymentOptionAgreedWithPaymentEFTS);
            //Required Field validation #7
            bool hasIRSPaymentOptionAgreedWithPaymentCheckByMail = persistPaymentDetails.Item2.Any(em => (em.ErrorCode == "Efile_RF7"));

            Assert.IsTrue(hasIRSPaymentOptionAgreedWithPaymentCheckByMail);
        }
Esempio n. 14
0
        public void EmailValidationCheck()
        {
            var hasEligibilityDiagnostics = false;
            //Persist Payment Options
            var createFiling = CreateEfile();

            createFiling.Email = "yoga";
            TaxReturnData taxReturnData = new TaxReturnData();

            taxReturnData.TaxData = JsonConvert.SerializeObject(createFiling);
            var persistFiling = mEfileRepository.PersistFiling(userId, taxReturnData);

            if (persistFiling.Item2 != null)
            {
                foreach (var item in persistFiling.Item2)
                {
                    if (item.ErrorCode == "Efile_V2")
                    {
                        hasEligibilityDiagnostics = true;
                    }
                }
            }
            Assert.IsTrue(hasEligibilityDiagnostics);
        }
        //Saravanan N - 20th May, 2014 - Return type altered as long.
        /// <summary>
        /// Persist Other Income.
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="sessionData"></param>
        /// <param name="otherIncomeData"></param>
        /// <param name="historyData"></param>
        /// <param name="userDataId"></param>
        /// <param name="errorMessageList"></param>
        /// <returns></returns>
        public Tuple <long, bool> PersistOtherIncome(dynamic taxReturn)
        {
            long          userId        = 0;
            TaxReturnData taxReturnData = null;

            JTL.Tax1040.BusinessObject.Tax1040 taxObject = null;
            bool hasEligibilityDiagnostics = false;
            //Commented to diaplay Error Message for defect 14176
            //bool fromIncomeGateway = false;
            OtherIncome otherIncome = null;
            bool        isNew       = false;

            try
            {
                if (taxReturn != null)
                {
                    taxReturnData = JsonConvert.DeserializeObject <TaxReturnData>(taxReturn.TaxReturnData.ToString());
                    userId        = Utilities.ConvertToLong(taxReturn.userId);

                    //Retrieving TaxObject from database
                    taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId);

                    //Converting Json to OtherIncome by DeSerializing
                    otherIncome = JsonConvert.DeserializeObject <OtherIncome>(taxReturnData.TaxData);

                    //Check whether this Persist call coming from OtherIncomeGateway page.
                    //fromIncomeGateway = taxReturn.fromIncomeGateway;
                }

                if (taxObject != null && otherIncome != null)
                {
                    if (taxObject.Income == null)
                    {
                        taxObject.Income = new Income();
                        isNew            = true;
                    }
                    else
                    {
                        isNew = false;
                    }
                    taxObject.Income.OtherIncome = otherIncome;
                }

                //Commented to diaplay Error Message for defect 14176
                //if (!fromIncomeGateway)
                //{
                if (taxObject.ErrorMessages == null)
                {
                    taxObject.ErrorMessages = new List <ErrorMessage>();
                }

                // Clear the Error messages
                //SSB & RRB
                messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_SSB_RRB);
                //Alaska
                messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_Alaska);
                //State & Local
                messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_State_And_Local);
                //Other Income for Eligibility Section
                messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME);
                //Workflow Validation Section
                dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
                input.Tax1040Object = taxObject;

                //var errorMessage = messageRepository.GetErrorMessages();
                var errorMessage  = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>;
                var errorMessages = new ErrorMessages(errorMessage);
                input.ErrorMessages = errorMessages;

                // TODO 4-June-14 vivek Added eligibility work flow

                if (taxObject != null && taxObject.Income != null && taxObject.Income.OtherIncome != null && taxObject.Income.OtherIncome.SSB != null && taxObject.Income.OtherIncome.RRB != null)
                {
                    //Saravanan N - 1st Aug, 2014 - While user removing Box 5 (SSB & RRB) for Spouse then also this workflow has to be called. Otherwise the modification in Spouse which will be reflected in workflow only while TaxPayer Net Benefits (SSB & RRB) value exists.
                    //Vincent-16July2014-Check the SSB & RRB TaxpayerNet Benefits as NULL
                    //Checking if the SSB & RRB as value and not equal to Zero.
                    //if ((taxObject.Income.OtherIncome.SSB.TaxpayerNetBenefits != null || taxObject.Income.OtherIncome.RRB.TaxpayerNetBenefits != null))
                    //{
                    var output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new
                                                                                                                         Form1040EZSSBEligibilityWithNoValidation(), input));
                    //}


                    //Saravanan N - 1st Aug, 2014 - If ER2 already exists, now the user changed Box 5 value as 0 or empty then the IsLine2SSBTaxable property in SSBWorksheet will be set False. Based on this bool variable the error message will be removed from Taxobject.
                    if (taxObject.F1040EZ != null && taxObject.F1040EZ.F1040EZWorkSheets != null && taxObject.F1040EZ.F1040EZWorkSheets.SSBWorkSheet != null && taxObject.F1040EZ.F1040EZWorkSheets.SSBWorkSheet.IsLine2SSBTaxable == false)
                    {
                        //Remoe already existing eligibility error in tax object.
                        taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.OTHERINCOME_TAXABLE_SOCIAL_SECURITY_AND_RAILROAD_BENEFITS);
                    }
                }

                BusinessFieldValidations(otherIncome, taxObject.ErrorMessages, errorMessages);



                //TODO vivek - 7-4-14 need to be change the work flow.
                var output1 = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke
                                                                                                   (new OtherIncomeBusinessRuleValidation(), input));

                //10Jul2014 Sathish added coded to check Taxable Income Eligibility
                taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_TAXABLE_INCOME);
                var taxableIncome = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke
                                                                                                         (new F1040EZTaxableIncomeEligibilityCheck(), input));


                //Hard Stopper Check
                hasEligibilityDiagnostics = taxObject.ErrorMessages.Any(em => em.Topic ==
                                                                        Constants.TOPIC_OTHER_INCOME && em.ErrorCode.StartsWith("OtherIncome_ER"));
                //}

                if (taxObject != null)
                {
                    taxReturnData.UserDataId = Utilities.PersistTaxObject(userId, taxReturnData.UserDataId, taxObject);
                }

                //02-Sep-2014 Bhavani Audit functionality implementation
                var description = isNew ? "Persist OtherIncome, ClassName: {0}, Method Name: {1}"
                                        : "Update OtherIncome:, ClassName: {0}, Method Name: {1}";
                Utilities.PersistAuditInfo(userId, taxReturnData.UserDataId, description, GetType().Name, Constants.Tab_INCOME, Constants.TOPIC_OTHER_INCOME);


                return(new Tuple <long, bool>(taxReturnData.UserDataId, hasEligibilityDiagnostics));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Persist EIC
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="userDataId"></param>
        /// <param name="eicData"></param>
        /// <returns></returns>
        public long PersitEarnedIncomeCredit(long userId, TaxReturnData taxReturnData, int year)
        {
            try
            {
                BusinessObject.Tax1040 taxObject;
                EIC eic = JsonConvert.DeserializeObject <EIC>(taxReturnData.TaxData);

                if (eic != null)
                {
                    taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId);

                    if (taxObject == null)
                    {
                        taxObject = new BusinessObject.Tax1040();
                    }

                    if (taxObject.Credits == null)
                    {
                        taxObject.Credits = new Credits();
                    }
                    taxObject.Credits.EIC = eic;

                    //Initializing Out Parameter
                    if (taxObject.ErrorMessages == null)
                    {
                        taxObject.ErrorMessages = new List <ErrorMessage>();
                    }

                    //Retrieving Error Message list from Database
                    //var errorMessage = messageRepository.GetErrorMessages();
                    var errorMessage  = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>;
                    var errorMessages = new ErrorMessages(errorMessage);

                    // Clear the Error messages
                    messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_EARNED_INCOME_CREDIT);

                    BusinessValidation(taxObject.Credits.EIC, taxObject.ErrorMessages, errorMessages, year, (taxObject != null && taxObject.PersonalDetails != null &&
                                                                                                             taxObject.PersonalDetails.PrimaryTaxPayer != null &&
                                                                                                             taxObject.PersonalDetails.PrimaryTaxPayer.FilingStatus != null ? taxObject.PersonalDetails.PrimaryTaxPayer.FilingStatus : FilingStatus.None));

                    //Invoking Business Rules Validation Workflow
                    dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
                    input.Tax1040Object = taxObject;

                    //Getting the AGI value from output forms porperty.
                    //25Jun2014 Sathish called AGI work flow with no validation to avoid error message update for the defect #TAX1040-14036
                    var outputGetData = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new F1040EZAdjustedGrossIncomeWithNoValidation(), input));

                    //30thJune2014 Ashok added for Form 8862 Pdf Binding
                    if (taxObject != null && taxObject.Credits != null && taxObject.Credits.EIC != null)
                    {
                        if (taxObject.Income == null)
                        {
                            taxObject.Income = new Income();
                        }
                        if (taxObject.Income.Form8862 == null)
                        {
                            taxObject.Income.Form8862 = new Form8862();
                        }

                        if (taxObject.Credits.EIC.HasClaimedAsQualifyingChild.HasValue)
                        {
                            taxObject.Income.Form8862.HasClaimedAsQualifyingChild = taxObject.Credits.EIC.HasClaimedAsQualifyingChild.Value;
                        }
                        else
                        {
                            taxObject.Income.Form8862.HasClaimedAsQualifyingChild = false;
                        }

                        if (taxObject.Credits.EIC.HasIncorrectlyReportedEarnedIncome.HasValue)
                        {
                            taxObject.Income.Form8862.HasReportedIncorrectIncome = taxObject.Credits.EIC.HasIncorrectlyReportedEarnedIncome.Value;
                        }
                        else
                        {
                            taxObject.Income.Form8862.HasReportedIncorrectIncome = false;
                        }

                        // 01Jul2014 Sathish checked nullable value and set zero
                        taxObject.Income.Form8862.DaysLivedInUS       = (taxObject.Credits.EIC.NumberOfDaysTaxPayerLivedInUS.HasValue) ? taxObject.Credits.EIC.NumberOfDaysTaxPayerLivedInUS.Value : 0;
                        taxObject.Income.Form8862.DaysSpouseLivedInUS = (taxObject.Credits.EIC.NumberOfDaysSpouseLivedInUS.HasValue) ? taxObject.Credits.EIC.NumberOfDaysSpouseLivedInUS.Value : 0;
                        taxObject.Income.Form8862.FormFilingTaxYear   = 2013;
                        taxObject.Income.IsForm8862Required           = true;
                    }

                    input.ErrorMessages = errorMessages;
                    //Checking EIC Eligibility check
                    var output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new F1040EZEICEligibilityRuleCheck(), input));


                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_TAXABLE_INCOME);
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_REQUIRED_REFUND_DETAIL);
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_MISSING_INCOME);
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.OTHERINCOME_TAXABLE_SOCIAL_SECURITY_AND_RAILROAD_BENEFITS);

                    dynamic federalSummaryInput = new Microsoft.Activities.Extensions.WorkflowArguments();
                    federalSummaryInput.Tax1040Object             = taxObject;
                    federalSummaryInput.IsRefundAvailableCheck    = true;
                    federalSummaryInput.IsIncomeAndRefundAllZeros = true;
                    //25 Aug 2014-Vincent- Added the SSB and RRB check in FederalSummaryWithNoValidation
                    federalSummaryInput.IsSSBAndRRBCheck = true;
                    federalSummaryInput.ErrorMessages    = errorMessages;
                    output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(
                        WorkflowInvoker.Invoke(new FederalSummaryWithNoValidation(), federalSummaryInput));

                    //Persist TaxObject.
                    taxReturnData.UserDataId = Utilities.PersistTaxObject(userId, taxReturnData.UserDataId, taxObject);

                    //Vincent, 2-sep-14, Persist Audit information
                    string description = "Persit EarnedIncomeCredit, ClassName: {0}, Method Name: {1}";
                    Utilities.PersistAuditInfo(userId, taxReturnData.UserDataId, description, this.GetType().Name, Constants.Tab_EARNED_INCOME_CREDITS, Constants.TOPIC_EARNED_INCOME_CREDIT);
                }

                return(taxReturnData.UserDataId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="taxReturnData"></param>
        /// <returns></returns>
        public Tuple <long, bool> PersistTaxesAndWrapUpData(long userId, TaxReturnData taxReturnData)
        {
            Tuple <long, bool> userData = null;

            try
            {
                JTL.Tax1040.BusinessObject.Tax1040 taxObject;

                //Retrieving TaxObject from database
                taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId);


                //28May2014 Sathish Creat person if person detail not updated. Used in federal tax and wrap up work flow for line 10 calc.
                if (taxObject == null || taxObject.PersonalDetails == null || taxObject.PersonalDetails.PrimaryTaxPayer == null)
                {
                    if (taxObject == null)
                    {
                        taxObject = new BusinessObject.Tax1040()
                        {
                            PersonalDetails = new PersonalDetails()
                            {
                                PrimaryTaxPayer = new PrimaryTaxPayer()
                                {
                                    FilingStatus = FilingStatus.Single,
                                    Person       = new Person()
                                }
                            }
                        }
                    }
                    ;

                    if (taxObject.PersonalDetails == null)
                    {
                        taxObject.PersonalDetails = new PersonalDetails()
                        {
                            PrimaryTaxPayer = new PrimaryTaxPayer()
                            {
                                FilingStatus = FilingStatus.Single,
                                Person       = new Person()
                            }
                        };
                    }

                    if (taxObject.PersonalDetails.PrimaryTaxPayer == null)
                    {
                        taxObject.PersonalDetails.PrimaryTaxPayer = new PrimaryTaxPayer()
                        {
                            FilingStatus = FilingStatus.Single,
                            Person       = new Person()
                        };
                    }

                    Tuple <long, bool> userDataId = personalInfoRepository.PersistPrimaryTaxPayer(taxObject.PersonalDetails.PrimaryTaxPayer, userId, taxReturnData.UserDataId, Constants.TOPIC_PERSONAL_FILINGSTATUS);

                    taxReturnData.UserDataId = userDataId.Item1;

                    //Retrieving TaxObject from database
                    //26Aug2014 Sathish Get Tax object after personal info persist to get the error message list
                    taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId);
                }



                //Converting Json to OtherIncome by DeSerializing
                TaxesAndPenalties taxesAndPenalties = JsonConvert.DeserializeObject <TaxesAndPenalties>(taxReturnData.TaxData);

                if (taxObject != null && taxesAndPenalties != null)
                {
                    taxObject.TaxesAndPenalties = new TaxesAndPenalties();
                    taxObject.TaxesAndPenalties = taxesAndPenalties;
                }

                if (taxObject.ErrorMessages == null)
                {
                    taxObject.ErrorMessages = new List <ErrorMessage>();
                }


                // Clear the Error messages exist for this topic.
                messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_TAX_AND_WRAPUP);


                //Workflow Validation Section
                dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
                input.Tax1040Object = taxObject;

                //var errorMessage = messageRepository.GetErrorMessages();
                var errorMessage  = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>;
                var errorMessages = new ErrorMessages(errorMessage);
                input.ErrorMessages = errorMessages;


                //BusinessFieldValidations(otherIncome, taxObject.ErrorMessages, errorMessages);
                if (taxObject.TaxesAndPenalties != null)
                {
                    var output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new TaxAndWrapUpEligibilityCheck(), input));
                    hasEligibilityDiagnostics = taxObject.ErrorMessages.Any(em => em.Topic == Constants.TOPIC_TAX_AND_WRAPUP && em.ErrorCode.StartsWith(Constants.TOPIC_TAX_AND_WRAPUP + "_ER"));

                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_REQUIRED_REFUND_DETAIL);
                    taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_MISSING_INCOME);
                    dynamic federalSummaryInput = new Microsoft.Activities.Extensions.WorkflowArguments();
                    federalSummaryInput.Tax1040Object = taxObject;
                    federalSummaryInput.IsTaxableIncomeExceedCheck = true;
                    federalSummaryInput.IsRefundAvailableCheck     = true;
                    federalSummaryInput.IsIncomeAndRefundAllZeros  = true;
                    federalSummaryInput.ErrorMessages = errorMessages;
                    output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(
                        WorkflowInvoker.Invoke(new FederalSummaryWithNoValidation(), federalSummaryInput));
                }

                BusinessValidation(taxObject.TaxesAndPenalties, taxObject.ErrorMessages, errorMessages);

                taxReturnData.UserDataId = Utilities.PersistTaxObject(userId, taxReturnData.UserDataId, taxObject);


                userData = new Tuple <long, bool>(taxReturnData.UserDataId, hasEligibilityDiagnostics);

                //vincent, 2-sep-14, Persist Audit information
                string description = "Persist TaxesAndWrapUpData, ClassName: {0}, Method Name: {1}";
                Utilities.PersistAuditInfo(userId, taxReturnData.UserDataId, description, this.GetType().Name, Constants.Tab_TAX_AND_WRAPUP, Constants.TOPIC_TAX_AND_WRAPUP);
            }
            catch (Exception ex)
            {
                ExceptionHandling.LogException(userId, "Class:TaxesAndWrapUpRepository,Method Name:PersistTaxesAndWrapUpData", ex);
            }
            return(userData);
        }
Esempio n. 18
0
        /// <summary>
        /// Create and Persist Unemployment
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="taxReturnData"></param>
        /// <returns></returns>
        public dynamic CreateAndPersistUnemployment(long userId, TaxReturnData taxReturnData)
        {
            dynamic userDataIDand1099GId = new ExpandoObject();
            long    form1099GId          = 0;

            try
            {
                //Retrieving TaxObject from database
                taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId);

                //Converting Json to Form1099G by DeSerializing
                Form1099G form1099g = JsonConvert.DeserializeObject <Form1099G>(taxReturnData.TaxData);
                if (taxObject != null)
                {
                    //Get TaxPayer and Spouse Names.
                    taxPayerAndSpouseNames = Utilities.GetTaxPayerAndSpouseName(taxObject);

                    if (taxObject.Income == null)
                    {
                        taxObject.Income = new Income();
                    }
                }

                if (taxObject.Income.Form1099G != null && taxObject.Income.Form1099G.Any())
                {
                    int index = taxObject.Income.Form1099G.FindIndex(form => form.Form1099GId == form1099g.Form1099GId);

                    if (index < 0)
                    {
                        //Saravanan N - 3rd April, 2014 - Current Form1099G is new one. So created ID for this.
                        form1099g.Form1099GId = taxObject.Income.Form1099G.Max(frm => frm.Form1099GId) + 1;

                        //Adding new Form1099G to the TaxObject Form1099GList
                        taxObject.Income.Form1099G.Add(form1099g);
                        form1099GId = 0;
                    }
                    else
                    {
                        taxObject.Income.Form1099G[index] = form1099g;
                        form1099GId = form1099g.Form1099GId;
                    }
                }
                else
                {
                    //Saravanan N - 3rd April, 2014 - Form1099G doesn't exists for this user. Hence, assign 1 as its ID.
                    form1099g.Form1099GId = 1;

                    //Creating Instance if Form1099GList section is Null
                    taxObject.Income.Form1099G = new List <Form1099G> {
                        form1099g
                    };
                    form1099GId = 0;
                    //Adding new Form1099G to the TaxObject W2List
                }

                if (taxObject.ErrorMessages == null)
                {
                    taxObject.ErrorMessages = new List <ErrorMessage>();
                }

                //Retrieving Error Message list from Database
                messageRepository = new MessagesRepository();
                //var errorMessage = messageRepository.GetErrorMessages();

                var errorMessage  = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>;
                var errorMessages = new ErrorMessages(errorMessage);

                // Clear the Error messages
                messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_UNEMPLOYMENT_COMPENSATION);

                //Required and Validation check for current Form1099G.
                FilingStatus filingStatus = FilingStatus.None;
                if (taxObject.PersonalDetails != null && taxObject.PersonalDetails.PrimaryTaxPayer != null)
                {
                    filingStatus = taxObject.PersonalDetails.PrimaryTaxPayer.FilingStatus;
                }
                if (taxObject.Income.Form1099G != null && taxObject.Income.Form1099G.Any())
                {
                    BusinessFieldValidations(taxObject.Income.Form1099G, filingStatus, taxObject.ErrorMessages, errorMessages);
                }

                // Clear the Error messages
                //messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_EARNED_INCOME_CREDIT);
                //02Sep2014-Thileep Changed code to Remove EIC errormessages which has Message Type EI only
                taxObject.ErrorMessages.RemoveAll(err => err.Topic == Constants.TOPIC_EARNED_INCOME_CREDIT && (err.MessageType == Constants.MESSAGE_TYPE_EI));


                //14thJuly2014 Ashok - Added logic for Clearing EIC Worksheet, Form 8862 and EIC classes when failing EIC eligibility
                dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
                input.Tax1040Object = taxObject;
                input.ErrorMessages = errorMessages;

                //Check if EIC with espect to AGI
                var output = AGICheck(taxObject, input);

                //Invoking Business Rules Validation Workflow
                //dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments();
                //input.Tax1040Object = taxObject;
                input.ErrorMessages = errorMessages;
                output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new
                                                                                                                 F1099GBusinessValidationRule(), input));


                //10Jul2014 Sathish added coded to check Taxable Income Eligibility
                taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_TAXABLE_INCOME);

                taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_REQUIRED_REFUND_DETAIL);
                taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_MISSING_INCOME);
                taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.OTHERINCOME_TAXABLE_SOCIAL_SECURITY_AND_RAILROAD_BENEFITS);

                // var taxableIncome = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new F1040EZTaxableIncomeEligibilityCheck(), input));
                dynamic federalSummaryInput = new Microsoft.Activities.Extensions.WorkflowArguments();
                federalSummaryInput.Tax1040Object = taxObject;
                federalSummaryInput.IsTaxableIncomeExceedCheck = true;
                federalSummaryInput.IsRefundAvailableCheck     = true;
                federalSummaryInput.IsIncomeAndRefundAllZeros  = true;
                //25 Aug 2014-Vincent- Added the SSB and RRB check in FederalSummaryWithNoValidation
                federalSummaryInput.IsSSBAndRRBCheck = true;
                federalSummaryInput.ErrorMessages    = errorMessages;
                output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(
                    WorkflowInvoker.Invoke(new FederalSummaryWithNoValidation(), federalSummaryInput));


                //Saravanan N - 7th May, 2014 - Check if any hard stop (Eligibility Check found) in workflow for Unemployment.
                var isEligibilityCheckFailed = taxObject.ErrorMessages.Any(errMsg => errMsg.Topic ==
                                                                           Constants.TOPIC_UNEMPLOYMENT_COMPENSATION && errMsg.ErrorCode.Equals(Constants.F1099G__REPAID_AMOUNT_FOR_EARLIER_YEAR));

                //Added by Ashok for EIC Eligibility Check
                // Clear the Error messages
                //messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_EARNED_INCOME_CREDIT);

                //03Sep2014-Thileep Changed code to Remove EIC errormessages which has Message Type EI only
                taxObject.ErrorMessages.RemoveAll(err => err.Topic == Constants.TOPIC_EARNED_INCOME_CREDIT && (err.MessageType == Constants.MESSAGE_TYPE_EI));

                dynamic eicEligbilityInput = new Microsoft.Activities.Extensions.WorkflowArguments();
                eicEligbilityInput.Tax1040Object = taxObject;
                eicEligbilityInput.ErrorMessages = errorMessages;
                //Check if EIC with espect to AGI
                output = AGICheck(taxObject, input);

                //02Sep2014-  Thileep added  to Remove EIC Error messages when EIC Eligibility fails
                if (!output.HasEarnedIncomeCredit)
                {
                    taxObject.ErrorMessages.RemoveAll(err => err.Topic == Constants.TOPIC_EARNED_INCOME_CREDIT &&
                                                      (err.MessageType == Constants.MESSAGE_TYPE_RF || err.MessageType == Constants.MESSAGE_TYPE_V || err.MessageType == Constants.MESSAGE_TYPE_BR));
                }

                taxReturnData.UserDataId = Utilities.PersistTaxObject(userId, taxReturnData.UserDataId, taxObject);

                userDataIDand1099GId.UserDataId  = taxReturnData.UserDataId;
                userDataIDand1099GId.Form1099GId = form1099g.Form1099GId;
                userDataIDand1099GId.isEligibilityCheckFailed = isEligibilityCheckFailed;

                //02-Sep-2014 Bhavani Audit functionality implementation
                var description = form1099GId <= 0 ? "Persist Unemployment: " + form1099GId + ", ClassName: {0}, Method Name: {1}"
                                                   : "Update Unemployment: " + form1099GId + ", ClassName: {0}, Method Name: {1}";
                Utilities.PersistAuditInfo(userId, taxReturnData.UserDataId, description, GetType().Name, Constants.Tab_INCOME, Constants.TOPIC_UNEMPLOYMENT_COMPENSATION);
            }
            catch (Exception ex)
            {
                ExceptionHandling.LogException(userId, "Class:UnemploymentRepository,Method Name:CreateAndPersistUnemployment", ex);
            }

            return(userDataIDand1099GId);
        }