/// <summary>
 /// Retrieve customer's rewards profile.
 /// </summary>
 /// <param name="customerId">Loyalty customer ID</param>
 /// <param name="preferredDataSource">Indicates which data source to retrieve data from.</param>
 /// <returns>CustomerRewardsProfile object which contains customer's rewards information.</returns>
 public async Task <CustomerRewardsProfile> GetRewardsInfoAsync(Guid customerId, PreferredDataSource preferredDataSource = PreferredDataSource.VendorXLiveData)
 {
     if (preferredDataSource == PreferredDataSource.VendorXLiveData)
     {
         return(await GetLiveDataAsync(customerId).ConfigureAwait(false));
     }
     else if (preferredDataSource == PreferredDataSource.RedisCacheData)
     {
         return(await GetCacheDataAsync(customerId).ConfigureAwait(false));
     }
     else
     {
         throw new NotImplementedException("Currently preferred data source is limited to live vendor data source and cache data source.");
     }
 }
Ejemplo n.º 2
0
        public async Task <CustomerRewardsProfile> GetCustomerRewardsProfileAsync(Guid customerId, [FromHeader] PreferredDataSource preferredDataSource)
        {
            logger.LogInformation($"Request lookup request for {LoyaltyConstants.CUSTOMER_ID}:{customerId}");

            var result = await orchestrator.GetRewardsInfoAsync(customerId, preferredDataSource);

            logger.LogInformation($"Ready to respond to lookup request for {LoyaltyConstants.CUSTOMER_ID}:{customerId}");

            return(result);
        }
Ejemplo n.º 3
0
        protected string GetURL(string template)
        {
            Item p = PreferredDataSource.ChildByTemplateID(template);

            return((p != null) ? SitecoreUtility.GetItemURL(p) : string.Empty);
        }