public void InputCard(Creditcard creditcard) { if(actualMachine.ValidateCreditCard(creditcard)) { actualMachine.SetState(actualMachine.cardExistsState()); } else { throw new UnAuthorizedUseException("This card is not valid, please contact Bank"); } }
static void Main(string[] args) { Customer benvolio = new Customer("Benvolio ", "Montague"); Creditcard credit1 = new Creditcard(benvolio, "554512345678", "0234"); CashAccount c1 = new CashAccount(benvolio, 10000); ATM myATM = ATM.getinstance(); try { myATM.InputCard(credit1); myATM.InputPin("0234"); myATM.RequestWithdrawal(c1, 9000); myATM.RequestBalance(c1); myATM.EjectCard(); } catch (UnauthorizedAccessException u) { Console.WriteLine(u.Message); } catch (IllegalOperationException i) { Console.WriteLine(i.Message); } catch (LimitExceedException l) { Console.WriteLine(l.Message); } Console.ReadKey(); }
public void InputCard(Creditcard creditcard) { throw new IllegalOperationException("There is already a card in the ATM"); }
public bool ValidateCreditCard(Creditcard creditcard) { if (creditcard.ValidateCreditcard(creditcard)) { this.activeCreditcard = creditcard; return true; } else { return false; } }
public void InputCard(Creditcard creditcard) { atmState.InputCard(creditcard); }
public bool ValidateCreditcard(Creditcard creditcard) { if (creditcard.owner.GetCustomerId() != 0 && pinCode != null) { return true; } else { return false; } }