public void CheckPrivacyFormatting()
        {
            var stringToTest     = "Hello";
            var expectedResponse = "Hxxxx";
            var value            = PrivacyFormatting.GetPrivacyString(stringToTest);

            value.Should().Equals(expectedResponse);
        }
Example #2
0
        public static RentAccountResponse ToRentAccountResponse(string paymentReference, CrmRentAccountResponse crmResponse, bool privacy)
        {
            var firstname           = privacy ? PrivacyFormatting.GetPrivacyString(crmResponse.value[0].contact1_x002e_firstname) : crmResponse.value[0].contact1_x002e_firstname;
            var lastname            = privacy ? PrivacyFormatting.GetPrivacyString(crmResponse.value[0].contact1_x002e_lastname) : crmResponse.value[0].contact1_x002e_lastname;
            var fullname            = $"{firstname} {lastname}";
            var currentBalance      = decimal.Parse(crmResponse.value[0].housing_cur_bal);
            var toPay               = decimal.Parse(crmResponse.value[0].housing_rent) - decimal.Parse(crmResponse.value[0].housing_anticipated);
            var rentAccountResponse = new RentAccountResponse
            {
                AccountNumber        = paymentReference,
                Name                 = fullname,
                CurrentBalance       = currentBalance > 0 ? currentBalance : currentBalance * -1,
                Rent                 = decimal.Parse(crmResponse.value[0].housing_rent),
                ToPay                = toPay < 0 ? 0 : toPay,
                Benefits             = decimal.Parse(crmResponse.value[0].housing_anticipated),
                HasArrears           = decimal.Parse(crmResponse.value[0].housing_cur_bal) > 0,
                IsHackneyResponsible = bool.Parse(crmResponse.value[0].contact1_x002e_hackney_responsible),
                NextPayment          = GetNextMondayFormatted(),
                Postcode             = crmResponse.value[0].contact1_x002e_address1_postalcode,
                TenancyAgreementId   = crmResponse.value[0].housing_tag_ref
            };

            return(rentAccountResponse);
        }