Exemplo n.º 1
0
        public void ImportInstallmentRepayment(List <Installment> pInstallments)
        {
            LoanServices   loanServices   = new LoanServices(_user);
            ClientServices clientServices = new ClientServices(_user);

            foreach (var installment in pInstallments)
            {
                int loanId = loanServices.SelectLoanId(installment.ContractCode);
                var loan   = loanServices.SelectLoan(loanId, true, true, true);
                var client = clientServices.FindTiersByContractId(loanId);
                if (installment.RepaymentStatus == 1)
                {
                    if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                    {
                        loanServices.ConfirmPendingRepayment(loan, client);
                    }
                    else if (!loan.InstallmentList[installment.InstallmentNumber].IsRepaid)
                    {
                        PaymentMethod paymentMethod =
                            ServicesProvider.GetInstance().GetPaymentMethodServices().GetPaymentMethodById(5);
                        loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate,
                                           installment.InstallmentAmount, false,
                                           0, 0, false, 0, true, false, paymentMethod, "", false);
                    }
                }
                else
                {
                    if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                    {
                        loanServices.CancelPendingInstallments(loan);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public bool SetInstallmentAsPending(Installment installment, OPaymentMethods pPaymentMethod)
        {
            ClientServices clientServices = new ClientServices(_user);
            LoanServices loanServices = new LoanServices(_user);

            var client = clientServices.FindTiers(installment.ClientId, Octopus.Enums.OClientTypes.Person);
            var loan = loanServices.SelectLoan(installment.ContractId, true, true, true);

            loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate, installment.InstallmentAmount,
                false, 0, 0, false, 0, true, pPaymentMethod, "", true);

            return true;
        }
Exemplo n.º 3
0
        public bool SetInstallmentAsPending(Installment installment, PaymentMethod pPaymentMethod)
        {
            ClientServices clientServices = new ClientServices(_user);
            LoanServices   loanServices   = new LoanServices(_user);

            var client = clientServices.FindTiers(installment.ClientId, OpenCBS.Enums.OClientTypes.Person);
            var loan   = loanServices.SelectLoan(installment.ContractId, true, true, true);

            loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate, installment.InstallmentAmount,
                               false, 0, 0, false, 0, true, false, pPaymentMethod, "", true);

            return(true);
        }
Exemplo n.º 4
0
 public void ImportInstallmentRepayment(List<Installment> pInstallments)
 {
     LoanServices loanServices = new LoanServices(_user);
     ClientServices clientServices = new ClientServices(_user);
     foreach (var installment in pInstallments)
     {
         int loanId = loanServices.SelectLoanID(installment.ContractCode);
         var loan = loanServices.SelectLoan(loanId, true, true, true);
         var client = clientServices.FindTiersByContractId(loanId);
         if (installment.RepaymentStatus == 1)
         {
             if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                 loanServices.ConfirmPendingRepayment(loan, client);
             else if (!loan.InstallmentList[installment.InstallmentNumber].IsRepaid)
                 loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate, installment.InstallmentAmount, false,
                     0, 0, false, 0, true, Octopus.Enums.OPaymentMethods.WireTransfer, "", false);
         }
         else
         {
             if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                 loanServices.CancelPendingInstallments(loan);
         }
     }
 }
Exemplo n.º 5
0
        public void ImportInstallmentRepayment(List<Installment> pInstallments)
        {
            LoanServices loanServices = new LoanServices(_user);
            ClientServices clientServices = new ClientServices(_user);
            foreach (var installment in pInstallments)
            {
                int loanId = loanServices.SelectLoanId(installment.ContractCode);
                var loan = loanServices.SelectLoan(loanId, true, true, true);
                var client = clientServices.FindTiersByContractId(loanId);
                if (installment.RepaymentStatus == 1)
                {
                    if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                        loanServices.ConfirmPendingRepayment(loan, client);
                    else if (!loan.InstallmentList[installment.InstallmentNumber].IsRepaid)
                    {
                        PaymentMethod paymentMethod =
                            ServicesProvider.GetInstance().GetPaymentMethodServices().GetPaymentMethodById(5);
                        loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate,
                            installment.InstallmentAmount, false,
                            0, 0, false, 0, true, false, paymentMethod, "", false);
                    }

                }
                else
                {
                    if (loan.InstallmentList[installment.InstallmentNumber].IsPending)
                        loanServices.CancelPendingInstallments(loan);
                }
            }
        }