Exemplo n.º 1
0
        public void LoanTermTest_SelfReportedLoanModel_check_for_range()
        {
            SelfReportedLoanModel passingValueLowerBound = new SelfReportedLoanModel()
            {
                LoanTerm = 1
            };
            SelfReportedLoanModel passingValueUpperBound = new SelfReportedLoanModel()
            {
                LoanTerm = 100
            };
            SelfReportedLoanModel failingValueUnderMin = new SelfReportedLoanModel()
            {
                LoanTerm = 0
            };
            SelfReportedLoanModel failingValueOverMax = new SelfReportedLoanModel()
            {
                LoanTerm = 101
            };


            RangeAttribute rangeCheck = new RangeAttribute(1, 100);


            Assert.IsTrue(rangeCheck.IsValid(passingValueLowerBound.LoanTerm), "Assertion of positive case (lower bound) being true failed");
            Assert.IsTrue(rangeCheck.IsValid(passingValueUpperBound.LoanTerm), "Assertion of positive case (upper bound) being true failed");
            Assert.IsFalse(rangeCheck.IsValid(failingValueUnderMin.LoanTerm), "Assertion of negative case (under min) being true failed");
            Assert.IsFalse(rangeCheck.IsValid(failingValueOverMax.LoanTerm), "Assertion of negative case (over max) being true failed");
        }
Exemplo n.º 2
0
        public void LoanTypeIdTest_SelfReportedLoanModel_check_for_string_length()
        {
            SelfReportedLoanModel passingValueLowerBound = new SelfReportedLoanModel()
            {
                LoanTypeId = "1"
            };
            SelfReportedLoanModel passingValueUpperBound = new SelfReportedLoanModel()
            {
                LoanTypeId = "50CharactersCharactersCharactersCharactersCharacte"
            };
            SelfReportedLoanModel failingValueUnderMin = new SelfReportedLoanModel()
            {
                LoanTypeId = ""
            };
            SelfReportedLoanModel failingValueAboveMax = new SelfReportedLoanModel()
            {
                LoanTypeId = "51CharactersCharactersCharactersCharactersCharacter"
            };


            StringLengthAttribute stringLengthCheck = new StringLengthAttribute(50);

            stringLengthCheck.MinimumLength = 1;


            Assert.IsTrue(stringLengthCheck.IsValid(passingValueLowerBound.LoanTypeId), "Assertion of positive case (lower bound) being true failed");
            Assert.IsTrue(stringLengthCheck.IsValid(passingValueUpperBound.LoanTypeId), "Assertion of positive case (upper bound) being true failed");
            Assert.IsFalse(stringLengthCheck.IsValid(failingValueUnderMin.LoanTypeId), "Assertion of negative case (under min) case being false failed");
            Assert.IsFalse(stringLengthCheck.IsValid(failingValueAboveMax.LoanTypeId), "Assertion of negative case (above max) case being false failed");
        }
Exemplo n.º 3
0
        public void PrincipalBalanceOutstandingAmountTest_SelfReportedLoanModel_check_for_regex()
        {
            SelfReportedLoanModel passingValueTwoDecimalPlaces = new SelfReportedLoanModel()
            {
                PrincipalBalanceOutstandingAmount = 100.01m
            };
            SelfReportedLoanModel passingValueOneDecimalPlace = new SelfReportedLoanModel()
            {
                PrincipalBalanceOutstandingAmount = 100.1m
            };
            SelfReportedLoanModel passingValueNoDecimalPlaces = new SelfReportedLoanModel()
            {
                PrincipalBalanceOutstandingAmount = 100m
            };
            SelfReportedLoanModel failingValueImproperNumberOfDigits = new SelfReportedLoanModel()
            {
                PrincipalBalanceOutstandingAmount = 100.001m
            };


            RegularExpressionAttribute regexCheck = new RegularExpressionAttribute(RegexStrings.CURRENCY);


            Assert.IsTrue(regexCheck.IsValid(passingValueTwoDecimalPlaces.PrincipalBalanceOutstandingAmount), "Assertion of positive case (2 decimal places) being true failed");
            Assert.IsTrue(regexCheck.IsValid(passingValueNoDecimalPlaces.PrincipalBalanceOutstandingAmount), "Assertion of positive case (0 decimal places) being true failed");
            Assert.IsTrue(regexCheck.IsValid(passingValueOneDecimalPlace.PrincipalBalanceOutstandingAmount), "Assertion of positive case (1 decimal place) being true failed");
            Assert.IsFalse(regexCheck.IsValid(failingValueImproperNumberOfDigits.PrincipalBalanceOutstandingAmount), "Assertion of negative case (improper # of digits) case being false failed");
        }
Exemplo n.º 4
0
        public void InterestRateTest_SelfReportedLoanModel_check_for_range()
        {
            SelfReportedLoanModel passingValueLowerBound = new SelfReportedLoanModel()
            {
                InterestRate = 0.0
            };
            SelfReportedLoanModel passingValueUpperBound = new SelfReportedLoanModel()
            {
                InterestRate = 100.0
            };
            SelfReportedLoanModel failingValueUnderMin = new SelfReportedLoanModel()
            {
                InterestRate = (-.01)
            };
            SelfReportedLoanModel failingValueAboveMax = new SelfReportedLoanModel()
            {
                InterestRate = 100.01
            };

            RangeAttribute rangeCheck = new RangeAttribute(0.0, 100.0);

            Assert.IsTrue(rangeCheck.IsValid(passingValueLowerBound.InterestRate), "Assertion of positive case (lower bound) being true failed");
            Assert.IsTrue(rangeCheck.IsValid(passingValueUpperBound.InterestRate), "Assertion of positive case (upper bound) being true failed");
            Assert.IsFalse(rangeCheck.IsValid(failingValueUnderMin.InterestRate), "Assertion of negative case (under min) case being false failed");
            Assert.IsFalse(rangeCheck.IsValid(failingValueAboveMax.InterestRate), "Assertion of negative case (above max) case being false failed");
        }
Exemplo n.º 5
0
        public static XmlNode MapSelfReportedLoanToXmlNode(SelfReportedLoanModel srLoan)
        {
            XElement elem    = new XElement("ASASelfReportedLoanObjects");
            XElement srlElem = MapSelfReportedLoanToXElement(srLoan);

            elem.Add(srlElem);
            return(xWebModelHelper.GetXmlNode(elem));
        }
Exemplo n.º 6
0
        public void Validation_ValidSelfReportedLoanModel()
        {
            SelfReportedLoanModel srl = GetValidSelfReportedLoanData();

            bool bValid = srl.IsValid();

            Assert.IsTrue(bValid, "A SelfReportedLoanModel with all good information validated incorrectly.");
        }
Exemplo n.º 7
0
        public void Test_SaveNew_SelfReportedLoanForPerson()
        {
            SelfReportedLoanModel srlModel = GetValidSelfReportedLoanData();

            ASA.Web.Services.SelfReportedService.SelfReported srlAbstraction = new ASA.Web.Services.SelfReportedService.SelfReported();
            ResultCodeModel result = new ResultCodeModel(1); //srlAbstraction.SaveSelfReportedLoan(srlModel);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.ErrorList.Count == 0, "ErrorList.Count != 0");
        }
Exemplo n.º 8
0
        public static bool ValidateInputSelfReportedLoan(SelfReportedLoanModel sr)
        {
            bool bValid = false;

            if (sr != null)
            {
                bValid = sr.IsValid();
            }
            return(bValid);
        }
Exemplo n.º 9
0
        private SelfReportedLoanListModel RemoveInvalidLoansFromList(SelfReportedLoanListModel srList)
        {
            //get Id of the member currently logged-in
            SiteMember sm           = IntegrationLoader.LoadDependency <ISiteMembership>("siteMembership").GetMember();
            string     individualId = "";

            if (sm != null && sm.Profile != null && sm.Profile.Id != null)
            {
                individualId = sm.Profile.Id.ToString();
                _log.Debug(string.Format("SiteMember.Profile.Id = {0}", individualId));
            }

            List <string> invalidLoanIdList = new List <string>();

            //get list of current SRL's for the member logged-in
            if (!string.IsNullOrEmpty(individualId))
            {
                SelfReportedLoanListModel srListFromDB = GetSelfReportedLoans(individualId);
                foreach (SelfReportedLoanModel srl in srList.Loans)
                {
                    if (!string.IsNullOrEmpty(srl.LoanSelfReportedEntryId) && srListFromDB != null)//only care about loans being updated here.
                    {
                        bool foundValidLoan = false;
                        foreach (SelfReportedLoanModel srlFromDB in srListFromDB.Loans)
                        {
                            if (srl.LoanSelfReportedEntryId == srlFromDB.LoanSelfReportedEntryId)
                            {
                                foundValidLoan = true;
                                break;
                            }
                        }

                        // if a loan attempting to be updated by user isn't in DB, then user is tampering. Remove that loan from the update list.
                        if (!foundValidLoan)
                        {
                            invalidLoanIdList.Add(srl.LoanSelfReportedEntryId);
                            _log.Warn(string.Format("User attempted to save loan information that did not belong to them. User = {0}, LoanSelfReportedEntryId = {1}",
                                                    individualId, srl.LoanSelfReportedEntryId));
                        }
                    }
                }

                foreach (string str in invalidLoanIdList)
                {
                    SelfReportedLoanModel srl = srList.Loans.Find(l => l.LoanSelfReportedEntryId == str);
                    if (srl != null)
                    {
                        srList.Loans.Remove(srl);
                    }
                }
            }

            return(srList);
        }
Exemplo n.º 10
0
        public SelfReportedLoanModel CreateLoan(SelfReportedLoanModel loan)
        {
            if (!loan.IsValid())
            {
                throw new System.ComponentModel.DataAnnotations.ValidationException();
            }
            var loanContract    = loan.ToMemberReportedLoanContract();
            var userId          = _memberAdapter.GetMemberIdFromContext();
            var serviceResponse = SaltServiceAgent.CreateLoan(userId, loanContract).FromMemberReportedLoanContract();

            return(serviceResponse);
        }
Exemplo n.º 11
0
        public void ReceivedYearTest_SelfReportedLoanModel_check_for_required()
        {
            SelfReportedLoanModel passingValue = new SelfReportedLoanModel()
            {
                ReceivedYear = 2005
            };


            RequiredAttribute requiredCheck = new RequiredAttribute();


            Assert.IsTrue(requiredCheck.IsValid(passingValue.ReceivedYear), "Assertion of positive case being true failed");
        }
Exemplo n.º 12
0
        private bool IsNewSRL(SelfReportedLoanModel srl)
        {
            Guid g;

            if (Guid.TryParse(srl.LoanSelfReportedEntryId, out g))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 13
0
        public static bool ValidateSelfReportedLoanId(string id)
        {
            bool bValid = false;
            SelfReportedLoanModel srl = new SelfReportedLoanModel();

            srl.LoanSelfReportedEntryId = id;
            if (id != null && srl.IsValid("ID"))
            {
                bValid = true;
            }

            return(bValid);
        }
Exemplo n.º 14
0
        public void LoanTermTest_SelfReportedLoanModel_check_for_required()
        {
            // Non-Nullable
            SelfReportedLoanModel passingValue = new SelfReportedLoanModel()
            {
                LoanTerm = 2005
            };


            RequiredAttribute requiredCheck = new RequiredAttribute();


            Assert.IsTrue(requiredCheck.IsValid(passingValue.LoanTerm), "Assertion of positive case being true failed");
        }
Exemplo n.º 15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="loan"></param>
 /// <returns></returns>
 public static MemberReportedLoanContract ToMemberReportedLoanContract(this SelfReportedLoanModel loan, int memberID)
 {
     return(new MemberReportedLoanContract
     {
         LoanType = loan.LoanTypeId
         , LoanStatus = loan.LoanStatusId
         , PrincipalOutstandingAmount = loan.PrincipalBalanceOutstandingAmount
         , MemberId = memberID
         , InterestRate = (decimal)loan.InterestRate
         , ReceivedYear = (int)loan.ReceivedYear
         , OriginalLoanAmount = loan.OriginalLoanAmount
         , MemberReportedLoanId = loan.LoanSelfReportedEntryId == null ? 0 : Int32.Parse(loan.LoanSelfReportedEntryId)
         , LoanTerm = loan.LoanTerm
         , IsActive = loan.IsActive
     });
 }
Exemplo n.º 16
0
        public void ReceivedYearTest_SelfReportedLoanModel_check_for_regex()
        {
            SelfReportedLoanModel passingValueLowerBound = new SelfReportedLoanModel()
            {
                ReceivedYear = 1900
            };
            SelfReportedLoanModel passingValueUpperBound = new SelfReportedLoanModel()
            {
                ReceivedYear = 2099
            };
            SelfReportedLoanModel failingValueYearTooLow = new SelfReportedLoanModel()
            {
                ReceivedYear = 1899
            };
            SelfReportedLoanModel failingValueYearTooHigh = new SelfReportedLoanModel()
            {
                ReceivedYear = 2100
            };
            SelfReportedLoanModel failingValueNull = new SelfReportedLoanModel()
            {
            };
            SelfReportedLoanModel failingValueImproperNumberOfDigitsTooFew = new SelfReportedLoanModel()
            {
                ReceivedYear = 213
            };
            SelfReportedLoanModel failingValueImproperNumberOfDigitsTooMany = new SelfReportedLoanModel()
            {
                ReceivedYear = 20013
            };
            SelfReportedLoanModel failingValueNegative = new SelfReportedLoanModel()
            {
                ReceivedYear = -2013
            };


            RegularExpressionAttribute regexCheck = new RegularExpressionAttribute(@"^(19|20)\d{2}$");


            Assert.IsTrue(regexCheck.IsValid(passingValueLowerBound.ReceivedYear), "Assertion of positive case lower bound being true failed");
            Assert.IsTrue(regexCheck.IsValid(passingValueUpperBound.ReceivedYear), "Assertion of positive case upper bound  being true failed");
            Assert.IsFalse(regexCheck.IsValid(failingValueYearTooLow.ReceivedYear), "Assertion of negative case lower bound  being true failed");
            Assert.IsFalse(regexCheck.IsValid(failingValueYearTooHigh.ReceivedYear), "Assertion of negative case upper bound  being true failed");
            Assert.IsFalse(regexCheck.IsValid(failingValueNull.ReceivedYear), "Assertion of negative case null case being false failed");
            Assert.IsFalse(regexCheck.IsValid(failingValueImproperNumberOfDigitsTooFew.ReceivedYear), "Assertion of negative case too few digits case being false failed");
            Assert.IsFalse(regexCheck.IsValid(failingValueImproperNumberOfDigitsTooMany.ReceivedYear), "Assertion of negative case to many digits case being false failed");
            Assert.IsFalse(regexCheck.IsValid(failingValueNegative.ReceivedYear), "Assertion of negative case (negative year) case being false failed");
        }
Exemplo n.º 17
0
        public void PrincipalBalanceOutstandingAmountTest_SelfReportedLoanModel_check_for_required()
        {
            SelfReportedLoanModel passingValue = new SelfReportedLoanModel()
            {
                PrincipalBalanceOutstandingAmount = 0.0m
            };
            SelfReportedLoanModel failingValueNull = new SelfReportedLoanModel()
            {
            };


            RequiredAttribute requiredCheck = new RequiredAttribute();


            Assert.IsTrue(requiredCheck.IsValid(passingValue.PrincipalBalanceOutstandingAmount), "Assertion of positive case being true failed");
            Assert.IsFalse(requiredCheck.IsValid(failingValueNull.PrincipalBalanceOutstandingAmount), "Assertion of negative case (null) case being false failed");
        }
Exemplo n.º 18
0
        public void InterestRateTest_SelfReportedLoanModel_check_for_required()
        {
            SelfReportedLoanModel passingValue = new SelfReportedLoanModel()
            {
                InterestRate = 50
            };
            SelfReportedLoanModel failingValueNull = new SelfReportedLoanModel()
            {
                InterestRate = null
            };


            RequiredAttribute requiredCheck = new RequiredAttribute();


            Assert.IsTrue(requiredCheck.IsValid(passingValue.InterestRate), "Assertion of positive case being true failed");
            Assert.IsFalse(requiredCheck.IsValid(failingValueNull.InterestRate), "Assertion of negative case (null) being false failed");
        }
Exemplo n.º 19
0
        public ResultCodeModel UpdateSelfReportedLoan(SelfReportedLoanModel srLoan)
        {
            ResultCodeModel result = new ResultCodeModel();

            if (srLoan == null)
            {
                _log.Info("Null SelfReportedLoan object in ASA.Web.Services.SelfReportedService.SelfReportedAdapter.UpdateSelfReportedLoan.");
            }
            else
            {
                // UPDATE
                //xWebWrapper xWeb = new xWebWrapper();
                //XmlNode node = TranslateSelfReportedModel.MapSelfReportedLoanToXmlNode(srLoan);
                //node = xWeb.UpdateFacadeObject("ASASelfReportedLoan", srLoan.LoanSelfReportedEntryId, node);
                //result = TranslateSelfReportedModel.MapXmlNodeToResultCodeModel(node);
            }

            return(result);
        }
Exemplo n.º 20
0
        private SelfReportedLoanModel GetValidSelfReportedLoanData()
        {
            SelfReportedLoanModel srlModel = new SelfReportedLoanModel();

            //srlModel.AccountNickname = "Test Account";
            //srlModel.HolderName = "Test Holder";
            srlModel.InterestRate            = 6.2;
            srlModel.LoanSelfReportedEntryId = "1";
            srlModel.LoanStatusId            = "DF";
            srlModel.LoanTypeId = "SF";
            //srlModel.NextPaymentDueAmount = 200.02M;
            //srlModel.NextPaymentDueDate = DateTime.Now;
            //srlModel.PaymentDueAmount = 100.02M;
            srlModel.PrincipalBalanceOutstandingAmount = 20000.00M;
            //srlModel.SchoolName = "Test School";
            //srlModel.ServicerName = "Test Servicer";
            //srlModel.ServicerWebAddress = "http://test.servicer.web.address.com";

            return(srlModel);
        }
Exemplo n.º 21
0
        public void LoanTypeIdTest_SelfReportedLoanModel_check_for_required()
        {
            SelfReportedLoanModel passingValue = new SelfReportedLoanModel()
            {
                LoanTypeId = "Non- null string for required check"
            };
            SelfReportedLoanModel failingValueEmptyString = new SelfReportedLoanModel()
            {
                LoanTypeId = ""
            };
            SelfReportedLoanModel failingValueNull = new SelfReportedLoanModel()
            {
            };


            RequiredAttribute requiredCheck = new RequiredAttribute();


            Assert.IsTrue(requiredCheck.IsValid(passingValue.LoanTypeId), "Assertion of positive case being true failed");
            Assert.IsFalse(requiredCheck.IsValid(failingValueEmptyString.LoanTypeId), "Assertion of negative case (empty string) case being false failed");
            Assert.IsFalse(requiredCheck.IsValid(failingValueNull.LoanTypeId), "Assertion of negative case (null) being false failed");
        }
Exemplo n.º 22
0
        public void LoanSelfReportedEntryIdTest_SelfReportedLoanModel_check_for_regex()
        {
            SelfReportedLoanModel passingValue = new SelfReportedLoanModel()
            {
                LoanSelfReportedEntryId = "B93F10EB-2BC0-47A2-B5C5-082A064E3099"
            };
            SelfReportedLoanModel failingValueImproperNumberOfDigits = new SelfReportedLoanModel()
            {
                LoanSelfReportedEntryId = "B93F10EB-2BC0-47A2-B5C5-082A064E309"
            };
            SelfReportedLoanModel failingValueImproperDigits = new SelfReportedLoanModel()
            {
                LoanSelfReportedEntryId = "!!3F10EB-2BC0-47A2-B5C5-082A064E309"
            };

            RegularExpressionAttribute regexCheck = new RegularExpressionAttribute(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$");


            Assert.IsTrue(regexCheck.IsValid(passingValue.LoanSelfReportedEntryId), "Assertion of positive case being true failed");
            Assert.IsFalse(regexCheck.IsValid(failingValueImproperNumberOfDigits.LoanSelfReportedEntryId), "Assertion of negative case (improper # of digits) case being false failed");
            Assert.IsFalse(regexCheck.IsValid(failingValueImproperDigits.LoanSelfReportedEntryId), "Assertion of negative case (improper characters) being false failed");
        }
Exemplo n.º 23
0
 /// <summary>
 /// To the member reported loan contract.
 /// </summary>
 /// <param name="loan">The loan.</param>
 /// <returns></returns>
 public static MemberReportedLoanContract ToMemberReportedLoanContract(this SelfReportedLoanModel loan)
 {
     return(new MemberReportedLoanContract
     {
         LoanType = loan.LoanTypeId,
         LoanStatus = loan.LoanStatusId,
         PrincipalOutstandingAmount = loan.PrincipalBalanceOutstandingAmount,
         MemberId = new AsaMemberAdapter().GetMemberIdFromContext(),
         InterestRate = loan.InterestRate.HasValue?Convert.ToDecimal(loan.InterestRate):null as decimal?,
         ReceivedYear = loan.ReceivedYear,
         OriginalLoanAmount = loan.OriginalLoanAmount,
         MemberReportedLoanId = loan.LoanSelfReportedEntryId == null || string.IsNullOrEmpty(loan.LoanSelfReportedEntryId) ? 0 : Int32.Parse(loan.LoanSelfReportedEntryId),
         LoanTerm = loan.LoanTerm,
         RecordSourceId = loan.RecordSourceId,
         InterestRateType = loan.InterestRateType,
         LoanName = loan.LoanName,
         OriginalLoanDate = loan.OriginalLoanDate,
         MonthlyPaymentAmount = loan.MonthlyPaymentAmount,
         ServicingOrganizationName = loan.ServicingOrganizationName,
         ModifiedDate = DateTime.Now
     });
 }
Exemplo n.º 24
0
        public static XElement MapSelfReportedLoanToXElement(SelfReportedLoanModel srLoan)
        {
            XElement elem = new XElement("ASASelfReportedLoanObject");

            string[] fieldNames = xWebSelfReportedLoanHelper.GetFieldNames();
            object[] objArr     = new object[fieldNames.Length];

            objArr[0] = new XElement("a07_key", srLoan.LoanSelfReportedEntryId);
            objArr[1] = new XElement("a07_ind_cst_key", srLoan.IndividualId);

            objArr[2]  = new XElement("a07_loan_type", srLoan.LoanTypeId);
            objArr[3]  = new XElement("a07_loan_status", srLoan.LoanStatusId);
            objArr[4]  = new XElement("a07_account_nickname", srLoan.AccountNickname);
            objArr[5]  = new XElement("a07_holder_name", srLoan.HolderName);
            objArr[6]  = new XElement("a07_school_name", srLoan.SchoolName);
            objArr[7]  = new XElement("a07_servicer_name", srLoan.ServicerName);
            objArr[8]  = new XElement("a07_servicer_url", srLoan.ServicerWebAddress);
            objArr[9]  = new XElement("a07_principal_balance_outstanding_amount", srLoan.PrincipalBalanceOutstandingAmount);
            objArr[10] = new XElement("a07_payment_due_amount", srLoan.PaymentDueAmount);
            objArr[11] = new XElement("a07_next_payment_due_amount", srLoan.NextPaymentDueAmount);
            objArr[12] = new XElement("a07_next_payment_due_date", srLoan.NextPaymentDueDate);
            if (srLoan.IsActive)
            {
                objArr[13] = new XElement("a07_active_flag", 1);
            }
            else
            {
                objArr[13] = new XElement("a07_active_flag", 0);
            }
            objArr[14] = new XElement("a07_interest_rate", srLoan.InterestRate);
            objArr[15] = new XElement("a07_received_year", srLoan.ReceivedYear);
            objArr[16] = new XElement("a07_original_loan_amount", srLoan.OriginalLoanAmount);
            objArr[17] = new XElement("a07_loan_term", srLoan.LoanTerm);
            //objArr[18] = new XElement("a07_delete_flag", srLoan.);
            objArr[18] = new XElement("a07_loan_record_source", srLoan.LoanSource);
            elem.Add(objArr);

            return(elem);
        }
Exemplo n.º 25
0
        private SelfReportedLoanModel GetValidSelfReportedLoanData()
        {
            SelfReportedLoanModel srlModel = new SelfReportedLoanModel();

            //srlModel.AccountNickname = "TEST Account";
            //srlModel.HolderName = "TEST Holder";
            srlModel.InterestRate            = 6.2;
            srlModel.LoanSelfReportedEntryId = "";
            srlModel.LoanStatusId            = "DF";
            srlModel.LoanTypeId = "SF";
            //srlModel.NextPaymentDueAmount = 200.02M;
            //srlModel.NextPaymentDueDate = DateTime.Now;
            //srlModel.PaymentDueAmount = 100.02M;
            srlModel.PrincipalBalanceOutstandingAmount = 20000.00M;
            //srlModel.SchoolName = "TEST School";
            srlModel.OriginalLoanAmount = 5000.00M;
            srlModel.LoanTerm           = 50;
            //srlModel.ServicerName = "TEST Servicer";
            //srlModel.ServicerWebAddress = "http://test.servicer.web.address.com";
            srlModel.IndividualId = "01A9606D-DE45-4790-BC6F-C58B041A45A6";

            return(srlModel);
        }
Exemplo n.º 26
0
        public ResultCodeModel SaveSelfReportedLoan(SelfReportedLoanModel srl)
        {
            ResultCodeModel result = new ResultCodeModel();

            if (srl != null)
            {
                if (!IsNewSRL(srl)) //QC 4712: check that SRL belongs to person logged in
                {
                    if (IsSRLForPersonLoggedIn(srl.LoanSelfReportedEntryId))
                    {
                        result = this.UpdateSelfReportedLoan(srl); //UpdateFacadeObject
                    }
                    else
                    {
                        result.ErrorList.Add(new ErrorModel("There was a problem saving Self Reported Loan information."));
                    }
                }
                else
                {
                    result = this.InsertSelfReportedLoan(srl); //InsertFacadeObject
                }
            }
            return(result);
        }
Exemplo n.º 27
0
 public ResultCodeModel SaveSelfReportedLoan(SelfReportedLoanModel srLoan)
 {
     return(MockJsonLoader.GetJsonObjectFromFile <ResultCodeModel>("SelfReportedService", "SelfReportedLoan"));
 }
Exemplo n.º 28
0
        public static SelfReportedLoanListModel MapXmlNodeToSelfReportedLoanList(XmlNode node)
        {
            SelfReportedLoanListModel srList = new SelfReportedLoanListModel();

            if (node != null)
            {
                foreach (XmlNode n in node.ChildNodes) //foreach SRL returned
                {
                    SelfReportedLoanModel srl = new SelfReportedLoanModel();

                    foreach (XmlNode field in n.ChildNodes)//map the fields
                    {
                        if (field.InnerText != null && field.InnerText.Length > 0)
                        {
                            try
                            {
                                switch (field.Name)
                                {
                                case "a07_key":
                                    srl.LoanSelfReportedEntryId = field.InnerText;
                                    break;

                                case "a07_ind_cst_key":
                                    srl.IndividualId = field.InnerText;
                                    break;

                                case "a07_loan_type":
                                    srl.LoanTypeId = field.InnerText;
                                    break;

                                case "a07_loan_status":
                                    srl.LoanStatusId = field.InnerText;
                                    break;

                                case "a07_account_nickname":
                                    srl.AccountNickname = field.InnerText;
                                    break;

                                case "a07_holder_name":
                                    srl.HolderName = field.InnerText;
                                    break;

                                case "a07_school_name":
                                    srl.SchoolName = field.InnerText;
                                    break;

                                case "a07_servicer_name":
                                    srl.ServicerName = field.InnerText;
                                    break;

                                case "a07_servicer_url":
                                    srl.ServicerWebAddress = field.InnerText;
                                    break;

                                case "a07_principal_balance_outstanding_amount":
                                    srl.PrincipalBalanceOutstandingAmount = Decimal.Parse(field.InnerText);
                                    break;

                                case "a07_payment_due_amount":
                                    srl.PaymentDueAmount = Decimal.Parse(field.InnerText);
                                    break;

                                case "a07_next_payment_due_amount":
                                    srl.NextPaymentDueAmount = Decimal.Parse(field.InnerText);
                                    break;

                                case "a07_next_payment_due_date":
                                    srl.NextPaymentDueDate = DateTime.Parse(field.InnerText);
                                    break;

                                case "a07_active_flag":
                                    int active = Int32.Parse(field.InnerText);
                                    if (active == 1)
                                    {
                                        srl.IsActive = true;
                                    }
                                    else
                                    {
                                        srl.IsActive = false;
                                    }
                                    break;

                                case "a07_interest_rate":
                                    srl.InterestRate = Double.Parse(field.InnerText);
                                    break;

                                case "a07_received_year":
                                    srl.ReceivedYear = Int32.Parse(field.InnerText);
                                    break;

                                case "a07_original_loan_amount":
                                    srl.OriginalLoanAmount = Decimal.Parse(field.InnerText);
                                    break;

                                case "a07_loan_record_source":
                                    srl.LoanSource = field.InnerText;
                                    break;

                                case "a07_loan_term":
                                    srl.LoanTerm = Int32.Parse(field.InnerText);
                                    break;

                                case "a07_add_date":
                                    srl.DateAdded = DateTime.Parse(field.InnerText);
                                    break;

                                default:
                                    break;
                                } //switch
                            }     //try
                            catch (Exception e)
                            {
                                //something went wrong?
                            }
                        } //if
                    }     //for

                    srList.Loans.Add(srl);
                } //for
            }     //if
            else
            {
                srList.ErrorList.Add(new ErrorModel("Problem querying Avectra. Make sure your search criteria was valid."));
            }

            return(srList);
        }
Exemplo n.º 29
0
        public static SelfReportedLoanListModel MapGetResponseToModel(GetLoanResponse response, string individualId)
        {
            _log.Debug("START MapGetResponseToModel");
            SelfReportedLoanListModel loanList = new SelfReportedLoanListModel();

            if (response != null)
            {
                if (response.LoanCanonical != null && response.LoanCanonical.Length > 0)
                {
                    for (int i = 0; i < response.LoanCanonical.Length; i++)
                    {
                        _log.Debug("mapping info for ODS Loan with LoanId = " + response.LoanCanonical[i].LoanTier2.LoanInfoType.LoanId);
                        LoanTier2Type tier2 = response.LoanCanonical[i].LoanTier2;
                        //QC 3926: Should only be showing the users loans where "IsArchived" = 'N', and InputSourceId like '%DER%'.
                        if (tier2.LoanInfoType.IsArchived == ASA.Web.Services.LoanService.Proxy.LoanManagement.YNFlagType.N &&
                            tier2.LoanInfoType.InputSourceId != null &&
                            tier2.LoanInfoType.InputSourceId.ToUpper().Contains("DER")
                            )
                        {
                            SelfReportedLoanModel srModel = new SelfReportedLoanModel();
                            srModel.IndividualId    = individualId;
                            srModel.AccountNickname = ""; // "Imported Loan " + i;     // INFO NOT AVAILALBE ON LOAN. Can be provided by borrower in UI.
                            srModel.HolderName      = GetDepartmentName(tier2.OrganizationArray, "HOLD");
                            //QC 3922:  Interest rate is a fraction of 1 in ODS, and needs to display as a whole number in SALT.
                            //  Hence, we've added the multiply by 100 here.
                            if (tier2.LoanInfoType.InterestRate != null)
                            {
                                srModel.InterestRate = Math.Round((double)(tier2.LoanInfoType.InterestRate * 100), 3, MidpointRounding.AwayFromZero);
                            }
                            srModel.OriginalLoanAmount                = tier2.LoanInfoType.ApprovedLoanAmount; //TODO: is this correct mapping?
                            srModel.IsActive                          = true;
                            srModel.LoanSelfReportedEntryId           = "";                                    //note: cant give it a PK here... must treat all of these as if they are unsaved SRLE's.
                            srModel.LoanStatusId                      = tier2.LoanInfoType.LoanStatusId;
                            srModel.LoanTypeId                        = tier2.LoanInfoType.LoanTypeId;
                            srModel.NextPaymentDueAmount              = tier2.RepaymentInfoType.NextPaymentDueAmount;
                            srModel.NextPaymentDueDate                = tier2.RepaymentInfoType.NextPaymentDueDate;
                            srModel.PaymentDueAmount                  = tier2.RepaymentInfoType.NextPaymentDueAmount;
                            srModel.PrincipalBalanceOutstandingAmount = tier2.LoanInfoType.OutstandingPrincipalBalance;
                            srModel.SchoolName                        = GetDepartmentName(tier2.OrganizationArray, "SCHL");
                            srModel.ServicerName                      = GetDepartmentName(tier2.OrganizationArray, "SERV");
                            srModel.ServicerWebAddress                = ""; //is there something I don't know about that can provide this info??
                            srModel.LoanTerm                          = 10; //defaulting to 10 for now.  Will likely get more requirements for future releases.

                            loanList.Loans.Add(srModel);
                        }
                    }
                }
                else if (response.ResponseMessageList != null && response.ResponseMessageList.Count > 0)
                {
                    for (int i = 0; i < response.ResponseMessageList.Count; i++)
                    {
                        _log.Info("ResponseMessageList[" + i + "].MessageDetails = " + response.ResponseMessageList[i].MessageDetails);
                        ErrorModel error = new ErrorModel(response.ResponseMessageList[i].MessageDetails, "Web Loan Service", response.ResponseMessageList[i].ResponseCode);
                        loanList.ErrorList.Add(error);
                    }
                }
                else
                {
                    _log.Warn("An error occured in MapGetResponseToModel when trying to retrieve loan information. Canonical not found.");
                    ErrorModel error = new ErrorModel("An error occured when trying to retrieve loan information", "Web Loan Service");
                    loanList.ErrorList.Add(error);
                }
            }
            else
            {
                ErrorModel error = new ErrorModel("No valid response was received from the Loan Management service", "Web Loan Service");
                loanList.ErrorList.Add(error);
            }
            _log.Debug("END MapGetResponseToModel");
            return(loanList);
        }