//request for extension of authentication token api public static Response RequestForExtensionOfAuthToken(Request userInfo) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } string payload; try { payload = JsonConvert.SerializeObject(new { action = "REFRESHTOKEN", app_key = CipherHandler.EncryptTextWithGSTNPublicKey(userInfo.Keys.GSTNAppKey), username = userInfo.Header.Username, auth_token = userInfo.Header.AuthToken }); } catch (Exception) { return(RequestHandler.ErrorResponse("GSP141", "Error encrypting payload")); } var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v0_1, modName.authenticate); return(handler.DecryptPostResponse(url, "REFRESHTOKEN", payload)); }
//generate certificate api public static Response GenerateCertificate(Request userInfo, string jsonData) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } string payload; try { payload = JsonConvert.SerializeObject(new RequestPayload() { APIAction = "RETGENCERT", EncryptedData = CipherHandler.EncryptData(jsonData, userInfo.Keys.SessionKey), HAMCData = CipherHandler.Hmac(jsonData, userInfo.Keys) }); } catch (Exception) { return(RequestHandler.ErrorResponse("GSP141", "Error encrypting payload")); } var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_1, modName.returns_gstr9c); return(handler.Put(url, "RETGENCERT", payload)); }
//initiate OTP For EVC api public static Response InitiateOTPForEVC(Request userInfo, string gstin, string pan = "", string formType = "") { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var queryString = new NameValueCollection { { "action", "EVCOTP" }, { "gstin", gstin } }; if (!string.IsNullOrEmpty(pan)) { queryString.Add("pan", pan); } if (!string.IsNullOrEmpty(formType)) { queryString.Add("formType", formType); } var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_0, modName.authenticate); return(handler.Get(url, queryString)); }
//log out api public static Response Logout(string username, string appKey, string authToken) { string payload; try { payload = JsonConvert.SerializeObject(new JObject() { { "action", "LOGOUT" }, { "username", username }, { "authtoken", authToken }, { "app_key", CipherHandler.EncryptTextWithGSTNPublicKey(appKey) } }); } catch (Exception) { return(RequestHandler.ErrorResponse("GSP141", "Error encrypting payload")); } var handler = new RequestHandler(); handler.UserRequest.Header.Username = username; handler.UserRequest.Header.AuthToken = authToken; var url = UrlHandler.Route(accessGroup.commonapi, version.v0_2, modName.authenticate); return(handler.Post(url, "LOGOUT", payload)); }
//get TDS checksum api public static Response GetTDSChecksum(Request userInfo, string returnPeriod, string gstin, string fromTime = "", string recType = "") { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var queryString = new NameValueCollection(); queryString.Add("action", "CHECKSUM"); if (!string.IsNullOrEmpty(fromTime)) { queryString.Add("from_time", fromTime); } if (!string.IsNullOrEmpty(recType)) { queryString.Add("rec_type", recType); } queryString.Add("ret_period", returnPeriod); queryString.Add("gstin", gstin); var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_1, modName.returns_gstr7); return(handler.DecryptGetResponse(url, queryString)); }
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { // var invite = Invite.HandleUrl (url, sourceApplication, annotation); // if (invite != null) { // var message =string.Format ("Deep link from {0} \nInvite ID: {1}\nApp URL: {2}", // sourceApplication, invite.InviteId, invite.DeepLink); // new UIAlertView (@"Deep-link Data", message, null, "OK").Show (); // // return true; // } switch (url.Scheme) { //FB case fbscheme: return(ApplicationDelegate.SharedInstance.OpenUrl(application, url, sourceApplication, annotation)); //G+ case gplusscheme: return(UrlHandler.HandleUrl(url, sourceApplication, annotation)); case lischeme: return(CallbackHandler.OpenUrl(application, url, sourceApplication, new NSString("linkedin"))); } return(true); }
public UrlHandlerTests() { _imageDomainConfiguration = new ImageDomainConfiguration { DomainList = _imageDomains }; _urlHandler = new UrlHandler(_imageDomainConfiguration, new TelemetryClient()); }
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { // This handler will properly handle the URL that your application // receives at the end of the authentication process. return (loginService.isFaceBookLogin) ? FBSession.ActiveSession.HandleOpenURL (url) : UrlHandler.HandleUrl (url, sourceApplication, annotation); }
public ApplicationViewModel() { Url = new UrlHandler(App.Settings, "https://github.com/mortenn/BrowserPicker"); force_choice = true; Configuration = App.Settings; Choices = new ObservableCollection <BrowserViewModel>( WellKnownBrowsers.List.Select(b => new BrowserViewModel(new BrowserModel(b, null, null), this)) ); }
/// <summary> /// Com base no nome do parâmetro, recupera o valor presente na url. /// </summary> private static void extrairValorUrlPadrao() { var url = @"http://www.site.com/pagina? arg1=hEllo &arg2=WorlD &arg3=coDE"; UrlHandler urlHandler = new UrlHandler(url); Console.WriteLine(urlHandler.getValor("ArG3")); }
public RedirectResult RedirectLink(string code) { if (code == null) { return(Redirect("NotFound")); } UrlHandler urlHandler = new UrlHandler(); UrlModelDto url = urlHandler.GetUrlAddress(code); return(Redirect(url != null ? url.MainLink : code)); }
//file with DSC api public static Response FileWithDSC(Request userInfo, string jsonData, string signature, string PAN) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_1, modName.returns_gstr4); return(handler.File(url, jsonData, Version, ReturnType, PAN, signature)); }
private static Response GetInvoices(Request userInfo, NameValueCollection queryString) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_1, modName.returns_gstr4); return(handler.DecryptGetResponse(url, queryString)); }
//save api public static Response Save(Request userInfo, string jsonData) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_1, modName.cmp); return(handler.Save(url, jsonData)); }
//save api public static Response Save(Request userInfo, string jsonData) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_1, modName.returns_gstr4); return(handler.Save("http://localhost:11599/api/returns/gstr4/save", jsonData)); }
//file with EVC api public static Response FileWithEVC(Request userInfo, string jsonData, string PAN, string OTP) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v0_3, modName.returns_gstr3b); return(handler.File(url, jsonData, Version, ReturnType, $"{PAN}|{OTP}")); }
public IHttpHandler GetHttpHandler(RequestContext requestContext) { var routeData = requestContext.RouteData.Values; var url = routeData["urlRouteHandler"] as string; // The class UrlHandler will have all the code for figuring things out var route = UrlHandler.GetRoute(url); routeData["url"] = route.Url; routeData["controller"] = route.Controller; routeData["action"] = route.Action; // other stuff to add // Now let MvcHandler process the request. return(new MvcHandler(requestContext)); }
//search taxpayer api public static Response SearchTaxpayer(string username, string authToken, string gstinToSearch) { var queryString = new NameValueCollection { { "action", "TP" }, { "gstin", gstinToSearch } }; var handler = new RequestHandler(); handler.UserRequest.Header.Username = username; handler.UserRequest.Header.AuthToken = authToken; var url = UrlHandler.Route(accessGroup.commonapi, version.v0_2, modName.search); return(handler.Get(url, queryString)); }
public ApplicationViewModel(List <string> arguments, IBrowserPickerConfiguration settings) { var options = arguments.Where(arg => arg[0] == '/').ToList(); force_choice = options.Contains("/choose"); var url = arguments.Except(options).FirstOrDefault(); if (url != null) { Url = new UrlHandler(settings, url); } ConfigurationMode = url == null; Configuration = settings; Configuration.PropertyChanged += Configuration_PropertyChanged; Choices = new ObservableCollection <BrowserViewModel>(Configuration.BrowserList.Select(m => new BrowserViewModel(m, this))); }
//get download document status api public static Response GetDocumentStatus(Request userInfo, string documentId) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var queryString = new NameValueCollection(); queryString.Add("action", "DOCSTATUS"); queryString.Add("doc_id", documentId); var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_1, modName.document); return(handler.DecryptGetResponse(url, queryString)); }
/// <summary>Class that implements a custom local URL protocol and reports and URLs received to the delegate method.</summary> /// <param name="name">The name of the custom URL protocol, e.g. "eddi". Typically lower case.</param> /// <param name="urlHandler">Callback delegate to which the incoming URL will be passed. NB since a user can send any URL from the Windows Run dialog, treat the URL as untrusted.</param> /// <param name="logger">Callback delegate on which any errors will be logged.</param> /// <param name="absoluteAppPath">Optional full path to your executable. If null, no registry changes will be made. If supplied, an apprpriate registry key will be created or updated in HKCU.</param> /// <remarks>To test this, set a breakpoint on your urlHandler callback, and send a URL from the Windows Run dialog.</remarks> public CustomURLResponder(string name, UrlHandler urlHandler, Logger logger, string absoluteAppPath = null) { this.urlHandler = urlHandler; this.logger = logger; ddeDelegate = new DdeDelegate(DdeCallback); if (absoluteAppPath != null) { RegisterAppPath(name, absoluteAppPath); } bool success = Setup(name); if (!success) { CleanUp(); } }
//download document api public static Response DownloadDocument(Request userInfo, string documentId) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var queryString = new NameValueCollection { { "action", "DOCDOWNLOAD" }, { "doc_id", documentId } }; var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_1, modName.document); return(handler.DecryptGetResponse(url, queryString)); }
protected virtual void SetImageSize(IElement htmlElement) { Guard.Requires(htmlElement, "htmlElement").IsNotNull(); if (!htmlElement.HasAttribute("src")) { return; } var imageUrl = htmlElement.GetAttribute("src"); var urlHander = new UrlHandler(); var resultUrl = urlHander.TryResolveUrl(this.RunContext.Configuration.RelativeUrlsHost, imageUrl); if (!string.IsNullOrEmpty(resultUrl)) { ImageSize imageSize; if (!this.RunContext.ImagesCache.TryGetValue(imageUrl, out imageSize)) { var image = this.DownloadImage(resultUrl); if (image != null) { imageSize.Width = image.Width; imageSize.Height = image.Height; this.RunContext.ImagesCache.TryAdd(imageUrl, imageSize); } } if (imageSize.Width != 0 && imageSize.Height != 0) { // Width & Height should be dynamically generated attributes htmlElement.SetAttribute("width", imageSize.Width.ToString()); htmlElement.SetAttribute("height", imageSize.Height.ToString()); } } else { throw new InvalidOperationException(string.Format("Invaid image url: {0}", imageUrl)); } //TODO: Uncomment the following line when relative urls are not allowed in AMP. //htmlElement.SetAttribute("src", resultUrl); }
//proceed to file api public static Response ProceedToFile(Request userInfo, string returnPeriod, string gstin) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var payload = JsonConvert.SerializeObject(new { gstin = gstin, ret_period = returnPeriod }); var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_1, modName.returns_gstr); return(handler.DecryptPostResponse(url, "PROCEEDFILE", payload)); }
//get summary api public static Response GetSummary(Request userInfo, string returnPeriod, string gstin) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var queryString = new NameValueCollection(); queryString.Add("action", "RETSUM"); queryString.Add("ret_period", returnPeriod); queryString.Add("gstin", gstin); var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_1, modName.returns_gstr9c); return(handler.DecryptGetResponse(url, queryString)); }
//upload document api public static Response UploadDocument(Request userInfo, string contentType, string data, string documentName) { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var payload = JsonConvert.SerializeObject(new { ct = contentType, data = data, doc_nam = documentName }); var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_1, modName.document); return(handler.DecryptPostResponse(url, "DOCUPLOAD", payload)); }
//track return status api public static Response TrackReturnStatus(string username, string authToken, CipherKeys keys, string gstin, string returnPeriod, string returnType) { var queryString = new NameValueCollection { { "action", "RETTRACK" }, { "gstin", gstin }, { "fy", returnPeriod }, { "type", returnType } }; var handler = new RequestHandler(); handler.UserRequest.Keys = keys; handler.UserRequest.Header.Username = username; handler.UserRequest.Header.AuthToken = authToken; var url = UrlHandler.Route(accessGroup.commonapi, version.v1_0, modName.returns); return(handler.DecryptGetResponse(url, queryString)); }
private static void Main() { Directory.CreateDirectory("./DataCache"); var urls = new UrlHandler("url.txt"); var locker = new Locker(); var sigFlag = 0; const int maxThreads = 16; for (var i = 0; i < maxThreads; i++) { var thread = new Thread(program => { string url; var webClient = new WebClient(); while ((url = urls.GetNext()) != null) { var fileName = url.Substring(url.LastIndexOf('/') + 1); try { webClient.DownloadFile(url, $"./DataCache/{fileName}"); } catch (Exception) { Console.WriteLine($"Unable to download {url}"); } } lock (locker) { sigFlag++; } }); thread.Start(); } var buf = 0; while (buf != maxThreads) { Thread.Sleep(5 * 1000); lock (locker) { buf = sigFlag; } } }
public string GenerateCode(string url) { UrlHandler handler = new UrlHandler(); string ip = Request.UserHostAddress; UrlModelDto dtoModel = new UrlModelDto() { MainLink = url, CreateIp = ip }; string code = handler.GenerateCode(dtoModel); if (handler.HasException) { var message = string.Format("Error in Server"); HttpError err = new HttpError(message); return(JsonConvert.SerializeObject(err)); } else { return(code); } }
//get late fee api public static Response LateFee(Request userInfo, string returnPeriod, string gstin, string returnType = "") { if (!RequestHandler.IsRequestNull(userInfo, out string message)) { return(RequestHandler.ErrorResponse("GSP121", message)); } var queryString = new NameValueCollection { { "gstin", gstin }, { "ret_period", returnPeriod } }; if (!string.IsNullOrEmpty(returnType)) { queryString.Add("type", returnType); } var handler = new RequestHandler(userInfo); var url = UrlHandler.Route(accessGroup.taxpayerapi, version.v1_0, modName.returns_gstr); return(handler.DecryptGetResponse(url, queryString)); }