コード例 #1
0
        }         // IsRegulated

        public static string TypeOfBussinessForWeb(this TypeOfBusiness businessReduced)
        {
            switch (businessReduced)
            {
            case TypeOfBusiness.Limited:
                return("Limited Company");

            case TypeOfBusiness.Entrepreneur:
                return("Sole Trader (not Inc.)");

            case TypeOfBusiness.LLP:
                return("Limited liability partnership");

            case TypeOfBusiness.PShip:
                return("Partnership (More than 3)");

            case TypeOfBusiness.PShip3P:
                return("Partnership (Up to 3)");

            case TypeOfBusiness.SoleTrader:
                return("Sole Trader (Inc.)");
            }             // switch

            return(string.Empty);
        } // TypeOfBussinessForWeb
コード例 #2
0
 private bool IsRegulated(TypeOfBusiness typeOfBusiness)
 {
     return(new[] {
         TypeOfBusiness.Limited,
         TypeOfBusiness.LLP,
         TypeOfBusiness.PShip
     }.Contains(typeOfBusiness));
 }
コード例 #3
0
        public ApplyBackdoorLogic(
            string outerContextDescription,
            bool backdoorEnabled,
            int customerID,
            string customerEmail,
            bool customerOwnsProperty,
            bool customerIsTest,
            CashRequestOriginator?cashRequestOriginator,
            long cashRequestID,
            long nlCashRequestID,
            int homeOwnerCap,
            int notHomeOwnerCap,
            int smallLoanScenarioLimit,
            bool aspireToMinSetupFee,
            TypeOfBusiness typeOfBusiness,
            int customerOriginID,
            MonthlyRepaymentData requestedLoan,
            int delay,
            int offerValidHours,
            string tag
            ) : base(outerContextDescription)
        {
            this.backdoorEnabled        = backdoorEnabled;
            this.customerID             = customerID;
            this.customerEmail          = customerEmail;
            this.customerOwnsProperty   = customerOwnsProperty;
            this.customerIsTest         = customerIsTest;
            this.cashRequestOriginator  = cashRequestOriginator ?? CashRequestOriginator.Other;
            this.cashRequestID          = cashRequestID;
            this.nlCashRequestID        = nlCashRequestID;
            this.homeOwnerCap           = homeOwnerCap;
            this.notHomeOwnerCap        = notHomeOwnerCap;
            this.smallLoanScenarioLimit = smallLoanScenarioLimit;
            this.aspireToMinSetupFee    = aspireToMinSetupFee;
            this.typeOfBusiness         = typeOfBusiness;
            this.customerOriginID       = customerOriginID;
            this.requestedLoan          = requestedLoan;
            this.delay           = delay;
            this.offerValidHours = offerValidHours;
            this.tag             = tag;

            BackdoorLogicApplied = false;

            AutoDecisionResponse = new AutoDecisionResponse(this.customerID);

            Medal       = null;
            OfferResult = null;
        }         // constructor
コード例 #4
0
        }         // Reduce

        public static TypeOfBusinessAgreementReduced AgreementReduce(this TypeOfBusiness typeOfBusiness)
        {
            switch (typeOfBusiness)
            {
            case TypeOfBusiness.Entrepreneur:
            case TypeOfBusiness.PShip3P:
            case TypeOfBusiness.SoleTrader:
                return(TypeOfBusinessAgreementReduced.Personal);

            case TypeOfBusiness.PShip:
            case TypeOfBusiness.LLP:
            case TypeOfBusiness.Limited:
                return(TypeOfBusinessAgreementReduced.Business);
            }             // switch

            return(TypeOfBusinessAgreementReduced.Personal);
        }         // AgreementReduce
コード例 #5
0
        public static TypeOfBusinessReduced Reduce(this TypeOfBusiness business)
        {
            switch (business)
            {
            case TypeOfBusiness.Entrepreneur:
                return(TypeOfBusinessReduced.Personal);

            case TypeOfBusiness.LLP:
            case TypeOfBusiness.Limited:
                return(TypeOfBusinessReduced.Limited);

            case TypeOfBusiness.PShip:
            case TypeOfBusiness.PShip3P:
            case TypeOfBusiness.SoleTrader:
                return(TypeOfBusinessReduced.NonLimited);
            }             // switch

            return(TypeOfBusinessReduced.Personal);
        }         // Reduce
コード例 #6
0
 public void SetAdditionalCustomerData(
     long acashRequestID,
     long anlCashRequestID,
     int asmallLoanScenarioLimit,
     bool aaspireToMinSetupFee,
     TypeOfBusiness atypeOfBusiness,
     int acustomerOriginID,
     MonthlyRepaymentData arequestedLoan,
     int aofferValidHours
     )
 {
     this.cashRequestID          = acashRequestID;
     this.nlCashRequestID        = anlCashRequestID;
     this.smallLoanScenarioLimit = asmallLoanScenarioLimit;
     this.aspireToMinSetupFee    = aaspireToMinSetupFee;
     this.typeOfBusiness         = atypeOfBusiness;
     this.customerOriginID       = acustomerOriginID;
     this.requestedLoan          = arequestedLoan;
     this.offerValidHours        = aofferValidHours;
 }         // SetAdditionalCustomerData
コード例 #7
0
        /// <summary>
        /// Deduces the type of the customer address.
        /// </summary>
        /// <param name="typeOfBusiness">The type of business.</param>
        /// <param name="isDirector">if set to <c>true</c> [is director].</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentOutOfRangeException">typeOfBusiness;null</exception>
        private CustomerAddressType DeduceCustomerAddressType(TypeOfBusiness typeOfBusiness, bool isDirector)
        {
            switch (typeOfBusiness)
            {
            case TypeOfBusiness.Entrepreneur:
                return(CustomerAddressType.PersonalAddress);

            case TypeOfBusiness.LLP:
                return(CustomerAddressType.LimitedDirectorHomeAddress);

            case TypeOfBusiness.PShip3P:
                return(CustomerAddressType.NonLimitedCompanyAddress);

            case TypeOfBusiness.PShip:
                return(CustomerAddressType.NonLimitedCompanyAddress);

            case TypeOfBusiness.Limited:
                return(CustomerAddressType.LimitedDirectorHomeAddress);

            default:
                throw new ArgumentOutOfRangeException("typeOfBusiness", typeOfBusiness, null);
            }
        }
コード例 #8
0
        private void HandleOnePayment(LoanAutoChargeModel loan, NLLoanAutoChargeModel nlLoan = null)
        {
            string   message;
            int      loanScheduleId    = loan.LoanScheduleId;
            int      loanId            = loan.LoanId;
            int      customerId        = loan.CustomerId;
            string   customerMail      = loan.Email;
            string   fullname          = loan.Fullname;
            string   typeOfBusinessStr = loan.TypeOfBusiness;
            DateTime dueDate           = loan.DueDate;         // PlannedDate
            bool     reductionFee      = loan.ReductionFee;
            string   refNum            = loan.RefNum;          // of loan
            bool     lastInstallment   = loan.LastInstallment; // bit

            TypeOfBusiness typeOfBusiness = (TypeOfBusiness)Enum.Parse(typeof(TypeOfBusiness), typeOfBusinessStr);
            bool           isNonRegulated = IsRegulated(typeOfBusiness);

            DateTime now      = DateTime.UtcNow;
            TimeSpan span     = now.Subtract(dueDate);
            int      daysLate = (int)span.TotalDays;

            // amount due.
            decimal amountDue = this.payPointApi.GetAmountToPay(loanScheduleId);

            if (nlLoan == null)
            {
                NL_AddLog(LogType.Info, string.Format("nlloan for oldLoan {0} not found", loanId), this.strategyArgs, null, null, null);
            }
            else
            {
                // new loan amount due.
                decimal nlAmountDue = GetAmountToPay(nlLoan.CustomerId, nlLoan.LoanId, nlLoan.LoanScheduleId);

                message = string.Format("LoanID={0} oldLoanID={1} amountDue= {2} nlAmountDue={3}", nlLoan.LoanId, nlLoan.OldLoanID, amountDue, nlAmountDue);
                Log.Debug(message);
                NL_AddLog(LogType.Info, "AmountDue", this.strategyArgs, message, null, null);
            }

            if (!ShouldCharge(lastInstallment, amountDue))
            {
                message = string.Format("Will not charge loan schedule id {0} (amount {1}): the minimal amount for collection is {2}.", loanScheduleId, amountDue, this.amountToChargeFrom);
                Log.Info(message);
                NL_AddLog(LogType.Info, "Exit 1", this.strategyArgs, message, null, null);
                return;
            }            //if

            decimal initialAmountDue = amountDue;

            if ((!isNonRegulated && daysLate > 3) || !this.dueChargingDays.Contains(daysLate))
            {
                message = string.Format("Will not charge loan schedule id {0} (amount {1}): the charging is not scheduled today", loanScheduleId, amountDue);
                Log.Info(message);
                NL_AddLog(LogType.Info, "Exit 2", this.strategyArgs, message, null, null);
                return;
            }

            // step 2 - charging
            AutoPaymentResult autoPaymentResult = TryToMakeAutoPayment(
                loanId,
                loanScheduleId,
                initialAmountDue,
                customerId,
                customerMail,
                fullname,
                reductionFee,
                isNonRegulated
                );

            if (autoPaymentResult.IsException || autoPaymentResult.PaymentFailed)
            {
                Error = string.Format("Failed collection from customer:{0} amount:{1}, loanID={2}", customerId, initialAmountDue, loanId);
                Log.Warn(Error);
                NL_AddLog(LogType.Info, "Exit 3", this.strategyArgs, Error, null, null);
                return;
            }             // if

            // step 4 - notifications
            if (autoPaymentResult.PaymentCollectedSuccessfully)
            {
                // send mail to customer from template "Mandrill - Repayment confirmation"
                PayEarly payEarly = new PayEarly(customerId, autoPaymentResult.ActualAmountCharged, refNum);
                payEarly.Execute();

                SendLoanStatusMail(customerId, loanId, customerMail, autoPaymentResult.ActualAmountCharged); // Will send mail for paid off loans
            }                                                                                                //if
        }                                                                                                    //HandleOnePayment
コード例 #9
0
        }         // AgreementReduce

        public static bool IsRegulated(this TypeOfBusiness typeOfBusiness)
        {
            return(typeOfBusiness.AgreementReduce() == TypeOfBusinessAgreementReduced.Personal);
        }         // IsRegulated
コード例 #10
0
        /// <summary>
        /// Creates the customer address.
        /// </summary>
        /// <param name="companyId">The company identifier.</param>
        /// <param name="customerId">The customer identifier.</param>
        /// <param name="directorId">The director identifier.</param>
        /// <param name="typeOfBusiness">The type of business.</param>
        /// <param name="authorityInfo">The authority information.</param>
        /// <returns></returns>
        private CustomerAddress CreateCustomerAddress(int companyId, int customerId, int directorId, TypeOfBusiness typeOfBusiness, AuthorityInfo authorityInfo)
        {
            CustomerAddress address = null;

            if (authorityInfo.AddressInfo != null)
            {
                address = new CustomerAddress {
                    CompanyId           = companyId,
                    CustomerId          = customerId,
                    DirectorId          = directorId,
                    Country             = authorityInfo.AddressInfo.Country,
                    County              = authorityInfo.AddressInfo.County,
                    Deliverypointsuffix = authorityInfo.AddressInfo.Deliverypointsuffix,
                    Line1        = authorityInfo.AddressInfo.Line1,
                    Line2        = authorityInfo.AddressInfo.Line2,
                    Line3        = authorityInfo.AddressInfo.Line3,
                    Organisation = authorityInfo.AddressInfo.Organisation,
                    Pobox        = authorityInfo.AddressInfo.Pobox,
                    Postcode     = authorityInfo.AddressInfo.Postcode,
                    Mailsortcode = authorityInfo.AddressInfo.Mailsortcode,
                    Town         = authorityInfo.AddressInfo.Town,
                    Udprn        = authorityInfo.AddressInfo.Udprn,
                    Nohouseholds = authorityInfo.AddressInfo.Nohouseholds,
                    addressType  = DeduceCustomerAddressType(typeOfBusiness, authorityInfo.IsDirector),
                    Smallorg     = authorityInfo.AddressInfo.Smallorg
                };
            }
            return(address);
        }