Пример #1
0
 public async Task<Offers> GetOffersAsync(ResourceUri productUri)
 {
     using (var log = RequestLogger.Current.BeginJungoLog(this))
     {
         try
         {
             var prodOffersUri =
                 Billboard.ResolveExpandAll(productUri.Uri + Billboard.Templates.ProductOffersSegment);
             return await InternalGetOffersForOfferUri(prodOffersUri).ConfigureAwait(false);
         }
         catch (Exception exc)
         {
             throw log.LogException(exc);
         }
     }
 }
Пример #2
0
 public async Task<Category> GetCategoryAsync(ResourceUri categoryUri)
 {
     using (var log = RequestLogger.Current.BeginJungoLog(this))
     {
         try
         {
             var uri = Billboard.ResolveExpandAll(categoryUri.Uri);
             var categoriesResponse =
                 await Client.GetCacheableAsync<CategoriesResponse>(uri).ConfigureAwait(false);
             return categoriesResponse == null ? null : categoriesResponse.Category;
         }
         catch (Exception exc)
         {
             throw log.LogException(exc);
         }
     }
 }
Пример #3
0
        public async Task<Product> GetProductAsync(ResourceUri productUri)
        {
            using (var log = RequestLogger.Current.BeginJungoLog(this))
            {
                try
                {
                    var uri = Billboard.ResolveExpandAll(productUri.Uri);
                    var productResponse = await Client.GetCacheableAsync<ProductResponse>(uri).ConfigureAwait(false);
                    if (productResponse == null) return null;

                    var prod = productResponse.Product;
                    await SupplyRecentInventoryStatusAsync(new[] {prod}).ConfigureAwait(false);
                    return prod;
                }
                catch (Exception exc)
                {
                    throw log.LogException(exc);
                }
            }
        }
 public async Task<CrossSellViewModel> GetCrossSellViewModelAsync(string promotionId, ResourceUri productUri, string shoppingCartLink)
 {
     var pop = await _offersApi.GetOffersAsync(promotionId, productUri).ConfigureAwait(false);
     return MakeCrossSellViewModel(pop, shoppingCartLink);
 }