コード例 #1
0
        public bool TenantIdentify(ApplicationSummary applicationSummary, Campaign @event)
        {
            //var identityLogic = _identityLogicFactory.GetIdentityLogicByType();
            //var result = identityLogic.Execute(applicationSummary, @event);

            return false;
        }
コード例 #2
0
        public static SubscriberRecord BuildTenantSubscriber(ApplicationSummary summary, Campaign campaign)
        {
            var tenant = summary.Customers.FirstOrDefault(c => EnumHelper<RoleType>.Parse(c.RoleType) == RoleType.MasterTenant);
            if (tenant == null)
                return null;

            var subscriberRecord = new SubscriberRecord
            {
                ApplicationReference = summary.ApplicationReference,
                CustomerReference = tenant.CustomerReference,
                SubscriberEmail = tenant.Email,
                SubscriberTelephoneNumber = tenant.TelephoneNumber,
                SegmentType = campaign.SegmentType,
                EventType = campaign.Type
            };

            return subscriberRecord;
        }
コード例 #3
0
        public static EmailContent NewProperty(ApplicationSummary applicationSummary)
        {
            var emailContent = new EmailContent();
            var tenant =
                applicationSummary.Customers.FirstOrDefault(
                    s => EnumHelper<RoleType>.Parse(s.RoleType) == RoleType.MasterTenant);

            emailContent.ApplicationReference = applicationSummary.ApplicationReference;
            emailContent.TenantTelephoneNumber = tenant.TelephoneNumber;
            emailContent.ShortUrls = new List<ShortUrl>();
            emailContent.ShortUrls.AddRange(applicationSummary.ShortUrls);
            emailContent.TenantEmailAddress = tenant.Email;
            emailContent.TenantFirstName = string.IsNullOrEmpty(tenant.KnownAs)
                ? NameHelper.Capitalize(tenant.GivenName)
                : NameHelper.Capitalize(tenant.KnownAs);
            emailContent.PropertyReference = applicationSummary.PropertyReference;

            return emailContent;
        }
        public static List<ApplicationSummary> Map(List<Application> applications)
        {
            var applicationSummaries = new List<ApplicationSummary>();

            foreach (var application in applications)
            {
                if(application == null)
                    continue;
                var applicationSummary = new ApplicationSummary();
                applicationSummary.ApplicationReference = application.ApplicationReference;
                applicationSummary.ApplicationStatus = application.Status;
                applicationSummary.PipelinePosition = application.PipelinePosition;
                applicationSummary.Customers = new List<Customer>();
                applicationSummary.Requirements = new List<Requirement>();
                applicationSummary.ShortUrls = new List<ShortUrl>();

                applicationSummaries.Add(applicationSummary);
            }
            return applicationSummaries;
        }
        public static List<ApplicationSummary> MapList(List<Models.ApplicationSummary> model)
        {
            var coreApplications = new List<ApplicationSummary>();

            foreach (var application in model)
            {
                if (application.Customers == null)
                    continue;

                var coreApp = new ApplicationSummary
                {
                    ApplicationReference = application.ApplicationReference,
                    ApplicationStatus = EnumHelper<Status>.Parse(application.ApplicationStatus),
                    PipelinePosition = EnumHelper<PipelinePosition>.Parse(application.PipelinePosition),
                    Customers = new List<Customer>(),
                    Requirements = new List<Requirement>(),
                    ShortUrls = new List<ShortUrl>()
                };

                foreach (var customer in application.Customers)
                {
                    var ct = new Customer
                    {
                        CustomerReference = customer.CustomerReference,
                        RoleType = customer.RoleType,
                        DateOfBirth = DateTime.Parse(customer.DateOfBirth),
                        Title = customer.Title,
                        GivenName = customer.GivenName,
                        AdditionalName = customer.AdditionalName,
                        AgreesToBeCreditChecked = customer.AgreesToBeCreditChecked,
                        AvailableNextStatuses = new List<string>(),
                        FamilyName = customer.FamilyName,
                        Gender = customer.Gender,
                        IsOptedIntoEmailMarketing = customer.IsOptedIntoEmailMarketing,
                        IsOptedIntoPhoneMarketing = customer.IsOptedIntoPhoneMarketing,
                        Email = customer.Email,
                        TelephoneNumber = customer.TelephoneNumber,
                        Status = customer.Status
                    };

                    coreApp.Customers.Add(ct);
                }

                foreach (var requirement in application.Requirements)
                {
                    coreApp.Requirements.Add(new Requirement
                    {
                        RequirementType = EnumHelper<RequirementType>.Parse(requirement.RequirementType),
                        Value = requirement.Value
                    });
                }

                if (application.ShortUrls != null)
                {
                    foreach (var shortUrl in application.ShortUrls)
                    {
                        coreApp.ShortUrls.Add(new ShortUrl
                        {
                            Type = EnumHelper<ShortUrlType>.Parse(shortUrl.Type),
                            Value = shortUrl.Value
                        });
                    }
                }

                coreApplications.Add(coreApp);
            }

            return coreApplications;
        }
コード例 #6
0
        private ApplicationSummary GenerateApplication()
        {
            var random = new Random();
            var givenName = Faker.NameFaker.FirstName();
            var email = $"foo{Guid.NewGuid()}@bar.com";

            var application = new ApplicationSummary
            {
                ApplicationReference = Faker.StringFaker.AlphaNumeric(12),
                ApplicationStatus = Status.ApplicantComplete,
                ShortUrls = new List<ShortUrl>
                {
                    new ShortUrl
                    {
                        Type = ShortUrlType.GuarantorRegistration,
                        Value = Faker.InternetFaker.Url()
                    }
                },
                
                Customers = new List<Customer>
                {
                    new Customer
                    {
                        Email = email,
                        GivenName = Faker.NameFaker.FirstName(),
                        FamilyName = Faker.NameFaker.LastName(),
                        KnownAs = givenName,
                        TelephoneNumber = "+447889309035",
                        RoleType = RoleType.MasterTenant.ToString()
                    }
                },
                Requirements = new List<Requirement>
                {
                    new Requirement
                    {
                        RequirementType = RequirementType.PriceFrom,
                        Value = "400"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.PriceTo,
                        Value = "900"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.Area,
                        Value = "BH"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.Floor,
                        Value = "1"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.Furnished,
                        Value = "True"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.Garden,
                        Value = "True"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.Parking,
                        Value = "False"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.PetFriendly,
                        Value = "False"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.WhiteGoods,
                        Value = "True"
                    }
                }
            };

            return application;
        }
コード例 #7
0
        private ApplicationSummary GenerateFixedApplication()
        {
            var random = new Random();
            var givenName = Faker.NameFaker.FirstName();
            var email = "*****@*****.**";

            var application = new ApplicationSummary
            {
                ApplicationReference = "A-n35Nf9l34",
                ApplicationStatus = Status.Approved,
                ShortUrls = new List<ShortUrl>
                {
                    new ShortUrl
                    {
                        Type = ShortUrlType.GuarantorRegistration,
                        Value = "http://wwww.google.com"
                    }
                },

                Customers = new List<Customer>
                {
                    new Customer
                    {
                        Email = email,
                        GivenName = "Julian",
                        FamilyName = "Inwood",
                        KnownAs = "Julian",
                        TelephoneNumber = "+447889309035",
                        RoleType = RoleType.MasterTenant.ToString()
                    },
                    new Customer
                    {
                        Email = "*****@*****.**",
                        GivenName = "Jon",
                        FamilyName = "Tansey",
                        KnownAs = "Jon",
                        TelephoneNumber = "+447889309035",
                        RoleType = RoleType.Guarantor.ToString()
                    }
                },
                Requirements = new List<Requirement>
                {
                    new Requirement
                    {
                        RequirementType = RequirementType.PriceFrom,
                        Value = "400"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.PriceTo,
                        Value = "900"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.Area,
                        Value = "BH"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.Floor,
                        Value = "1"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.Furnished,
                        Value = "True"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.Garden,
                        Value = "True"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.Parking,
                        Value = "False"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.PetFriendly,
                        Value = "False"
                    },
                    new Requirement
                    {
                        RequirementType = RequirementType.WhiteGoods,
                        Value = "True"
                    }
                }
            };

            return application;
        }