public static void TrySuccessor(this IRequestAccountHandler current, BankAccountBenefits accountBenefits) { if (current.Successor != null) { Console.WriteLine("Can't approve - Passing request to {0}", typeof(IRequestAccountHandler)); current.Successor.ProcessRequest(accountBenefits); } else { Console.WriteLine("Amount invaid, no approval given"); } }
public void ProcessRequest(BankAccountBenefits accountBenefits) { accountBenefits.GoldAccountBenefits.AABreakdownCover = new AABreakdownCover() { IncludesAccidentalManagement = true, IncludesRoadSideAssistance = true, UpgradeOptions = new UpgradeOptions() { HomeStart = true, IncludesRelay = true, IncludesStayMobile = true } }; accountBenefits.GoldAccountBenefits.EuropeanTravelInsurance = new WorldWideTravelInsurance() { BuggageCover=250, CancellationTravel=400, EmergencyMedicalTravel=100000, IncludesWorldwideCover=true, PersonalAccidentalCover=100000, TravelDays=45 }; accountBenefits.GoldAccountBenefits.IncludesCheckBook = true; accountBenefits.GoldAccountBenefits.IncludesInternetBanking = true; accountBenefits.GoldAccountBenefits.MobilePhoneInsurance = new MobilePhoneInsurance() { MaximumRetailCostCover = 500, UnauthorisedCallsForContractsCover = 1000, UnauthorisedCallsForPayAsYouGoCover = 300 }; accountBenefits.GoldAccountBenefits.Overdraft = new Overdraft() { IncludesGracePeriod = true, IncludesOverdraftBuffer = true, PerdayCharges = 2.5M }; accountBenefits.GoldAccountBenefits.SentinelCardProtection = new SentinelCardProtection() { Claims = 2500, EmergencyCash = 3000, HotelBillsOverseas = 1500, HouseholdCover = true, IncludesReplacements = true, MedicalAssistanceInAbroad = 300000 }; _repository.Add(accountBenefits.GoldAccountBenefits); }
public void ProcessRequest(BankAccountBenefits accountBenefits) { if (accountBenefits.Status == BankAccountStatus.Classic) { accountBenefits.ClassicAccountBenefits.IncludesCheckBook = true; accountBenefits.ClassicAccountBenefits.IncludesInternetBanking = true; accountBenefits.ClassicAccountBenefits.Overdraft = new Overdraft() { IncludesGracePeriod = false, IncludesOverdraftBuffer = false, OverDraftBalance = 35, PerdayCharges = 1.5m }; _repository.Add(accountBenefits.ClassicAccountBenefits); } else { Successor.ProcessRequest(accountBenefits); } }
public IHttpActionResult Post(BankAccountBenefits request) { var account = ChainOfAccountsInitializer(); account.ProcessRequest(request); return Ok(); }