Example #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);
        }
Example #2
0
        //-----------------------------------------------------------------------------------
        public AccountVerificationResults AccountVerification(string foreName, string middleName, string surname, string gender, DateTime birth, string addressLine1, string addressLine2, string addressLine3, string town, string county, string postCode, string branchCode, string accountNumber, int customerId, bool checkInCacheOnly = false, string xmlForDebug = "")
        {
            var result = new AccountVerificationResults();

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

            Log.DebugFormat("Checking key '{0}' in cache...", key);
            var cachedValue = _bankCacheRepository.Get <ProcessConfigResponseType>(key, null);

            if (cachedValue != null && string.IsNullOrEmpty(xmlForDebug))
            {
                Log.DebugFormat("Will use cache value for key '{0}'", key);
                result.Parse(cachedValue);
                return(result);
            }
            if (checkInCacheOnly)
            {
                return(null);
            }

            var address = FillAddress(addressLine1, addressLine2, addressLine3, town, county, postCode);
            //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);
        }