Exemplo n.º 1
0
        protected async Task <bool> UpdateUrl(string id, string url, UrlType urlType)
        {
            var payRequest = await GetStoreRequest(id);

            if (payRequest == null)
            {
                return(false);
            }
            switch (urlType)
            {
            case UrlType.Success:
                payRequest.SuccessUrl = url;
                break;

            case UrlType.Error:
                payRequest.ErrorUrl = url;
                break;

            case UrlType.InProgress:
                payRequest.ProgressUrl = url;
                break;
            }
            await StoreRequestClient.ApiStorePostWithHttpMessagesAsync(payRequest);

            await Log.WriteInfoAsync(this.GetType().Name, $"{nameof(UpdateUrl)} - {urlType.ToString()}", LogContextPayRequest(payRequest), $"Update callback url for request by {id}");

            return(true);
        }
Exemplo n.º 2
0
        public static string GetNameUrlType(UrlType urlType)
        {
            Type t = urlType.GetType();

            foreach (FieldInfo fi in t.GetFields())
            {
                if ((fi.FieldType == typeof(UrlType)) && (fi.Name == urlType.ToString()))
                {
                    object[] op = fi.GetCustomAttributes(true);
                    foreach (object o in op)
                    {
                        DescriptionAttribute da = (DescriptionAttribute)o;
                        if (da != null)
                        {
                            return(da.Description);
                        }
                    }
                }
            }

            return(string.Empty);
        }
Exemplo n.º 3
0
        public static string ToJsonPropertyString(this UrlType urlType)
        {
            string urlTypeAsString = urlType.ToString();

            return(urlTypeAsString.Substring(0, 1).ToLowerInvariant() + urlTypeAsString.Substring(1));
        }
Exemplo n.º 4
0
 public static string BasicUrl(UrlType type, Langs lang) {
   string res = getDataPath() + "/" + type.ToString();
   if (lang != Langs.no) res += "/" + lang.ToString();
   return res;
 }
Exemplo n.º 5
0
 public static string BasicUrl(UrlType type) {
   return getDataPath() + "/" + type.ToString();
 }