예제 #1
0
        private async Task <bool> TryResolveMissingKey(MerchantDetails merchantDetails, string key)
        {
            switch (key)
            {
            case "img": {
                if (merchantDetails.Values.ContainsKey("twitter") && !string.IsNullOrEmpty(merchantDetails.Values["twitter"].Value))
                {
                    // Try to find an image for the merchant using the twitter account
                    var twitterProfileImageUrl = await twitterService.GetProfileImageUrl(merchantDetails.Values["twitter"].Value);

                    if (!string.IsNullOrEmpty(twitterProfileImageUrl))
                    {
                        merchantDetails.UpsertValue("img").Value = twitterProfileImageUrl;
                        return(true);
                    }
                }

                return(false);
            }
            }

            return(false);
        }