public void CreatorOfPayment(Product product, EMethodOfPayment method) { TransitionOfPaymentFactory paymentFactory = new TransitionOfPaymentFactory(); this.transition = paymentFactory.CreateTransitionOfPayment(method, product); this.transition.MakePayment(product); }
public virtual ITransitionOfPayment CreateTransitionOfPayment(EMethodOfPayment method, Product product) { ITransitionOfPayment transition = null; switch (method) { case EMethodOfPayment.Credit_Card: transition = new CreditCard(); break; case EMethodOfPayment.Debit_Card: transition = new DebitCard(); break; default: break; } return(transition); }