private VerificationRequest BuildRequest(string accountCode, string auditCode, string leadId, IEnumerable<FieldInfo> leadFields)
        {
            var request = new VerificationRequest
            {
                Lac = accountCode,
                Vid = auditCode,
                UniversalLeadIDToken = leadId
            };
            var requestType = request.GetType();

            _fslpMapper.Get().ToList().ForEach(x =>
            {
                var field = leadFields.FirstOrDefault(lf => lf.Name == x.SourceColumn);
                if (field == null)
                {
                    throw new InvalidOperationException(string.Format("Required field '{0}' for the verification process was not present at the request", x));
                }

                var prop = requestType.GetProperty(x.SourceColumn);
                if (prop == null)
                {
                    throw new InvalidOperationException(string.Format("Required field '{0}' for the verification process was not present at the request data type on the service", x));
                }

                prop.SetValue(request, field.Value, null);
            });

            return request;
        }
Exemple #2
0
        private string BuildRequest(VerificationRequest request)
        {
            var allFields = from x in request.GetType().GetProperties()
                            join y in _requestMapper.Get() on x.Name.ToLower() equals y.SourceColumn.ToLower()
                            select string.Format(DataMappingFormat, y.TargetColumn, x.GetValue(request));
            var builder = new StringBuilder();

            allFields.ToList().ForEach(x => builder.Append(x));

            return string.Format(ServiceUrl, request.Lac, request.UniversalLeadIDToken, request.Vid, request.Lpc, builder.Remove(builder.Length - 1, 1).ToString());
        }