public static bool IsValid(this AutoReapprovalOutput output)
        {
            if (output == null)
            {
                return(false);
            }

            if (output.AppValidFor == null)
            {
                return(false);
            }

            if (output.AppValidFor.Value <= DateTime.UtcNow)
            {
                return(false);
            }

            if (output.ApprovedAmount <= 0)
            {
                return(false);
            }

            if (output.LastApprovedCashRequestID <= 0)
            {
                return(false);
            }

            return(true);
        }         // IsValid
Exemple #2
0
        protected virtual void GatherData()
        {
            Cfg.Load();

            DB.ForEachRowSafe(
                ProcessRow,
                "LoadAutoReapprovalData",
                CommandSpecies.StoredProcedure,
                new QueryParameter("CustomerID", Args.CustomerID),
                new QueryParameter("Now", Now)
                );

            GatherAvailableFunds();

            MetaData.Validate();

            Trail.MyInputData.Init(Now, null);
            Trail.MyInputData.ReApproveAmount     = MetaData.ApprovedAmount;
            Trail.MyInputData.FraudStatus         = MetaData.FraudStatus;
            Trail.MyInputData.ManualApproveDate   = MetaData.LacrTime;
            Trail.MyInputData.WasLate             = MetaData.LateLoanCount > 0;
            Trail.MyInputData.WasRejected         = MetaData.RejectAfterLacrID > 0;
            Trail.MyInputData.NumOutstandingLoans = MetaData.OpenLoanCount;
            Trail.MyInputData.HasLoanCharges      = MetaData.SumOfCharges > 0.00000001m;
            Trail.MyInputData.LacrID = MetaData.LacrID;

            Trail.MyInputData.MaxLateDays                           = LatePayments.Count < 1 ? 0 : LatePayments.Select(lp => lp.Delay).Max();
            Trail.MyInputData.NewDataSourceAdded                    = NewMarketplaces.Count > 0;
            Trail.MyInputData.AvaliableFunds                        = Funds.Available - Funds.Reserved;
            Trail.MyInputData.AutoReApproveMaxLacrAge               = Cfg.MaxLacrAge;
            Trail.MyInputData.AutoReApproveMaxLatePayment           = Cfg.MaxLatePayment;
            Trail.MyInputData.AutoReApproveMaxNumOfOutstandingLoans = Cfg.MaxNumOfOutstandingLoans;
            Trail.MyInputData.MinLoan = ConfigManager.CurrentValues.Instance.MinLoan;

            Output = new AutoReapprovalOutput {
                AppValidFor               = Now.AddHours(MetaData.OfferLength),
                IsEmailSendingBanned      = MetaData.IsEmailSendingBanned,
                LastApprovedCashRequestID = MetaData.LacrID,
            };
        }         // GatherData
        }         // IsValid

        public static string Stringify(this AutoReapprovalOutput output)
        {
            return(output == null ? "null" : output.ToString());
        } // Stringify