Beispiel #1
0
        public ActionResult Payment(Guid jobAdId, JobAdFeaturePack featurePack)
        {
            var employer = CurrentEmployer;

            var jobAd = GetJobAd(employer.Id, jobAdId);

            if (jobAd == null)
            {
                return(NotFound("job ad", "id", jobAdId));
            }

            var product = _employerOrdersQuery.GetJobAdFeaturePackProduct(featurePack);

            if (product == null)
            {
                return(NotFound("feature pack", "featurePack", featurePack));
            }

            var creditCard = new CreditCard {
                ExpiryDate = GetDefaultExpiryDate()
            };
            var order = _employerOrdersCommand.PrepareOrder(new[] { product.Id }, null, null, GetCreditCardType(creditCard));

            return(View(new PaymentJobAdModel
            {
                AuthoriseCreditCard = false,
                CouponCode = null,
                CreditCard = creditCard,
                OrderDetails = _employerOrdersQuery.GetOrderDetails(_creditsQuery, order, _productsQuery.GetProducts()),
                Product = product,
            }));
        }
Beispiel #2
0
 private Order GetOrder(IEnumerable <Guid> productIds, CheckBoxValue useDiscount, Coupon coupon, CreditCardType?creditCardType)
 {
     creditCardType = creditCardType ?? default(CreditCardType);
     return((useDiscount == null || !useDiscount.IsChecked)
         ? _employerOrdersCommand.PrepareOrder(_productsQuery, _creditsQuery, productIds, coupon, null, creditCardType.Value)
         : _employerOrdersCommand.PrepareOrder(_productsQuery, _creditsQuery, productIds, coupon, new VecciDiscount {
         Percentage = 0.2m
     }, creditCardType.Value));
 }
Beispiel #3
0
        public void TestPrepareContactOrder()
        {
            var product = _employerOrdersQuery.GetContactProducts()[0];

            Assert.AreEqual(180, product.Price);

            var order = _employerOrdersCommand.PrepareOrder(new[] { product.Id }, null, null, CreditCardType.Visa);

            // Includes GST.

            AssertOrder(order, 180, 198);
        }
Beispiel #4
0
        private ActionResult ChooseView(Guid contactProductId)
        {
            // Generate an order using the default credit card.

            var order = _employerOrdersCommand.PrepareOrder(_productsQuery, _creditsQuery, new[] { contactProductId }, null, null, default(CreditCardType));

            return(View(new NewOrderChooseModel
            {
                SelectedContactProductId = contactProductId,
                OrderDetails = _employerOrdersQuery.GetOrderDetails(_creditsQuery, order, _productsQuery.GetProducts()),
                ContactProducts = _employerOrdersQuery.GetContactProducts(),
            }));
        }
Beispiel #5
0
        public static Order PrepareOrder(this IEmployerOrdersCommand employerOrdersCommand, IProductsQuery productsQuery, ICreditsQuery creditsQuery, IEnumerable <Guid> productIds, Coupon coupon, Discount discount, CreditCardType creditCardType)
        {
            var order = employerOrdersCommand.PrepareOrder(productIds, coupon, discount, creditCardType);

            SortItems(creditsQuery, order, productsQuery.GetProducts());
            return(order);
        }