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, })); }
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)); }
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); }
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(), })); }
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); }