コード例 #1
0
        // 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);
        }
コード例 #2
0
        // Factory Method
        public static IPayment GetPaymentObject(int objType)
        {
            IPayment _IPayment;

            if (objType == Constant.PaymentType.ProductDetails.GetHashCode())
            {
                _IPayment = new ProductDetailsPayment();
            }
            else if (objType == Constant.PaymentType.Employee.GetHashCode())
            {
                _IPayment = new EmployeePayment();
            }
            else if (objType == Constant.PaymentType.EmployeeActivate.GetHashCode())
            {
                _IPayment = new EmployeeMemberActivatePayment();
            }
            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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public IPayment CreatePayment(Product pProduct)
        {
            IPayment payment = null;

            switch (pProduct.Category)
            {
            case (Int16)enmCategory.Physical:
                if (pProduct.ProductType == "Books")
                {
                    payment = new BookPayment(_commission);
                }
                else
                {
                    payment = new ProductPayment(_commission);
                }
                break;

            case (Int16)enmCategory.Membership:
                if (pProduct.ProductType == "New")
                {
                    payment = new NewMembershipPayment(_membership, _notification);
                }
                else
                {
                    payment = new UpgradeMembershipPayment(_membership, _notification);
                }
                break;

            case (Int16)enmCategory.Video:
                payment = new VideoPayment();
                break;
            }
            return(payment);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public void Test_VideoPayment()
        {
            var order = new VideoPayment()
            {
                Id = Guid.NewGuid(), ProductId = VideoConstants.LearningToSki
            };
            var task   = _ruleEngineOrder.ProcessOrder(order.OrderTypeId);
            var result = task.ExecuteTask(order);

            Assert.Contains(VideoConstants.LearningToSki, result);
            Assert.Contains(VideoConstants.FirstAid, result);
        }