public static WebRequestJob CreateSubmissionJob(ApplicationCase appCase, WebRequestJob currentJob) { var job = new WebRequestJob(WhvJobNames.Submission, appCase.AppId) { Method = RestSharp.Method.POST, JobType = JobTypes.Normal }; //url job.BaseUrl = @"https://onlineservices.immigration.govt.nz/"; job.Resource = string.Format(@"WorkingHoliday/Application/Submit.aspx?ApplicationId={0}", appCase.AppId); job.Parameters.Add("__VIEWSTATE", "/wEPDwUKMTU5Mjg5NDA1Mg9kFgJmD2QWAgIDD2QWAgIDD2QWBAIDD2QWCgIBDxYIHgRocmVmBURodHRwOi8vZ2xvc3NhcnkuaW1taWdyYXRpb24uZ292dC5uei9GYWxzZW9ybWlzbGVhZGluZ2luZm9ybWF0aW9uLmh0bR4Hb25jbGljawXNAXdpbmRvdy5vcGVuKCdodHRwOi8vZ2xvc3NhcnkuaW1taWdyYXRpb24uZ292dC5uei9GYWxzZW9ybWlzbGVhZGluZ2luZm9ybWF0aW9uLmh0bScsJ25ld3BvcHVwJywndG9vbGJhcj1ubyxsb2NhdGlvbj1ubyxzdGF0dXM9eWVzLG1lbnViYXI9bm8sc2Nyb2xsYmFycz15ZXMscmVzaXphYmxlPXllcyx3aWR0aD02MDAsaGVpZ2h0PTQzNCcpOyByZXR1cm4gZmFsc2UeCWlubmVyaHRtbAUfZmFsc2Ugb3IgbWlzbGVhZGluZyBpbmZvcm1hdGlvbh4FdGl0bGUFGkxpbmsgb3BlbnMgaW4gYSBuZXcgd2luZG93ZAIDDxYIHwAFNWh0dHA6Ly9nbG9zc2FyeS5pbW1pZ3JhdGlvbi5nb3Z0Lm56L1Zpc2FhbmRQZXJtaXQuaHRtHwEFvgF3aW5kb3cub3BlbignaHR0cDovL2dsb3NzYXJ5LmltbWlncmF0aW9uLmdvdnQubnovVmlzYWFuZFBlcm1pdC5odG0nLCduZXdwb3B1cCcsJ3Rvb2xiYXI9bm8sbG9jYXRpb249bm8sc3RhdHVzPXllcyxtZW51YmFyPW5vLHNjcm9sbGJhcnM9eWVzLHJlc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3gFMmN0bDAwJENvbnRlbnRQbGFjZUhvbGRlcjEkbWVkaWNhbEluc3VyYW5jZUNoZWNrQm94BStjdGwwMCRDb250ZW50UGxhY2VIb2xkZXIxJHN1Ym1pdEltYWdlQnV0dG9uBStjdGwwMCRDb250ZW50UGxhY2VIb2xkZXIxJGNhbmNlbEltYWdlQnV0dG9uCu3sqFrVnQmj9kUcrt6smJ6ALKk="); job.Parameters.Add("__VIEWSTATEGENERATOR", "8150357E"); job.Parameters.Add("__EVENTVALIDATION", "/wEWDgLBnIteAv/x1m4CwdaLwgQCmMmxHQKHpuXxBALl3beGCgKzv5nJAwLL4JyXDwK6zeOZCgKL7YLlDQKii5i8BgKH0/XCCALByIr9DAL5l44EhtguqqZAjv6b+nhYqK6JiWDjDi8="); job.Parameters.Add("ctl00$ContentPlaceHolder1$falseStatementCheckBox", "on"); job.Parameters.Add("ctl00$ContentPlaceHolder1$notesCheckBox", "on"); job.Parameters.Add("ctl00$ContentPlaceHolder1$circumstancesCheckBox", "on"); job.Parameters.Add("ctl00$ContentPlaceHolder1$warrantsCheckBox", "on"); job.Parameters.Add("ctl00$ContentPlaceHolder1$informationCheckBox", "on"); job.Parameters.Add("ctl00$ContentPlaceHolder1$healthCheckBox", "on"); job.Parameters.Add("ctl00$ContentPlaceHolder1$adviceCheckBox", "on"); job.Parameters.Add("ctl00$ContentPlaceHolder1$permitExpiryCheckBox", "on"); job.Parameters.Add("ctl00$ContentPlaceHolder1$medicalInsuranceCheckBox", "on"); job.Parameters.Add("ctl00$ContentPlaceHolder1$registrationCheckBox", "on"); job.Parameters.Add("ctl00$ContentPlaceHolder1$entitlementCheckbox", "on"); job.Parameters.Add("ctl00$ContentPlaceHolder1$submitImageButton.x", "49"); job.Parameters.Add("ctl00$ContentPlaceHolder1$submitImageButton.y", "11"); // job.AddMatcher(new WebContentMatcher(JobResults.RepeatNeeded, new string[]{@"Scheme unavailable because"})); return job; }
public static WebRequestJob CreateGetStatusJob(ApplicationCase appCase, WebRequestJob currentJob) { var job = new WebRequestJob(WhvJobNames.GetStatus, appCase.AppId) { Method = RestSharp.Method.GET, JobType = JobTypes.Normal }; //usl job.BaseUrl = @"https://onlineservices.immigration.govt.nz/"; job.Resource = @"WorkingHoliday"; //retrieving job.AddRetriever(new WebContentRetriever(@"<span.*referenceNumber.*>(?<refNum>\d+)<\/span>")); job.AddRetriever(new WebContentRetriever(@"<span.*dateCreated.*>(?<dateCreated>.*)<\/span>")); job.AddRetriever(new WebContentRetriever(@"<span.*status.*>(?<app_status>.*)<\/span>")); job.AddRetriever(new WebContentRetriever(@"<span.*paymentStatus.*>(?<pay_status>.*)<\/span>")); // job.AddMatcher(new WebContentMatcher(JobResults.Succeed, new string[]{ @"<p>Welcome to the Working Holiday Schemes Online homepage.</p>"})); return job; }
public Task AddCase(ApplicationCase appCase) { if (appCase != null && !_applicationCases.ContainsKey(appCase.Username)) { _applicationCases.Add(appCase.Id, appCase); } return TaskDone.Done; }
public static WebRequestJob CreateJsResultJob(ApplicationCase appCase, WebRequestJob currentJob) { var postData = JaAgent2.GetPostData(currentJob.ResponseContent); currentJob.SetParameter(ParseDataFromString(postData)); currentJob.Method = RestSharp.Method.POST; currentJob.JobResult = JobResults.None; return currentJob; }
public CaseInfo(ApplicationCase appCase) { Id = appCase.Id; Username = appCase.Username; AppId = appCase.AppId; State = appCase.State; Scheme = appCase.SchemeType; Card = appCase.CardId; Enabled = appCase.Enabled; UpdatedTime = appCase.UpdatedTime.ToString("HH:mm:ss DD MMM"); }
public void Init() { //Guider.Start(); //Console.WriteLine("Guider starting ..."); //while (!Guider.IsRunning) //{ // Task.Delay(1000); //} Console.WriteLine("Guider started"); _appCase = new ApplicationCase() { Id = "4f890d2b-7d1e-4932-8585-118254e0f375", Username = "******", Password = "******" }; _worker = new ASWWorker(_appCase.Id, null); }
//login submit public static WebRequestJob CreateLoginSubmitJob(ApplicationCase appCase, WebRequestJob currentJob) { if (currentJob == null || !currentJob.HasResultData) { return null; } var job = new WebRequestJob(CommonJobNames.LoginSubmit, appCase.AppId) { Method = RestSharp.Method.POST, JobType = JobTypes.Normal }; //url job.BaseUrl = @"https://onlineservices.immigration.govt.nz/"; job.Resource = @"Templates/Secure/Login.aspx?NRMODE=Published&NRNODEGUID=%7b31097FC2-72ED-4420-BF02-6755811E2916%7d&NRORIGINALURL=%2fsecure%2fstatus%2ehtm&NRCACHEHINT=Guest"; //post data job.SetParameter("__EVENTTARGET", currentJob.RetrievedData["eventTarget"]); job.SetParameter("__EVENTARGUMENT", currentJob.RetrievedData["eventArgument"]); //job.SetParameter("__VIEWSTATE", preJobData["viewstate"]); job.SetParameter("__VIEWSTATE", "dDwxMDA1ODA0MzMwO3Q8O2w8aTwwPjtpPDE+Oz47bDx0PDtsPGk8Mz47PjtsPHQ8cDxsPFZpc2libGU7PjtsPG88Zj47Pj47Oz47Pj47dDw7bDxpPDA+O2k8Mj47aTw0PjtpPDg+O2k8MTI+O2k8MTQ+O2k8MTY+O2k8MTg+O2k8MjA+Oz47bDx0PDtsPGk8MD47aTwyPjtpPDM+Oz47bDx0PHA8bDxWaXNpYmxlOz47bDxvPGY+Oz4+O2w8aTwxPjs+O2w8dDw7bDxpPDE+O2k8Mz47aTw1PjtpPDc+O2k8OT47aTwxMT47PjtsPHQ8cDxsPFRleHQ7PjtsPCAtIDs+Pjs7Pjt0PHA8bDxWaXNpYmxlOz47bDxvPGY+Oz4+Ozs+O3Q8O2w8aTwxPjs+O2w8dDxwPGw8dGl0bGU7b25jbGljaztpbm5lcmh0bWw7PjtsPExpbmsgb3BlbnMgaW4gYSBuZXcgd2luZG93O3dpbmRvdy5vcGVuKCcvcmVnaXN0cmF0aW9uL21hbmFnZXN1aXRjYXNlLmFzcHgnLCdtYW5hZ2VzdWl0Y2FzZXBvcHVwJywndG9vbGJhcj1ubyxsb2NhdGlvbj1ubyxzdGF0dXM9eWVzLG1lbnViYXI9bm8sc2Nyb2xsYmFycz15ZXMscmVzaXphYmxlPXllcyx3aWR0aD04NDAsaGVpZ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tsPG88dD47Pj47Oz47Pj47dDxwPHA8bDxWaXNpYmxlOz47bDxvPGY+Oz4+Oz47bDxpPDE+Oz47bDx0PDtsPGk8MT47PjtsPHQ8cDxwPGw8VGV4dDs+O2w8MDEgSmFuIDAwMDEsIDAwOjAwOz4+Oz47Oz47Pj47Pj47dDw7bDxpPDE+O2k8Mz47aTw1Pjs+O2w8dDxwPGw8VGV4dDs+O2w8XDxBIGhyZWY9Imh0dHA6Ly93d3cubmV3emVhbGFuZC5nb3Z0Lm56LyJcPlw8SU1HIGJvcmRlcj0iMCIgYWx0PSJHbyB0byB3d3cubmV3emVhbGFuZC5nb3Z0Lm56LiAiIHNyYz0iL05SL3Jkb25seXJlcy9GN0EyMTY0NC00NUIzLTRDMzUtQTUxRi0yOUU3REQ2ODdFOTcvMC9uemdvdnRsb2dvLnBuZyJcPlw8L0FcPiZuYnNwXDsmbmJzcFw7Oz4+Ozs+O3Q8cDxsPFRleHQ7PjtsPFxlOz4+Ozs+O3Q8cDxsPFRleHQ7PjtsPFxlOz4+Ozs+Oz4+O3Q8O2w8aTwwPjs+O2w8dDxwPHA8bDxWaXNpYmxlOz47bDxvPGY+Oz4+Oz47Oz47Pj47Pj47Pj47Pj47Pj47bDxIZWFkZXJDb21tdW5pdHlIb21lcGFnZTpTZWFyY2hDb250cm9sOmJ0bkdvO09ubGluZVNlcnZpY2VzTG9naW5TdGVhbHRoOlZpc2FMb2dpbkNvbnRyb2w6bG9naW5JbWFnZUJ1dHRvbjs+Pj0AvwD8KvhDCG9+lrMjTdEZdaRc"); job.SetParameter("__VIEWSTATEGENERATOR", (currentJob.RetrievedData["viewstateGenerator"])); job.SetParameter("OnlineServicesLoginStealth:VisaLoginControl:userNameTextBox", appCase.Username); job.SetParameter("OnlineServicesLoginStealth:VisaLoginControl:passwordTextBox", appCase.Password); job.SetParameter("OnlineServicesLoginStealth:VisaLoginControl:loginImageButton.x", "57"); job.SetParameter("OnlineServicesLoginStealth:VisaLoginControl:loginImageButton.y", "10"); //success match job.AddMatcher(new WebContentMatcher(JobResults.Succeed, new string[]{ @"LastLoggedInTime_LastLoggedInTimeLabel", @"<span class=""username"" >.*- <\/span>"})); return job; }
//login homepage public static WebRequestJob CreateLoginHomeJob(ApplicationCase appCase) { var job = new WebRequestJob(CommonJobNames.LoginHomePage, appCase.AppId) { Method = RestSharp.Method.GET, JobType = JobTypes.Normal }; //url job.BaseUrl = @"https://onlineservices.immigration.govt.nz/"; job.Resource = @"secure/status.htm"; //matcher job.AddMatcher(new WebContentMatcher(JobResults.Succeed, new string[] { @"<form name=""Login"" method=""post""" })); //retrieving job.AddRetriever(new WebContentRetriever(@"<form name=""Login"".*action=""(?<url>.*?)""")); job.AddRetriever(new WebContentRetriever(@"<input.*name=""__EVENTTARGET"".*value=""(?<eventTarget>.*?)""")); job.AddRetriever(new WebContentRetriever(@"<input.*name=""__EVENTARGUMENT"".*value=""(?<eventArgument>.*?)""")); job.AddRetriever(new WebContentRetriever(@"<input.*name=""__VIEWSTATE"".*value=""(?<viewstate>.*?)""")); job.AddRetriever(new WebContentRetriever(@"<input.*name=""__VIEWSTATEGENERATOR"".*value=""(?<viewstateGenerator>.*?)""")); return job; }
public ApplicationCase UpdateApplication(ApplicationCase appCase) { lock (_locker) { _db.ApplicationCases.Attach(appCase); _db.Entry(appCase).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); _applicationCases[appCase.Id] = appCase; return appCase; } }
public static WebRequestJob GetNextJob(ApplicationCase appCase, ASWJob currentJob, SimpleCenter center) { if (appCase == null || string.IsNullOrEmpty(appCase.Id) || currentJob == null) { return null; } var job = currentJob as WebRequestJob; if (job.HasResponseContent && job.ResponseContent.Contains("<noscript>Please enable JavaScript to view the page content.</noscript>")) { //need js result return CommonJobs.CreateJsResultJob(appCase, job); } else if (string.IsNullOrEmpty(job.Name) || job.JobResult == JobResults.None || job.JobResult == JobResults.Excepted) { //login home page return CommonJobs.CreateLoginHomeJob(appCase); } else if (CommonJobNames.LoginHomePage.Equals(job.Name) && job.JobResult == JobResults.Succeed && job.HasResultData) { //login submit return CommonJobs.CreateLoginSubmitJob(appCase, job); } else if (job.JobResult == JobResults.Succeed && (CommonJobNames.LoginSubmit.Equals(job.Name))) { //login succeed return WhvJobs.CreateGetStatusJob(appCase, job); } else if (WhvJobNames.GetStatus.Equals(job.Name) && job.JobResult == JobResults.Succeed) { //after get status var appId = currentJob.JobResultData["refNum"]; if (!string.IsNullOrEmpty(appCase.AppId) && !appCase.AppId.Equals(appId)) { //differetn appId return CommonJobs.CreateLoginHomeJob(appCase); } //after get status appCase = UpdateApplicationCaseStatus(appCase, job, center); if (appCase.CanSubmit) { return WhvJobs.CreateSubmissionJob(appCase, job); } else if (appCase.CanPay) { return CommonJobs.CreateCardTypeJob(appCase, job); } else if (appCase.HasPaid) { return null; } else { return null; } } else if (WhvJobNames.Submission.Equals(job.Name) && job.JobResult == JobResults.Succeed) { //submitted //select card type return CommonJobs.CreateCardTypeJob(appCase, job); } else if (CommonJobNames.CardType.Equals(job.Name) && job.JobResult == JobResults.Succeed) { //card type selected //fill detial return CommonJobs.CreateCardDetailJob(appCase, job); } else if (CommonJobNames.CardDetail.Equals(job.Name) && job.JobResult == JobResults.Succeed) { //pay return CommonJobs.CreatePayNowJob(appCase, job); } else if (CommonJobNames.Pay.Equals(job.Name)) { return WhvJobs.CreateGetStatusJob(appCase, job); } else { Logger.Error(string.Format("Not matched action:{0},{1},{2}", job.Name, job.JobResult, job.ResponseContent)); Logger.Error(job.ResponseContent); Task.Delay(10000); //return null; return CommonJobs.CreateLoginHomeJob(appCase); } }
//update case status private static ApplicationCase UpdateApplicationCaseStatus(ApplicationCase appCase, ASWJob currentJob, SimpleCenter center) { if (!WhvJobNames.GetStatus.Equals(currentJob.Name) || currentJob.JobResult != JobResults.Succeed) { return appCase; } //update var appId = currentJob.JobResultData["refNum"]; var stateNew = currentJob.JobResultData["app_status"]; var payStateNew = currentJob.JobResultData["pay_status"]; if ((!appId.Equals(appCase.AppId) && !string.IsNullOrEmpty(appCase.AppId)) || (stateNew.Equals(appCase.State) && payStateNew.Equals(appCase.PayState))) { //appId changed //or state not changed return appCase; } appCase.State = currentJob.JobResultData["app_status"]; appCase.PayState = currentJob.JobResultData["pay_status"]; if (string.IsNullOrEmpty(appCase.AppId)) { appCase.AppId = appId; } if (string.IsNullOrEmpty(appCase.InitState)) { appCase.InitState = appCase.State; } if (string.IsNullOrEmpty(appCase.InitPayState)) { appCase.InitPayState = appCase.PayState; } appCase.UpdatedTime = DateTime.Now; // return center.UpdateApplication(appCase); }
//card type selected public static WebRequestJob CreateCardTypeJob(ApplicationCase appCase, WebRequestJob currentJob) { var job = new WebRequestJob(CommonJobNames.CardType, appCase.AppId) { Method = RestSharp.Method.POST, JobType = JobTypes.Normal }; //url job.BaseUrl = @"https://onlineservices.immigration.govt.nz/"; job.Resource = string.Format(@"PaymentGateway/OnLinePayment.aspx?SourceUrl=https://onlineservices.immigration.govt.nz/WorkingHoliday/Application/SubmitConfirmation.aspx?ApplicationId={0}&ApplicationId={0}&ProductId=2", appCase.AppId); job.Parameters.Add("__EVENTTARGET", ""); job.Parameters.Add("__EVENTARGUMENT", ""); job.Parameters.Add("__VIEWSTATE", "/wEPDwULLTEyMDY4Njc4MDkPZBYCZg9kFgICAw9kFgICAw9kFgICBw8WCB4FY2xhc3MFCXNpdGV0YWJsZR4LY2VsbHNwYWNpbmcFATAeBmJvcmRlcgUBMB4LY2VsbHBhZGRpbmcFATIWAgIBDxYCHgZ2YWxpZ24FA3RvcBYCAgIPZBYCAgEPDxYCHglNYXhMZW5ndGgCZGRkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYCBSdjdGwwMCRDb250ZW50UGxhY2VIb2xkZXIxJG9rSW1hZ2VCdXR0b24FK2N0bDAwJENvbnRlbnRQbGFjZUhvbGRlcjEkY2FuY2VsSW1hZ2VCdXR0b27cKn7Ve9p8wZAjvx+vD5veCXC0nw=="); job.Parameters.Add("__VIEWSTATEGENERATOR", "64EC2CD5"); job.Parameters.Add("__EVENTVALIDATION", "/wEWBAKbnrrRDQLsqKiNDgLAhozUDwL5l44EvLqaWXWqwKlxNHR20Ez1IFDyuaU="); job.Parameters.Add("ctl00$ContentPlaceHolder1$payorNameTextBox", appCase.Card.Holder); job.Parameters.Add("ctl00$ContentPlaceHolder1$okImageButton.x", "40"); job.Parameters.Add("ctl00$ContentPlaceHolder1$okImageButton.y", "8"); // job.AddRetriever(new WebContentRetriever(@"<form.*payment_type_selection.*action=""(?<form_action>.+?)"">")); job.AddRetriever(new WebContentRetriever(@"<input.*name=""hk"".*value=""(?<hk>.+)"">")); // job.AddMatcher(new WebContentMatcher(JobResults.Succeed, new string[] { @"1: Select your preferred payment method" })); return job; }
//pay public static WebRequestJob CreatePayNowJob(ApplicationCase appCase, WebRequestJob currentJob) { var job = new WebRequestJob(CommonJobNames.Pay, appCase.AppId) { Method = RestSharp.Method.POST, JobType = JobTypes.Normal }; //url job.BaseUrl = @"https://webcomm.paymark.co.nz/"; job.Resource = string.Format(@"hosted/{0}", currentJob.JobResultData["form_action"]); // job.Parameters.Add("hk", currentJob.JobResultData["hk"]); job.Parameters.Add("use_card_security_code", "Y"); job.Parameters.Add("enforce_card_security_code", "N"); job.Parameters.Add("enforce_card_security_code_3party", "Y"); job.Parameters.Add("enforce_card_security_code_futurepay", "Y"); job.Parameters.Add("future_pay", "N"); job.Parameters.Add("future_pay_save_only", ""); job.Parameters.Add("hosted_responsive_format", "N"); var card = appCase.Card; job.Parameters.Add("cardtype", card.CardTypeName); job.Parameters.Add("cardnumber", card.CardNumber); job.Parameters.Add("cardverificationcode", card.SecureCode); job.Parameters.Add("expirymonth", card.ExpiryMonth); job.Parameters.Add("expiryyear", card.ExpiryYear); job.Parameters.Add("cardholder", card.Holder); job.Parameters.Add("pay_now", "Pay+Now"); // job.AddMatcher(new WebContentMatcher(JobResults.Succeed, new string[] { @"Your payment was successful" })); job.AddMatcher(new WebContentMatcher(JobResults.Failed, new string[] { @"Your payment was not successful" })); return job; }
//card detail public static WebRequestJob CreateCardDetailJob(ApplicationCase appCase, WebRequestJob currentJob) { var job = new WebRequestJob(CommonJobNames.CardDetail, appCase.AppId) { Method = RestSharp.Method.POST, JobType = JobTypes.Normal }; //url job.BaseUrl = @"https://webcomm.paymark.co.nz/"; job.Resource = string.Format(@"hosted/{0}", currentJob.JobResultData["form_action"]); job.Parameters.Add("hk", currentJob.JobResultData["hk"]); job.Parameters.Add("hosted_responsive_format", "N"); job.Parameters.Add(string.Format("card_type_{0}.x", appCase.Card.CardTypeName), "44"); //card_type_VISA.x:"36" job.Parameters.Add(string.Format("card_type_{0}.y", appCase.Card.CardTypeName), "18"); //card_type_VISA.y:"36" job.Parameters.Add("processingStage", "card_entry"); job.Parameters.Add("future_pay", ""); job.Parameters.Add("future_pay_save_only", ""); // job.AddRetriever(new WebContentRetriever(@"<form action=""(?<form_action>.+?)"".*credit_card_entry"" >")); job.AddRetriever(new WebContentRetriever(@"<input.*name=""hk"".*value=""(?<hk>.+)"">")); //matcher job.AddMatcher(new WebContentMatcher(JobResults.Succeed, new string[] { @"2: Enter Your Card Details" })); return job; }