// Factory Method public static IPayment GetPaymentObject(int objType) { IPayment _IPayment; if (objType == Constant.PaymentType.PhysicalProduct.GetHashCode()) { _IPayment = new PhysicalProductPayment(); } else if (objType == Constant.PaymentType.Book.GetHashCode()) { _IPayment = new BookPayment(); } else if (objType == Constant.PaymentType.MembershipActivate.GetHashCode()) { _IPayment = new MembershipActivatePayment(); } else if (objType == Constant.PaymentType.MembershipUpgrade.GetHashCode()) { _IPayment = new MembershipUpgradePayment(); } else if (objType == Constant.PaymentType.Video.GetHashCode()) { _IPayment = new VideoPayment(); } else { _IPayment = null; } return(_IPayment); }
public static IProcessOrder GetPaymentMethod(PaymentFor type) { IProcessOrder _processOrder = null; switch (type) { case PaymentFor.PHYSICALPRODUCT: _processOrder = new PhysicalProductPayment(); break; case PaymentFor.BOOK: _processOrder = new BookPayment(); break; case PaymentFor.BOOKORPHYSICAL: _processOrder = new PhysicalorBookPayment(); break; case PaymentFor.VIDEO: _processOrder = new VideoPayment(); break; default: break; } return(_processOrder); }
public static IProcessOrder GetPaymentMethod(PaymentType type) { IProcessOrder _processOrder = null; switch (type) { case PaymentType.PHYSICAL_PRODUCT: _processOrder = new PhysicalProductPayment(); break; case PaymentType.BOOK: _processOrder = new BookPayment(); break; case PaymentType.BOOKORPHYSICAL: _processOrder = new PhysicalorBookPayment(); break; case PaymentType.VIDEO: _processOrder = new VideoPayment(); break; case PaymentType.MEMBERSHIP: _processOrder = new MemberShipPayment(); break; default: break; } return(_processOrder); }
public void Test_MembershipUpgradePayment() { IPayment payment = new PhysicalProductPayment(); IProduct product = new PhysicalProduct(payment); IOrderProcessor processor = new OrderProcessor(); processor.ProcessOrder(product); Assert.Equal("Generate a packing slip for shipping", product.Status); }
public PhysicalProductProcess(PhysicalProductPayment physicalProductPayment) { this._physicalProductPayment = physicalProductPayment; }