public async Task <JsonResult> SaveConcept(Guid overdraftID, Guid conceptPaymentID, decimal?amount, decimal?value)
        {
            var overdraftDetail = new OverdraftDetail();

            overdraftDetail.ID                          = Guid.NewGuid();
            overdraftDetail.OverdraftID                 = overdraftID;
            overdraftDetail.ConceptPaymentID            = conceptPaymentID;
            overdraftDetail.Value                       = value.HasValue ? value.Value : 0;
            overdraftDetail.IsValueCapturedByUser       = value.HasValue;
            overdraftDetail.Amount                      = amount.HasValue ? amount.Value : 0;
            overdraftDetail.IsTotalAmountCapturedByUser = amount.HasValue;

            overdraftDetail.IsValueCapturedByUser          = false;
            overdraftDetail.IsGeneratedByPermanentMovement = false;
            overdraftDetail.Taxed      = 0;
            overdraftDetail.Exempt     = 0;
            overdraftDetail.IMSSTaxed  = 0;
            overdraftDetail.IMSSExempt = 0;
            overdraftDetail.Label1     = "";
            overdraftDetail.Label2     = "";
            overdraftDetail.Label3     = "";
            overdraftDetail.Label4     = "";

            //Common
            overdraftDetail.Active       = true;
            overdraftDetail.company      = SessionModel.CompanyID;
            overdraftDetail.InstanceID   = SessionModel.InstanceID;
            overdraftDetail.CreationDate = DateTime.Now;
            overdraftDetail.StatusID     = 1;
            overdraftDetail.user         = SessionModel.IdentityID;
            overdraftDetail.Timestamp    = DateTime.Now;

            await oddclient.CreateAsync(new List <OverdraftDetail> {
                overdraftDetail
            }, SessionModel.IdentityID);

            //calculate
            await Calculate(overdraftDetail.OverdraftID, false);

            return(Json("OK"));
        }
        public void Should_Create_Layout_No_Second_Last_Name()
        {
            //Arrange
            string expected = "10227865814512007200001Version1300                         DEPOSITOS POR NOMINA05                                        B00"
                              + Environment.NewLine
                              + "2100100000000000009232001030100000000000896523174                  "
                              + Environment.NewLine
                              + "3000100000000000009232003055500000000002255669988002                                     Gonzalez  Jose Luis                                                                                                    1 03010000"
                              + Environment.NewLine
                              + "4001000001000000000000092320000001000000000000092320"
                              + Environment.NewLine;

            BanamexPaymentLayoutManager banamexbankLayout = new BanamexPaymentLayoutManager();

            BanamexAdditionalInformation additionalInformation = new BanamexAdditionalInformation
            {
                CustomerNumber     = "22786581451",
                ChargeAccount      = "896523174",
                FileNumberOfDay    = "1",
                PaymentDate        = new DateTime(2020, 7, 20),
                BranchOfficeNumber = "301",
                StateID            = "1",
                CityID             = "301",
                CompanyName        = "Version1300"
            };

            List <Overdraft>       overdrafts       = new List <Overdraft>();
            List <OverdraftDetail> overdraftDetails = new List <OverdraftDetail>();
            OverdraftDetail        detail;
            ConceptPayment         concept;


            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 923.2m,
                Value          = 15,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 0m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "POSL920306LD2";
            employee.BankAccount       = "2255669988";
            employee.BankBranchNumber  = "555";
            employee.FirstLastName     = "Gonzalez";
            employee.SecondLastName    = null;
            employee.Name              = "Jose Luis";
            employee.Code              = "002";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);


            //Act
            string actual = banamexbankLayout.GenerateLayout(overdrafts, additionalInformation);

            //Assert
            Assert.Equal(expected, actual);
        }
        public void Should_Create_Layout_Multiple_Overdraft()
        {
            //Arrange
            string expected = "10227865814512007200001Version1300                         DEPOSITOS POR NOMINA05                                        B00"
                              + Environment.NewLine
                              + "2100100000000000119386001030100000000000896523174                  "
                              + Environment.NewLine
                              + "3000100000000000051662003055500000000002255669988002                                     Gonzalez Garcia Jose Luis                                                                                              1 03010000"
                              + Environment.NewLine
                              + "3000100000000000048042003033300000000000000007789006                                     Martinez Ruiz Juan Jose                                                                                                1 03010000"
                              + Environment.NewLine
                              + "3000100000000000019682003075400000000000071235489007                                     Funco Salon Demian                                                                                                     1 03010000"
                              + Environment.NewLine
                              + "4001000003000000000001193860000001000000000001193860"
                              + Environment.NewLine;

            BanamexPaymentLayoutManager scotiabankLayout = new BanamexPaymentLayoutManager();

            BanamexAdditionalInformation additionalInformation = new BanamexAdditionalInformation
            {
                CustomerNumber     = "22786581451",
                ChargeAccount      = "896523174",
                FileNumberOfDay    = "1",
                PaymentDate        = new DateTime(2020, 7, 20),
                BranchOfficeNumber = "301",
                StateID            = "1",
                CityID             = "301",
                CompanyName        = "Version1300"
            };

            List <Overdraft>       overdrafts       = new List <Overdraft>();
            List <OverdraftDetail> overdraftDetails = new List <OverdraftDetail>();
            OverdraftDetail        detail;
            ConceptPayment         concept;

            //Employee 1
            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 6000.0m,
                Value          = 15,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "ISR",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 833.8m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "POSL920306LD2";
            employee.BankAccount       = "2255669988";
            employee.FirstLastName     = "Gonzalez";
            employee.SecondLastName    = "Garcia";
            employee.Name              = "Jose Luis";
            employee.Code              = "002";
            employee.BankBranchNumber  = "555";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Employee 2
            overdraftDetails = new List <OverdraftDetail>();

            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 5423.45m,
                Value          = 15,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Bono",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 100m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);


            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 134.94m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "ISR",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 584.31m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            employee                   = new Employee();
            overdraft                  = new Overdraft();
            employee.RFC               = "REHE730714HG8";
            employee.BankAccount       = "7789";
            employee.FirstLastName     = "Martinez";
            employee.SecondLastName    = "Ruiz";
            employee.Name              = "Juan Jose";
            employee.Code              = "006";
            employee.BankBranchNumber  = "333";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Employee 3
            overdraftDetails = new List <OverdraftDetail>();

            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 1950m,
                Value          = 15,
            };

            overdraftDetails.Add(detail);


            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 45.07m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Subsidio",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = -63.27m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            employee                   = new Employee();
            overdraft                  = new Overdraft();
            employee.RFC               = "BACF6710253V5";
            employee.BankAccount       = "71235489";
            employee.FirstLastName     = "Funco";
            employee.SecondLastName    = "Salon";
            employee.Name              = "Demian";
            employee.Code              = "007";
            employee.BankBranchNumber  = "754";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);


            //Act
            string actual = scotiabankLayout.GenerateLayout(overdrafts, additionalInformation);

            //Assert
            Assert.Equal(expected, actual);
        }
Esempio n. 4
0
        private async Task <CalculationBaseResult> FillDataAsync(CalculateOverdraftDIParams calculateOverdraftDIParams,
                                                                 CalculationBaseResult dataResponse)
        {
            dataResponse.Overdraft = _mapper.Map <OverdraftDI, Overdraft>(calculateOverdraftDIParams.OverdraftDI);
            dataResponse.Overdraft.PeriodDetail        = _mapper.Map <PeriodDetailDI, PeriodDetail>(calculateOverdraftDIParams.OverdraftDI.PeriodDetailDI);
            dataResponse.Overdraft.PeriodDetail.Period = _mapper.Map <PeriodDI, Period>(calculateOverdraftDIParams.OverdraftDI.PeriodDetailDI.PeriodDI);
            dataResponse.Overdraft.Employee            = _mapper.Map <EmployeeDI, Employee>(calculateOverdraftDIParams.OverdraftDI.EmployeeDI);
            dataResponse.Overdraft.Employee.Workshift  = _mapper.Map <WorkshiftDI, Workshift>(calculateOverdraftDIParams.OverdraftDI.EmployeeDI.WorkshiftDI);
            dataResponse.Overdraft.Employee.HistoricEmployeeSalaryAdjustments = new List <HistoricEmployeeSalaryAdjustment>();
            dataResponse.Overdraft.Employee.HistoricEmployeeSBCAdjustments    = new List <HistoricEmployeeSBCAdjustment>();

            if (calculateOverdraftDIParams.OverdraftDI.OverdraftDetailDIs.Any())
            {
                for (int i = 0; i < calculateOverdraftDIParams.OverdraftDI.OverdraftDetailDIs.Count; i++)
                {
                    var detailDI        = calculateOverdraftDIParams.OverdraftDI.OverdraftDetailDIs[i];
                    var overdraftDetail = _mapper.Map <OverdraftDetailDI, OverdraftDetail>(detailDI);
                    overdraftDetail.ConceptPayment = fixFormulasConceptPayment(_mapper.Map <ConceptPaymentDI, ConceptPayment>(detailDI.ConceptPaymentDI), dataResponse);

                    dataResponse.Overdraft.OverdraftDetails.Add(overdraftDetail);
                }
            }
            else
            {
                dataResponse.Overdraft.OverdraftDetails = new List <OverdraftDetail>();
                dataResponse.ConceptPayments.Where(p => p.GlobalAutomatic).ForEach(p =>
                {
                    var overdraftDetail = new OverdraftDetail()
                    {
                        ConceptPayment   = p,
                        ConceptPaymentID = p.ID,
                        ID = Guid.NewGuid()
                    };
                    dataResponse.Overdraft.OverdraftDetails.Add(overdraftDetail);
                });
            }

            //Neccesary
            dataResponse.AccumulatedEmployees = new List <AccumulatedEmployee>();
            dataResponse.AccumulatedTypes.ForEach(p =>
            {
                var accumulatedEmployee = new AccumulatedEmployee()
                {
                    AccumulatedTypeID           = p.ID,
                    AccumulatedType             = p,
                    Employee                    = dataResponse.Overdraft.Employee,
                    InitialExerciseAmount       = 0,
                    PreviousExerciseAccumulated = 0,
                    ExerciseFiscalYear          = calculateOverdraftDIParams.OverdraftDI.PeriodDetailDI.PeriodDI.FiscalYear,
                };

                dataResponse.AccumulatedEmployees.Add(accumulatedEmployee);
            });


            //Other things
            dataResponse.FonacotMovements             = new List <FonacotMovement>();
            dataResponse.HistoricAccumulatedEmployees = new List <HistoricAccumulatedEmployee>();
            dataResponse.Incidents          = new List <Incident>();
            dataResponse.InfonavitMovements = new List <InfonavitMovement>();
            dataResponse.Inhabilities       = new List <Inhability>();
            dataResponse.Vacations          = new List <Vacation>();

            return(dataResponse);
        }
        public void Should_Create_Layout_No_Employee_Bank_Account()
        {
            //Arrange
            string expected = "20200704998855667Regresivas1241                              #"
                              + Environment.NewLine
                              + "Rodriguez Sanchez Ivan    007000000000000000001968200000000007"
                              + Environment.NewLine;

            BanortePaymentLayoutManager banorteLayout = new BanortePaymentLayoutManager();

            BanorteAdditionalInformation additionalInformation = new BanorteAdditionalInformation
            {
                SystemID      = "007",
                ChargeAccount = "998855667",
                PaymentDate   = new DateTime(2020, 7, 4),
                CompanyName   = "Regresivas1241",
            };

            List <Overdraft>       overdrafts       = new List <Overdraft>();
            List <OverdraftDetail> overdraftDetails = new List <OverdraftDetail>();
            OverdraftDetail        detail;
            ConceptPayment         concept;


            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 1968.2m,
                Value          = 15,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 0m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "POSL920306LD2";
            employee.BankAccount       = null;
            employee.FirstLastName     = "Rodriguez";
            employee.SecondLastName    = "Sanchez";
            employee.Name              = "Ivan";
            employee.Code              = "7";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);


            //Act
            string actual = banorteLayout.GenerateLayout(overdrafts, additionalInformation);

            //Assert
            Assert.Equal(expected, actual);
        }
Esempio n. 6
0
        private async Task <OverdraftDetail> createIfNotExistsOverdraftDetailAsync(Guid identityWorkId, Guid instanceID, Guid overdraftID,
                                                                                   int code, decimal amount, decimal taxed, decimal exempt, ConceptType conceptType = ConceptType.DeductionPayment, int satGroupCode = 0)
        {
            var middlewareManager = new MiddlewareManager <OverdraftDetail>(new BaseRecordManager <OverdraftDetail>(), new OverdraftDetailValidator());

            var middlewareConcepts = new MiddlewareManager <ConceptPayment>(new BaseRecordManager <ConceptPayment>(), new ConceptPaymentValidator());
            var conceptsAll        = await middlewareConcepts.FindByExpressionAsync(p => p.InstanceID == instanceID, identityWorkId,
                                                                                    new string[] { });

            if (!conceptsAll.Any(p => p.ConceptType == conceptType && p.Code == code))
            {
                var conceptPayment = new ConceptPayment()
                {
                    Active             = true,
                    AutomaticDismissal = true,
                    Code            = code,
                    company         = identityWorkId,
                    ConceptType     = conceptType,
                    CreationDate    = DateTime.Now,
                    DeleteDate      = null,
                    Description     = $"{code}",
                    Name            = $"{code}",
                    GlobalAutomatic = true,
                    ID           = Guid.NewGuid(),
                    InstanceID   = instanceID,
                    Kind         = true,
                    Print        = true,
                    SATGroupCode = "D-004",
                    StatusID     = 1,
                    Timestamp    = DateTime.Now,
                    user         = Guid.NewGuid()
                };
                await middlewareConcepts.CreateAsync(new List <ConceptPayment> {
                    conceptPayment
                }, identityWorkId);

                conceptsAll.Add(conceptPayment);
            }


            var overdraftDetail = new OverdraftDetail()
            {
                ID               = Guid.NewGuid(),
                Active           = true,
                company          = identityWorkId,
                Timestamp        = DateTime.UtcNow,
                InstanceID       = instanceID,
                Description      = "Sobrerecibo detalle",
                CreationDate     = DateTime.Now,
                Name             = "Sobrerecibo detalle",
                StatusID         = 1,
                user             = Guid.NewGuid(),
                ConceptPaymentID = conceptsAll.FirstOrDefault(p => p.ConceptType == conceptType && p.Code == code).ID,
                Amount           = amount,
                Taxed            = taxed,
                Exempt           = exempt,
                IMSSTaxed        = 0,
                IMSSExempt       = 0,
                Label1           = "Label1",
                Label2           = "Label2",
                Label3           = "Label3",
                Label4           = "Label4",
                OverdraftID      = overdraftID,
                Value            = amount,
                ConceptPayment   = null,
                Overdraft        = null
            };

            await middlewareManager.CreateAsync(new List <OverdraftDetail> {
                overdraftDetail
            }, identityWorkId);

            return(overdraftDetail);
        }
Esempio n. 7
0
        public void Should_Create_Layout_No_Second_Last_Name()
        {
            //Arrange
            string expected = "EEHA9957601000000000000000000000000000                                                                                                                                                                                                                                                                                                                                            "
                              + Environment.NewLine
                              + "EEHB000000032003348041234567899000                                                                                                                                                                                                                                                                                                                                                "
                              + Environment.NewLine
                              + "EEDA040000000000009232020200704011                                ESCUDERO  JULIA                         000000000000000100000000000000000000320077000000000                                        1 00000044044001NOMINA                                                                                                        0000000000000000000000000                      "
                              + Environment.NewLine
                              + "EETB000000100000000000092320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000                                                                                                                           "
                              + Environment.NewLine
                              + "EETA000000100000000000092320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000                                                                                                                           "
                              + Environment.NewLine;

            ScotiabankPaymentLayoutManager scotiabankLayout = new ScotiabankPaymentLayoutManager();

            ScotiabankAdditionalInformation additionalInformation = new ScotiabankAdditionalInformation
            {
                CustomerNumber   = "99576",
                ChargeAccount    = "3200334804",
                FileNumberOfDay  = "1",
                CompanyReference = "1234567899",
                PaymentDate      = new DateTime(2020, 7, 4),
            };

            List <Overdraft>       overdrafts       = new List <Overdraft>();
            List <OverdraftDetail> overdraftDetails = new List <OverdraftDetail>();
            OverdraftDetail        detail;
            ConceptPayment         concept;


            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 923.2m,
                Value          = 15,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 0m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "POSL920306LD2";
            employee.BankAccount       = "03200770000";
            employee.FirstLastName     = "ESCUDERO";
            employee.SecondLastName    = "";
            employee.Name              = "JULIA";
            employee.Code              = "002";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);


            //Act
            string actual = scotiabankLayout.GenerateLayout(overdrafts, additionalInformation);

            //Assert
            Assert.Equal(expected, actual);
        }
Esempio n. 8
0
        public void Should_Create_Layout_Multiple_Overdraft()
        {
            //Arrange
            string expected = "EEHA9957601000000000000000000000000000                                                                                                                                                                                                                                                                                                                                            "
                              + Environment.NewLine
                              + "EEHB000000032003348041234567899000                                                                                                                                                                                                                                                                                                                                                "
                              + Environment.NewLine
                              + "EEDA040000000000009232020200704011                                ESCUDERO IGNACIO JULIA                  000000000000000100000000000000000000320077000000000                                        1 00000044044001NOMINA                                                                                                        0000000000000000000000000                      "
                              + Environment.NewLine
                              + "EEDA040000000000011622020200704012                                PEREZ DAVILA JANCARLOS                  000000000000000200000000000000000000320065119200000                                        1 00000044044001NOMINA                                                                                                        0000000000000000000000000                      "
                              + Environment.NewLine
                              + "EEDA040000000000009230020200704013                                CASTAÑEDA CERVANTES ROXANA GUADALUPE    000000000000000300000000000000000000320064914700000                                        1 00000044044001NOMINA                                                                                                        0000000000000000000000000                      "
                              + Environment.NewLine
                              + "EETB000000300000000000300840000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000                                                                                                                           "
                              + Environment.NewLine
                              + "EETA000000300000000000300840000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000                                                                                                                           "
                              + Environment.NewLine;

            ScotiabankPaymentLayoutManager scotiabankLayout = new ScotiabankPaymentLayoutManager();

            ScotiabankAdditionalInformation additionalInformation = new ScotiabankAdditionalInformation
            {
                CustomerNumber   = "99576",
                ChargeAccount    = "3200334804",
                FileNumberOfDay  = "1",
                CompanyReference = "1234567899",
                PaymentDate      = new DateTime(2020, 7, 4),
            };

            List <Overdraft>       overdrafts       = new List <Overdraft>();
            List <OverdraftDetail> overdraftDetails = new List <OverdraftDetail>();
            OverdraftDetail        detail;
            ConceptPayment         concept;

            //Employee 1
            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 923.2m,
                Value          = 15,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 0m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "POSL920306LD2";
            employee.BankAccount       = "03200770000";
            employee.FirstLastName     = "ESCUDERO";
            employee.SecondLastName    = "IGNACIO";
            employee.Name              = "JULIA";
            employee.Code              = "002";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Employee 2
            overdraftDetails = new List <OverdraftDetail>();

            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 1200.0m,
                Value          = 7,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Bono",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 120m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);


            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 45.0m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "ISR",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 112.8m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            employee                   = new Employee();
            overdraft                  = new Overdraft();
            employee.RFC               = "REHE730714HG8";
            employee.BankAccount       = "03200651192";
            employee.FirstLastName     = "PEREZ";
            employee.SecondLastName    = "DAVILA";
            employee.Name              = "JANCARLOS";
            employee.Code              = "004";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Employee 3
            overdraftDetails = new List <OverdraftDetail>();

            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 1150.0m,
                Value          = 7,
            };

            overdraftDetails.Add(detail);


            concept = new ConceptPayment
            {
                Name        = "Todas deducciones",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 227.0m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            employee                   = new Employee();
            overdraft                  = new Overdraft();
            employee.RFC               = "BACF6710253V5";
            employee.BankAccount       = "03200649147";
            employee.FirstLastName     = "CASTAÑEDA";
            employee.SecondLastName    = "CERVANTES";
            employee.Name              = "ROXANA GUADALUPE";
            employee.Code              = "00000007";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);


            //Act
            string actual = scotiabankLayout.GenerateLayout(overdrafts, additionalInformation);

            //Assert
            Assert.Equal(expected, actual);
        }
        public void Should_Create_Layout_Single_Overdraft_Long_Employee_Name()
        {
            //Arrange
            string expected = "000000001REHE730714HG8   998899775533          000000000296020Jose de Jesus de Dios Bendito Rodriguez 001001"
                              + Environment.NewLine;

            BBVAPaymentLayoutManager bbvaLayout       = new BBVAPaymentLayoutManager();
            List <Overdraft>         overdrafts       = new List <Overdraft>();
            List <OverdraftDetail>   overdraftDetails = new List <OverdraftDetail>();
            OverdraftDetail          detail;
            ConceptPayment           concept;


            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 3200.0m,
                Value          = 15,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 239.8m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "REHE730714HG8";
            employee.BankAccount       = "8899775533";
            employee.FirstLastName     = "Rodriguez";
            employee.SecondLastName    = "Garcia";
            employee.Name              = "Jose de Jesus de Dios Bendito";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Act
            string actual = bbvaLayout.GenerateLayout(overdrafts, null);

            //Assert
            Assert.Equal(expected, actual);
        }
        public void Should_Create_Layout_Multiple_Overdrafts()
        {
            //Arrange
            string expected = "000000001REHE730714HG8   998899775533          000000000296020Ernesto Renteria Huerta                 001001"
                              + Environment.NewLine
                              + "000000002BACF6710256R4   997788556633          000000000748960Fermin Ballesteros Cruz                 001001"
                              + Environment.NewLine;

            BBVAPaymentLayoutManager bbvaLayout       = new BBVAPaymentLayoutManager();
            List <Overdraft>         overdrafts       = new List <Overdraft>();
            List <OverdraftDetail>   overdraftDetails = new List <OverdraftDetail>();
            OverdraftDetail          detail;
            ConceptPayment           concept;


            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 3200.0m,
                Value          = 15,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 239.8m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            //Employee 1
            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "REHE730714HG8";
            employee.BankAccount       = "8899775533";
            employee.FirstLastName     = "Renteria";
            employee.SecondLastName    = "Huerta";
            employee.Name              = "Ernesto";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Employee 2
            overdraftDetails = new List <OverdraftDetail>();

            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 7399.9m,
                Value          = 15,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Bono",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 650m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);


            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 239.8m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "ISR",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 320.5m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            employee                   = new Employee();
            overdraft                  = new Overdraft();
            employee.RFC               = "BACF6710256R4";
            employee.BankAccount       = "7788556633";
            employee.FirstLastName     = "Ballesteros";
            employee.SecondLastName    = "Cruz";
            employee.Name              = "Fermin";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Act
            string actual = bbvaLayout.GenerateLayout(overdrafts, null);

            //Assert
            Assert.Equal(expected, actual);
        }
        public void Should_Create_Layout_Multiple_Overfrafts()
        {
            //Arrange
            string expected = "100001E0129202056000171742     01312020"
                              + Environment.NewLine
                              + "2000020000003ARRIAGA                       DARIO               JULIO                         11223344556     000000000000325580"
                              + Environment.NewLine
                              + "2000030000004VERA                          CASTRO              DOLORES                       12131415163     000000000000317400"
                              + Environment.NewLine
                              + "2000040000007LOPEZ                         SALAZAR             DANIEL                        12345678905     000000000000167200"
                              + Environment.NewLine
                              + "30000500003000000000000810180"
                              + Environment.NewLine;

            SantanderPaymentLayoutManager santanderLayout = new SantanderPaymentLayoutManager();
            List <Overdraft>       overdrafts             = new List <Overdraft>();
            List <OverdraftDetail> overdraftDetails       = new List <OverdraftDetail>();
            OverdraftDetail        detail;
            ConceptPayment         concept;


            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 3950.0m,
                Value          = 7,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Todas deducciones",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 694.2m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            //Employee 1
            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "ROSY7611053X8";
            employee.BankAccount       = "11223344556";
            employee.FirstLastName     = "Arriaga";
            employee.SecondLastName    = "Dario";
            employee.Name              = "Julio";
            employee.Code              = "3";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Employee 2
            overdraftDetails = new List <OverdraftDetail>();

            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 3500.0m,
                Value          = 7,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Bono",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 450m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);


            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 90.04m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "ISR",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 685.96m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            employee                   = new Employee();
            overdraft                  = new Overdraft();
            employee.RFC               = "REHE730714HG8";
            employee.BankAccount       = "12131415163";
            employee.FirstLastName     = "Vera";
            employee.SecondLastName    = "Castro";
            employee.Name              = "Dolores";
            employee.Code              = "004";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Employee 3
            overdraftDetails = new List <OverdraftDetail>();

            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 1850.0m,
                Value          = 7,
            };

            overdraftDetails.Add(detail);


            concept = new ConceptPayment
            {
                Name        = "Todas deducciones",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 178.0m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            employee                   = new Employee();
            overdraft                  = new Overdraft();
            employee.RFC               = "BACF6710253V5";
            employee.BankAccount       = "12345678905";
            employee.FirstLastName     = "Lopez";
            employee.SecondLastName    = "Salazar";
            employee.Name              = "Daniel";
            employee.Code              = "00000007";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            SantanderAdditionalInformation additionalInformation = new SantanderAdditionalInformation
            {
                GenerationDate     = new DateTime(2020, 1, 29),
                PaymentDate        = new DateTime(2020, 1, 31),
                CompanyBankAccount = "56000171742",
            };

            //Act
            string actual = santanderLayout.GenerateLayout(overdrafts, additionalInformation);

            //Assert
            Assert.Equal(expected, actual);
        }
        public void Should_Create_Layout_Long_Employee_Name()
        {
            //Arrange
            string expected = "100001E0129202056000171742     01312020"
                              + Environment.NewLine
                              + "2000020000001BARRIENTOS DE DIOS DE LA CRUZ ARECHIGA DEL MONTE VMARIA JACARANDA ISABEL DE LA R12345678901     000000000000580780"
                              + Environment.NewLine
                              + "30000300001000000000000580780"
                              + Environment.NewLine;

            SantanderPaymentLayoutManager santanderLayout = new SantanderPaymentLayoutManager();
            List <Overdraft>       overdrafts             = new List <Overdraft>();
            List <OverdraftDetail> overdraftDetails       = new List <OverdraftDetail>();
            OverdraftDetail        detail;
            ConceptPayment         concept;


            //Salaries payments
            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 6307.8m,
                Value          = 15,
            };
            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Septimo día",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 500.0m,
                Value          = 1,
            };
            overdraftDetails.Add(detail);

            //Deducctions
            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 250.55m,
                Value          = 0,
            };
            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "I.S.R. (mes)",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 749.45m,
                Value          = 0,
            };
            overdraftDetails.Add(detail);


            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "ROSY7611053X8";
            employee.BankAccount       = "12345678901";
            employee.FirstLastName     = "Barrientos de Dios de la Cruz Bendita";
            employee.SecondLastName    = "Arechiga del Monte Verde";
            employee.Name              = "Maria Jacaranda Isabel de la Reyna";
            employee.Code              = "1";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            SantanderAdditionalInformation additionalInformation = new SantanderAdditionalInformation
            {
                GenerationDate     = new DateTime(2020, 1, 29),
                PaymentDate        = new DateTime(2020, 1, 31),
                CompanyBankAccount = "56000171742",
            };

            //Act
            string actual = santanderLayout.GenerateLayout(overdrafts, additionalInformation);

            //Assert
            Assert.Equal(expected, actual);
        }
        public void Should_Create_Layout_Long_Employee_Code()
        {
            //Arrange
            string expected = "100001E0129202056000171742     01312020"
                              + Environment.NewLine
                              + "2000020000001LOPEZ                         JIMENEZ             JOSE                          12345678901     000000000000580780"
                              + Environment.NewLine
                              + "30000300001000000000000580780"
                              + Environment.NewLine;

            SantanderPaymentLayoutManager santanderLayout = new SantanderPaymentLayoutManager();
            List <Overdraft>       overdrafts             = new List <Overdraft>();
            List <OverdraftDetail> overdraftDetails       = new List <OverdraftDetail>();
            OverdraftDetail        detail;
            ConceptPayment         concept;


            //Salaries payments
            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 6307.8m,
                Value          = 15,
            };
            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Septimo día",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 500.0m,
                Value          = 1,
            };
            overdraftDetails.Add(detail);

            //Deducctions
            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 250.55m,
                Value          = 0,
            };
            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "I.S.R. (mes)",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 749.45m,
                Value          = 0,
            };
            overdraftDetails.Add(detail);


            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "ROSY7611053X8";
            employee.BankAccount       = "12345678901";
            employee.FirstLastName     = "Lopez";
            employee.SecondLastName    = "Jimenez";
            employee.Name              = "JOSE";
            employee.Code              = "000000001";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            SantanderAdditionalInformation additionalInformation = new SantanderAdditionalInformation
            {
                GenerationDate     = new DateTime(2020, 1, 29),
                PaymentDate        = new DateTime(2020, 1, 31),
                CompanyBankAccount = "56000171742",
            };

            //Act
            string actual = santanderLayout.GenerateLayout(overdrafts, additionalInformation);

            //Assert
            Assert.Equal(expected, actual);
        }
Esempio n. 14
0
        public void Should_Create_Layout_Multiple_Overfrafts()
        {
            //Arrange
            string expected = "44112266770000000325580Abono por nómina              Rodriguez Sanchez Ivan                  "
                              + Environment.NewLine
                              + "88997755440000000317400Abono por nómina              Renteria Huerta Ernesto                 "
                              + Environment.NewLine
                              + "77885566990000000167200Abono por nómina              Ballesteros Cruz Fermin Gonzalo         "
                              + Environment.NewLine;

            HSBCPaymentLayoutManager hsbcLayout       = new HSBCPaymentLayoutManager();
            List <Overdraft>         overdrafts       = new List <Overdraft>();
            List <OverdraftDetail>   overdraftDetails = new List <OverdraftDetail>();
            OverdraftDetail          detail;
            ConceptPayment           concept;


            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 3950.0m,
                Value          = 7,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Todas deducciones",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 694.2m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            //Employee 1
            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "ROSY7611053X8";
            employee.BankAccount       = "4411226677";
            employee.FirstLastName     = "Rodriguez";
            employee.SecondLastName    = "Sanchez";
            employee.Name              = "Ivan";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Employee 2
            overdraftDetails = new List <OverdraftDetail>();

            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 3500.0m,
                Value          = 7,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Bono",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 450m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);


            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 90.04m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "ISR",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 685.96m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            employee                   = new Employee();
            overdraft                  = new Overdraft();
            employee.RFC               = "REHE730714HG8";
            employee.BankAccount       = "8899775544";
            employee.FirstLastName     = "Renteria";
            employee.SecondLastName    = "Huerta";
            employee.Name              = "Ernesto";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Employee 3
            overdraftDetails = new List <OverdraftDetail>();

            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 1850.0m,
                Value          = 7,
            };

            overdraftDetails.Add(detail);


            concept = new ConceptPayment
            {
                Name        = "Todas deducciones",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 178.0m,
                Value          = 0,
            };

            overdraftDetails.Add(detail);

            employee                   = new Employee();
            overdraft                  = new Overdraft();
            employee.RFC               = "BACF6710253V5";
            employee.BankAccount       = "7788556699";
            employee.FirstLastName     = "Ballesteros";
            employee.SecondLastName    = "Cruz";
            employee.Name              = "Fermin Gonzalo";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Act
            string actual = hsbcLayout.GenerateLayout(overdrafts, null);

            //Assert
            Assert.Equal(expected, actual);
        }
Esempio n. 15
0
        public void Should_Create_Layout_Single_Overdraft_Long_BankAccount()
        {
            //Arrange
            string expected = "8899775533220000002402320Abono por nómina              Rodriguez Sanchez Ivan                  "
                              + Environment.NewLine;

            HSBCPaymentLayoutManager hsbcLayout       = new HSBCPaymentLayoutManager();
            List <Overdraft>         overdrafts       = new List <Overdraft>();
            List <OverdraftDetail>   overdraftDetails = new List <OverdraftDetail>();
            OverdraftDetail          detail;
            ConceptPayment           concept;


            //Salaries payments
            concept = new ConceptPayment
            {
                Name        = "Sueldo",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 3000.0m,
                Value          = 6,
            };
            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Septimo día",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 500.0m,
                Value          = 1,
            };
            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Reparto de utilidades",
                ConceptType = ConceptType.SalaryPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 25825.31m,
                Value          = 1,
            };
            overdraftDetails.Add(detail);

            //Deducctions
            concept = new ConceptPayment
            {
                Name        = "IMSS",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 148.3m,
                Value          = 0,
            };
            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "I.S.R. Art142",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 4608.05m,
                Value          = 0,
            };
            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "I.S.R. (mes)",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = 545.88m,
                Value          = 0,
            };
            overdraftDetails.Add(detail);

            concept = new ConceptPayment
            {
                Name        = "Ajuste al neto",
                ConceptType = ConceptType.DeductionPayment,
            };

            detail = new OverdraftDetail
            {
                ConceptPayment = concept,
                Amount         = -0.12m,
                Value          = 0,
            };
            overdraftDetails.Add(detail);


            Employee  employee  = new Employee();
            Overdraft overdraft = new Overdraft();

            employee.RFC               = "ROSY7611053X8";
            employee.BankAccount       = "889977553322";
            employee.FirstLastName     = "Rodriguez";
            employee.SecondLastName    = "Sanchez";
            employee.Name              = "Ivan";
            overdraft.Employee         = employee;
            overdraft.OverdraftDetails = overdraftDetails;

            overdrafts.Add(overdraft);

            //Act
            string actual = hsbcLayout.GenerateLayout(overdrafts, null);

            //Assert
            Assert.Equal(expected, actual);
        }
Esempio n. 16
0
        public async Task <List <Overdraft> > CreateByEmployeesAsync(List <Employee> employees,
                                                                     List <PeriodDetail> periodDetailActual, List <ConceptPayment> conceptPayments)
        {
            //all good
            var identityWorkId          = employees.FirstOrDefault().company;
            var instanceId              = employees.FirstOrDefault().InstanceID;
            var user                    = employees.FirstOrDefault().user;
            List <Overdraft> overdrafts = new List <Overdraft>();

            if (null != periodDetailActual && periodDetailActual.Any())
            {
                var middlewareManager = new MiddlewareManager <Overdraft>(new BaseRecordManager <Overdraft>(), new OverdraftValidator());

                foreach (var employee in employees)
                {
                    var periodDetail = periodDetailActual.FirstOrDefault(p => employee.PeriodTypeID == p.Period.PeriodTypeID &&
                                                                         employee.EntryDate <= p.FinalDate);

                    if (null != periodDetail)
                    {
                        var overdraft = new Overdraft()
                        {
                            ID             = Guid.NewGuid(),
                            Active         = true,
                            company        = identityWorkId,
                            Timestamp      = DateTime.UtcNow,
                            InstanceID     = instanceId,
                            Description    = "Sobrerecibo",
                            CreationDate   = DateTime.Now,
                            Name           = "Sobrerecibo",
                            StatusID       = 1,
                            EmployeeID     = employee.ID,
                            user           = user,
                            PeriodDetailID = periodDetail.ID,
                        };

                        //details
                        conceptPayments.ForEach(concept =>
                        {
                            var overdraftDetail              = new OverdraftDetail();
                            overdraftDetail.Active           = true;
                            overdraftDetail.Amount           = 0;
                            overdraftDetail.Taxed            = 0;
                            overdraftDetail.Exempt           = 0;
                            overdraftDetail.IMSSTaxed        = 0;
                            overdraftDetail.IMSSExempt       = 0;
                            overdraftDetail.company          = identityWorkId;
                            overdraftDetail.ConceptPaymentID = concept.ID;
                            overdraftDetail.CreationDate     = DateTime.UtcNow;
                            overdraftDetail.Name             = "";
                            overdraftDetail.Description      = "";
                            overdraftDetail.ID         = Guid.NewGuid();
                            overdraftDetail.InstanceID = instanceId;
                            overdraftDetail.IsAmount1CapturedByUser     = false;
                            overdraftDetail.IsAmount2CapturedByUser     = false;
                            overdraftDetail.IsAmount3CapturedByUser     = false;
                            overdraftDetail.IsAmount4CapturedByUser     = false;
                            overdraftDetail.IsTotalAmountCapturedByUser = false;
                            overdraftDetail.IsValueCapturedByUser       = false;
                            overdraftDetail.Label1      = "";
                            overdraftDetail.Label2      = "";
                            overdraftDetail.Label3      = "";
                            overdraftDetail.Label4      = "";
                            overdraftDetail.OverdraftID = overdraft.ID;
                            overdraftDetail.StatusID    = 1;
                            overdraftDetail.Timestamp   = DateTime.UtcNow;
                            overdraftDetail.user        = user;
                            overdraftDetail.Value       = 0;

                            overdraft.OverdraftDetails.Add(overdraftDetail);
                        });

                        overdrafts.Add(overdraft);
                    }
                }

                await middlewareManager.CreateAsync(overdrafts.ToList(), identityWorkId);
            }

            return(overdrafts.ToList());
        }