/// <summary> /// /// </summary> /// <param name="model"></param> /// <returns></returns> protected override IDictionary <string, object> Convert(OpenAccountRequest model) { var sqlParams = base.Convert(model); sqlParams["AttestationImages"] = model.AttestationImages == null ? null : model.AttestationImages.ToJson(); return(sqlParams); }
/// <summary> /// Opens an account session asynchronously /// </summary> /// <returns>OpenAccountResponse with account details</returns> public async Task <OpenAccountResponse> OpenAccountAsync(OpenAccountRequest acc) { _url.Path = Constants.ApiPostAccountOpen; var response = await _client.PostJsonAsync <OpenAccountRequest, OpenAccountResponse>(_url.ToString(), acc); ResetPath(); return(response); }
public ActionResult ProcessOpenRequest(long id, Workplace.AttestationStatus status, string rejectedReason = null) { var model = OpenAccountRequest.FindById(id); if (null == model) { return(Json(new { success = false, message = "Not exists the user!" })); } model.AttestationStatus = status; var saved = model.Save(); return(Json(new { success = saved })); }
public async Task <IActionResult> OpenAccount([FromBody] OpenAccountRequest openAccountRequest) { var user = await _db.Users.FirstOrDefaultAsync(u => u.Id == _tenantProvider.GetTenantId()); if (user == null) { return(NotFound()); } var account = await _accountService.OpenAccount(openAccountRequest, _tenantProvider.GetTenantId()); await _db.SaveChangesAsync(); return(Ok(new AccountViewModel(account))); }
/// <summary> /// 开通存管账户获取tmdata /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <BankSercrityInfo> OpenAccountAsync(OpenAccountRequest request) { try { string url = $"{bankGetwayBaseUrl}api/users/accountcreate"; HttpResponseMessage responseMessage = await Client.PostAsJsonAsync(url, request); if (responseMessage.StatusCode == HttpStatusCode.OK) { return(await responseMessage.Content.ReadAsAsync <BankSercrityInfo>()); } return(null); } catch (Exception ex) { return(null); } }
public async Task <Account> OpenAccount(OpenAccountRequest openAccountRequest, int accountOwnerId) { _logger.LogInformation($"Opening {openAccountRequest.AccountType} Account '{openAccountRequest.AccountType.ToString()}' for userId: {accountOwnerId}"); var account = openAccountRequest.ToDomainModel(); account.AccountOwnerId = accountOwnerId; //hacked this slightly to be NZ format. Not nice, but it works. var nextAccountNum = await _numberRangeService.GetNextValue(account.AccountType == AccountType.TRANSACTION ?NumberRangeType.Cheque : NumberRangeType.Savings); var bankPrefix = _config["BankPrefix"]; var branch = "0001"; var suffix = account.AccountType == AccountType.TRANSACTION ? "00" : "30"; account.AccountNumber = $"{bankPrefix}-{branch}-{nextAccountNum}-{suffix}"; await _db.Accounts.AddAsync(account); return(account); }
public long Post([FromBody] BossCommentEntity entity) { if (null == entity) { return(-1); } if (string.IsNullOrEmpty(entity.TargetIDCard)) { return(-1); } var target = TargetEmploye.FindByIDCard(entity.TargetIDCard); if (null == target) { target = new TargetEmploye(); target.RealName = entity.TargetName; target.IDCard = entity.TargetIDCard; target.Tags = new string[] { target.RealName, target.IDCard.Substring(0, target.IDCard.Length > 6 ? 6 : target.IDCard.Length) }; target.Save(); } else if (target.RealName != entity.TargetName) { target.RealName = entity.TargetName; target.Save(); } var userProfile = MvcContext.Current.UserPassport.Profile; var model = new BossComment(); model.FillPropertiesFromEntity(entity, true); var request = OpenAccountRequest.FindByPassportId(userProfile.PassportId); model.EmployeId = target.EmployeId; model.CommentEntId = 0;// EntInfo.FindByEntName(request.EntName).EntId; model.CommentatorId = userProfile.PassportId; model.CommentatorName = userProfile.RealName; model.CommentatorJobTitle = userProfile.CurrentJobTitle; var saved = model.Save(); if (saved && (false == string.IsNullOrEmpty(entity.Voice) || null != entity.Images)) { if (false == string.IsNullOrEmpty(entity.Voice)) { model.Voice = ImageHelper.SaveBossCommentVoice(model.CommentId, model.CreatedTime, entity.Voice) + "?t=" + DateTime.Now.ToString("yyMMddHHmmssfff"); } if (null != entity.Images && entity.Images.Length > 0) { string[] applyImages = null == entity.Images ? null : new string[entity.Images.Length]; if (null != entity.Images) { for (var i = 0; i < entity.Images.Length; i++) { var imageUrl = ImageHelper.SaveBossCommentImage(model.CommentId, model.CreatedTime, entity.Images[i]); applyImages[i] = imageUrl + "?t=" + DateTime.Now.ToString("yyMMddHHmmssfff"); } model.Images = applyImages; } } saved = model.Save(); } return(model.CommentId); }
public ActionResult <OpenAccountResponse> Post([FromBody] OpenAccountRequest openAccountRequest) { if (openAccountRequest == null || string.IsNullOrEmpty(openAccountRequest.CustomerID)) { return(BadRequest(new OpenAccountResponse { Request = openAccountRequest, ReturnDescription = Constants.NOT_A_VALID_INPUT })); } List <User> usersInTheSystem = JsonConvert.DeserializeObject <List <User> >(_cache.Get(Constants.USERS_CACHE_KEY).ToString()); var userIndex = usersInTheSystem.FindIndex(u => u.CustomerID.Equals(openAccountRequest.CustomerID)); if (userIndex < 0) { return(Ok(new OpenAccountResponse { Request = openAccountRequest, ReturnDescription = Constants.NO_SUCH_USER_IN_THE_SYSTEM })); } var user = usersInTheSystem[userIndex]; if (null == user.Account) { user.Account = new Model.Account(); } if (openAccountRequest.InitialCredit != 0) //Since Initial credit > 0, we must trigger transaction service and add a new transaction { var transaction = new Transaction { TransactionDate = DateTime.Now, TransactionDetail = String.Format(Constants.TRANSACTION_ADDED, openAccountRequest.InitialCredit) }; user.Account.Transactions.Add(transaction); user.Account.Balance += openAccountRequest.InitialCredit; try { new Integrator().AddTransactionQuee(new AddTransactionRequest { CustomerID = openAccountRequest.CustomerID, Transaction = transaction }); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, (new OpenAccountResponse { Request = openAccountRequest, ReturnDescription = Constants.INTERNAL_SERVER_ERROR }))); } } //Flow completed, So I need to update In-Memory DB (Cache) as below. usersInTheSystem[userIndex] = user; _cache.Set(Constants.USERS_CACHE_KEY, JsonConvert.SerializeObject(usersInTheSystem)); return(Ok(new OpenAccountResponse { Request = openAccountRequest, ReturnDescription = Constants.OK })); }
/// <summary> /// Opens an account session synchronously /// </summary> /// <returns>OpenAccountResponse with account details</returns> public OpenAccountResponse OpenAccount(OpenAccountRequest acc) { var response = OpenAccountAsync(acc).GetAwaiter().GetResult(); return(response); }
/// <summary> /// Opens an account session asynchronously /// </summary> /// <returns>OpenAccountResponse with account details</returns> public async Task<OpenAccountResponse> OpenAccountAsync(OpenAccountRequest acc) { _url.Path = Constants.ApiPostAccountOpen; var response = await _client.PostJsonAsync<OpenAccountRequest, OpenAccountResponse>(_url.ToString(), acc); ResetPath(); return response; }
/// <summary> /// Opens an account session synchronously /// </summary> /// <returns>OpenAccountResponse with account details</returns> public OpenAccountResponse OpenAccount(OpenAccountRequest acc) { var response = OpenAccountAsync(acc).GetAwaiter().GetResult(); return response; }
/// <summary> /// 开通存管账户 /// </summary> /// <returns></returns> public async Task <bool> OpenBankAccount(AccountUsers user, WebBrowser webBrowser, Action action) { SetWebbrowser.SumitForm(12); webBrowser.ScriptErrorsSuppressed = true; OpenAccountRequest request = new OpenAccountRequest { BankCardNo = user.BankCardNo, BankCardPhone = user.CgCellPhone, BizType = "01", CertNo = user.CredentialNo, RealName = user.RealName, RegisteredCell = user.CellPhone, ReturnUrl = "http://www.baidu.com/", UserId = user.UserIdentifier, ClientType = 900, OrderId = Guid.NewGuid().ToString("N").ToUpper() }; BankSercrityInfo openAcountResponse = await this.jymService.OpenAccountAsync(request); if (openAcountResponse == null) { return(false); } string url = $"http://fsgw.hkmdev.firstpay.com/phoenixFS-fsgw/gateway?data={HttpUtility.UrlEncode(openAcountResponse.Data)}&tm={HttpUtility.UrlEncode(openAcountResponse.Tm)}&merchantId=M20000002130"; //添加一个 //WebBrowser webBrowser = new WebBrowser { Name = "wb" + Guid.NewGuid().ToString("N").ToUpper() }; webBrowser.Navigate(new Uri(url, UriKind.Absolute)); int first = 0; webBrowser.DocumentCompleted += (obj, e) => { //赋值 HtmlDocument htmlDocument = webBrowser.Document; if (first == 0) { if (htmlDocument != null) { try { Thread.Sleep(650); string html1 = htmlDocument.Body?.InnerHtml; string dkfk = html1; //webBrowser.Navigate("jajavascript:window.alert($)"); //webBrowser.Navigate("javascript:$('#payPassword').next().click();$('#confirmPayPassword').next().click();$('#payPassword').val('111111');$('#confirmPayPassword').val('111111');$('#sendSmsCode').click();$('#smsCode').val('123456');$(':submit').click()"); int a = 0; Thread th = new Thread(() => { try { Thread.Sleep(650); string html = htmlDocument.Body?.InnerHtml; HtmlElement setPwd = htmlDocument.GetElementById("payPassword"); //输入密码 HtmlElement parent = setPwd?.Parent?.GetElementsByTagName("button")[0]; parent?.InvokeMember("click"); //获取到键值为1的id HtmlElement key1 = htmlDocument.GetElementById("key11"); key1?.InvokeMember("click"); key1?.InvokeMember("click"); key1?.InvokeMember("click"); key1?.InvokeMember("click"); key1?.InvokeMember("click"); key1?.InvokeMember("click"); HtmlElement confirmSetPwd = htmlDocument.GetElementById("confirmPayPassword"); //确认密码 HtmlElement parent1 = confirmSetPwd?.Parent?.GetElementsByTagName("button")[0]; parent1?.InvokeMember("click"); //获取到键值为1的id HtmlElement key2 = htmlDocument.GetElementById("key11"); key2?.InvokeMember("click"); key2?.InvokeMember("click"); key2?.InvokeMember("click"); key2?.InvokeMember("click"); key2?.InvokeMember("click"); key2?.InvokeMember("click"); List <HtmlElement> listElements = new List <HtmlElement> { htmlDocument.GetElementById("payPassword"), htmlDocument.GetElementById("payPasswordConfirm"), htmlDocument.GetElementById("bankCode"), htmlDocument.GetElementById("bankCardNoInput"), htmlDocument.GetElementById("bankCardPhone"), htmlDocument.GetElementById("smsCode") }; foreach (HtmlElement t in listElements) { t?.SetAttribute("data-status", "true"); } HtmlElementCollection input = htmlDocument.GetElementsByTagName("input"); input[10]?.SetAttribute("data-status", "true"); //var pas = document.getElementById('confirmPayPassword'); pas.nextElementSibling.onclick(); var ke1 = document.getElementById('key11'); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); //undefined //var pas = document.getElementById('payPassword'); pas.nextElementSibling.onclick(); var ke1 = document.getElementById('key11'); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); //$('#payPassword').next().click();$('#confirmPayPassword').next().click();$('#payPassword').val('111111');$('#confirmPayPassword').val('111111');$('#sendSmsCode').click();$('#smsCode').val('123456');$(':submit').click() //webBrowser.Navigate("javascript:$(\'#payPassword\').next().click()"); //webBrowser.Navigate("javascript:$('#payPassword').next().click();$('#confirmPayPassword').next().click();$('#payPassword').val('111111');$('#confirmPayPassword').val('111111');$('#sendSmsCode').click();$('#smsCode').val('123456');"); //$(':submit').click() //setPwd?.SetAttribute("value", "111111"); //htmlDocument.GetElementById("payPasswordConfirm")?.SetAttribute("value", "111111"); htmlDocument.GetElementById("smsCode")?.SetAttribute("value", "123456"); //点击按钮 for (int ii = 0; ii < input.Count; ii++) { if (input[ii].GetAttribute("type").ToLower().Equals("submit")) { input[ii].InvokeMember("click"); } } } catch (Exception exception) { Console.WriteLine(exception); throw; } }) { IsBackground = true }; th.Start(); } catch (Exception ex) { //是失败 } } } first = first + 1; bool?contains = htmlDocument?.Body?.OuterHtml.Contains("成功开通"); if (contains != null && (bool)contains) { action(); } }; return(false); }
public async Task <IActionResult> Post([FromBody] OpenAccountRequest request) { await _akkaService.OpenAccount(new OpenAccount(new AccountId(request.AccountNumber), new Money(request.Amount, new Currency(request.Currency)))); return(Ok()); }