Exemple #1
0
        public virtual async Task <IHttpActionResult> GetGuestOrderByNumber(GetGuestOrderRequest param)
        {
            if (param == null)
            {
                return(BadRequest("No request found."));
            }

            var viewModel = await OrderHistoryViewService.GetOrderDetailViewModelForGuestAsync(new GetOrderForGuestParam
            {
                OrderNumber = param.OrderNumber,
                Scope       = ComposerContext.Scope,
                CultureInfo = ComposerContext.CultureInfo,
                CountryCode = ComposerContext.CountryCode,
                BaseUrl     = RequestUtils.GetBaseUrl(Request).ToString(),
                Email       = param.Email
            });

            return(Ok(viewModel));
        }
Exemple #2
0
        public virtual async Task <IHttpActionResult> GetGuestOrderDetailsUrl(GetGuestOrderViewModel request)
        {
            if (request == null)
            {
                return(BadRequest("No request body found."));
            }

            var orderDetailUrl = OrderUrlProvider.GetGuestOrderDetailsUrl(ComposerContext.CultureInfo);

            var orderDetailViewModel = await OrderHistoryViewService.GetOrderDetailViewModelForGuestAsync(new GetOrderForGuestParam
            {
                OrderNumber = request.OrderNumber,
                Email       = request.Email,
                Scope       = ComposerContext.Scope,
                CultureInfo = ComposerContext.CultureInfo,
                CountryCode = ComposerContext.CountryCode,
                BaseUrl     = RequestUtils.GetBaseUrl(Request).ToString()
            });

            if (orderDetailViewModel == null)
            {
                return(NotFound());
            }

            var token = GuestOrderTokenizer.GenerateOrderToken(new OrderToken
            {
                Email       = request.Email,
                OrderNumber = request.OrderNumber
            });

            var url = UrlFormatter.AppendQueryString(orderDetailUrl, new NameValueCollection
            {
                { "token", token }
            });

            var vm = new GuestOrderDetailsViewModel
            {
                Url = url
            };

            return(Ok(vm));
        }