Beispiel #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);
        }
        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);
        }
Beispiel #3
0
        public static string ToJsonPropertyString(this UrlType urlType)
        {
            string urlTypeAsString = urlType.ToString();

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