Ejemplo n.º 1
0
        private GiftCardService CreateCardService()
        {
            var userId      = Guid.Parse(User.Identity.GetUserId());
            var cardService = new GiftCardService(userId);

            return(cardService);
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetCompaniesDropdown()
        {
            GiftCardService svc  = CreateCardService();
            var             list = svc.CompaniesDropdown();

            return(Ok(list));
        }
Ejemplo n.º 3
0
        public decimal TotalDonation()
        {
            var userId      = Guid.Parse(User.Identity.GetUserId());
            var cardService = new GiftCardService(userId);
            var total       = cardService.GetDonation().Sum(e => e.Amount);

            return(total);
        }
Ejemplo n.º 4
0
        //  GET api/Card
        public IHttpActionResult Get()
        {
            GiftCardService cardService = CreateCardService();

            var cards = cardService.GetCards();

            return(Ok(cards));
        }
Ejemplo n.º 5
0
        //  POST /api/Card
        public IHttpActionResult Post(GiftCardCreateViewModel card)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            GiftCardService cardService = CreateCardService();

            cardService.CreateGiftCard(card);

            return(Ok());
        }
Ejemplo n.º 6
0
        public IHttpActionResult GetExpirations()
        {
            GiftCardService cardService = CreateCardService();

            var cards = cardService.GetExpirationCards();

            if (cards != null)
            {
                return(Ok(cards));
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task InitializeAsync()
        {
            var policy = new SmartRetryExecutionPolicy();

            Service.SetExecutionPolicy(policy);
            GiftCardService.SetExecutionPolicy(policy);

            // Get a gift card id to use with these tests.
            GiftCardId = (await GiftCardService.ListAsync(new Filters.GiftCardListFilter()
            {
                Limit = 1
            })).Items.First().Id.Value;

            // Create one for use with count, list, get, etc. tests.
            await Create();
        }
Ejemplo n.º 8
0
        private void InitializeModel(PaymentDemoViewModel viewModel)
        {
            ICart cart = _orderRepository.LoadOrCreateCart <ICart>(CustomerContext.Current.CurrentContactId, "Default");

            var shirtRef      = _referenceConverter.GetContentLink("Long Sleeve Shirt White Small_1");
            var suspendersRef = _referenceConverter.GetContentLink("Suspenders_1");

            if (viewModel.Variants == null)
            {
                viewModel.Variants = new List <DefaultVariation>
                {
                    _contentLoader.Get <DefaultVariation>(shirtRef),
                    _contentLoader.Get <DefaultVariation>(suspendersRef)
                };
            }

            viewModel.PayMethods = PaymentManager.GetPaymentMethodsByMarket(_currentMarket.GetCurrentMarket().MarketId.Value).PaymentMethod;
            viewModel.CartItems  = cart.GetAllLineItems();
            viewModel.CartTotal  = cart.GetTotal();

            viewModel.GiftCards       = GiftCardService.GetClientGiftCards("TrainingGiftCard", (PrimaryKeyId)CustomerContext.Current.CurrentContactId);
            viewModel.ShippingMethods = ShippingManager.GetShippingMethodsByMarket(MarketId.Default.Value, false).ShippingMethod.ToList();
        }