Exemple #1
0
        //-----------------------------------------------------------------------------------
        public AccountVerificationResults AccountVerificationForcedWithCustomAddress(string foreName, string middleName, string surname,
                                                                                     string gender, DateTime birth,
                                                                                     string houseNumber, string houseName, string street, string district,
                                                                                     string town, string county, string postCode,
                                                                                     string branchCode, string accountNumber, int customerId, string xmlForDebug = "")
        {
            var result = new AccountVerificationResults();

            var key = String.Format("{0}_{1}", branchCode, accountNumber);

            var address = new AddressType
            {
                AddressStatus = AddressStatusType.Current,
                TypeOfAddress = TypeOfAddressType.UK,
                AddressDetail = new AddressDetailType
                {
                    PostCode    = postCode,
                    HouseNumber = houseNumber,
                    HouseName   = houseName,
                    Address1    = street,
                    Address2    = district,
                    Address3    = town,
                    Address4    = county,
                    Country     = "GB"
                }
            };
            //BWA
            var execRequestBwa = new ExecuteRequestType
            {
                EIHHeader = new EIHHeaderType
                {
                    ClientUser  = "******",
                    ReferenceId = "1234"
                },
                ResponseType           = ResponseType.Detail,
                ProcessConfigReference = new ProcessConfigReferenceType {
                    ItemElementName = ItemChoiceType.ProcessConfigName, Item = "BWA"
                },
                Consent      = ConsentType.Yes,
                PersonalData = new PersonalDataType
                {
                    Name = new NameType
                    {
                        Forename   = foreName,
                        Surname    = surname,
                        MiddleName = middleName
                    },
                    BirthDate          = birth,
                    BirthDateSpecified = true,
                    GenderSpecified    = true
                },
                Addresses       = new[] { address },
                BankInformation = new BankInformationType
                {
                    CheckContext          = CheckContextType.DirectCredit,
                    CheckContextSpecified = true,
                    AccountReference      = new[]
                    {
                        new AccountReferenceType {
                            TypeOfReference = TypeOfReferenceType.BankBranchCode, Reference = branchCode, ReferenceIndex = "1"
                        },
                        new AccountReferenceType {
                            TypeOfReference = TypeOfReferenceType.AccountNumber, Reference = accountNumber, ReferenceIndex = "2"
                        }
                    }
                }
            };

            execRequestBwa.PersonalData.Gender = gender == "M" ? GenderType.Male : GenderType.Female;

            try
            {
                ProcessConfigResponseType r;
                if (string.IsNullOrEmpty(xmlForDebug))
                {
                    try
                    {
                        r = MakeRequest(execRequestBwa);
                    }
                    catch (AuthenticationException exception)
                    {
                        result.Error = exception.Message;
                        return(result);
                    }
                }
                else
                {
                    r = GetRequestFromXml(xmlForDebug);
                }

                var writeLog = Utils.WriteLog(execRequestBwa, r, ExperianServiceType.Bwa, customerId);
                _bankCacheRepository.Set(key, r, writeLog.ServiceLog);

                result.Parse(r);
            }
            catch (Exception exception)
            {
                Log.Error(exception);
                result.Error = exception.Message;
                Utils.WriteLog(execRequestBwa, string.Format("Excecption: {0}", exception.Message), ExperianServiceType.Bwa, customerId);
            }

            return(result);
        }
Exemple #2
0
        //-----------------------------------------------------------------------------------
        public AuthenticationResults AuthenticateForcedWithCustomAddress(string foreName, string middleName, string surname, string gender, DateTime birth,
                                                                         string houseNumber, string houseName, string street, string district,
                                                                         string town, string county, string postCode, int customerId, string xmlForDebug = "")
        {
            var result = new AuthenticationResults();

            string key = string.Format("{0}_{1}_{2}_{3}", foreName, middleName, surname, postCode);

            Log.DebugFormat("Request AML A service for key '{0}'", key);
            var address = new AddressType
            {
                AddressStatus = AddressStatusType.Current,
                TypeOfAddress = TypeOfAddressType.UK,
                AddressDetail = new AddressDetailType
                {
                    PostCode    = postCode,
                    HouseNumber = houseNumber,
                    HouseName   = houseName,
                    Address1    = street,
                    Address2    = district,
                    Address3    = town,
                    Address4    = county,
                    Country     = "GB"
                }
            };

            //AML A
            var execRequest = new ExecuteRequestType
            {
                EIHHeader = new EIHHeaderType
                {
                    ClientUser  = "******",
                    ReferenceId = "1234"
                },
                ResponseType           = ResponseType.Detail,
                ProcessConfigReference = new ProcessConfigReferenceType {
                    ItemElementName = ItemChoiceType.ProcessConfigName, Item = "AML A"
                },
                Consent      = ConsentType.Yes,
                PersonalData = new PersonalDataType
                {
                    Name = new NameType
                    {
                        Forename   = foreName,
                        MiddleName = middleName,
                        Surname    = surname
                    },
                    BirthDate          = birth,
                    BirthDateSpecified = true,
                    GenderSpecified    = true
                },
                Addresses = new[] { address }
            };

            execRequest.PersonalData.Gender = gender == "M" ? GenderType.Male : GenderType.Female;

            bool hadException           = false;
            ProcessConfigResponseType r = null;

            try
            {
                if (string.IsNullOrEmpty(xmlForDebug))
                {
                    try
                    {
                        r = MakeRequest(execRequest);
                    }
                    catch (AuthenticationException exception)
                    {
                        result.Error = exception.Message;
                        return(result);
                    }
                }
                else
                {
                    r = GetRequestFromXml(xmlForDebug);
                }
            }
            catch (Exception exception)
            {
                hadException = true;
                Log.Error(exception);
                result.Error = exception.Message;
            }

            try
            {
                if (hadException)
                {
                    Utils.WriteLog(execRequest, string.Format("Excecption: {0}", result.Error), ExperianServiceType.Aml, customerId);
                }
                else
                {
                    var writelog = Utils.WriteLog(execRequest, r, ExperianServiceType.Aml, customerId);

                    result.Parse(r);

                    SaveAmlData(key, writelog.ServiceLog.Id, writelog.ServiceLog.InsertDate, result);
                }
            }
            catch (Exception e)
            {
                Log.ErrorFormat("Exception while saving aml data: {0}", e);
            }

            return(result);
        }