public async Task <IActionResult> PayAccount([Bind("RevenueId,DueDate,AccountBankId,ConditionId,Payment,Tax,Discont,Comment,Active,Image,Id")] PayAccount data, bool Active, List <IFormFile> Image) { Revenue revenue = await _revenueServices.SingleOrDefaultAsync(a => a.RevenueId == data.RevenueId); if (data.Payment.HasValue) { RevenueTrans revenueTrans = _financialExtension.GetRevenueTrans(data, _BusinessId, "PAG", revenue.DueDate.HasValue ? 2 : 3); BankTrans bankTrans = _financialExtension.GetBankTrans(data, revenueTrans, _BusinessId, revenue.ChartAccountId); //await _revenueTransServices.AddAsyncNoSave(revenue); await _bankTransServices.AddAsync(bankTrans, false); } if (data.Tax.HasValue) { RevenueTrans revenueTrans = _financialExtension.GetRevenueTrans(data, _BusinessId, "JUR", 1); await _revenueTransServices.AddAsync(revenueTrans, false); } if (data.Discont.HasValue) { RevenueTrans revenueTrans = _financialExtension.GetRevenueTrans(data, _BusinessId, "DIS", 2); await _revenueTransServices.AddAsync(revenueTrans, false); } if (data.Active) { revenue.DuePayment = data.DueDate; await _revenueServices.UpdateAsync(revenue, false); } var insert = await _revenueTransServices.SaveAsync(); return(RedirectToAction(nameof(List))); }
private void ProcessPayment(PayAccount cmd) { try { var luckObligation = _accountState.Obligations.FirstOrDefault(x => x.Key == "AccountAdjustments").Value; if (luckObligation == null) { throw new Exception($"[ProcessPayment]: Inconvibable! Why is there no obligation?"); } var @event = new PaymentAppliedToObligation( luckObligation.ObligationNumber , new CreditCardPayment(cmd.AmountToPay) , cmd.AmountToPay , "CreditCard Payment Applied To Dues" ); Persist(@event, s => { _accountState = _accountState.ApplyEvent(@event); Self.Tell(new PublishAccountStateToKafka()); ApplySnapShotStrategy(); Sender.Tell(new MyAccountStatus("Payment Applied", (AccountState)_accountState.Clone())); }); } catch (Exception e) { _log.Error($"[ProcessPayment]: {e.Message} {e.StackTrace}"); throw; } }
public ExpenseTrans GetExpenseTrans(PayAccount data, int businessId, string midleDesc, int signal) { return(new ExpenseTrans() { AccountBankId = data.AccountBankId, BusinessEntityId = businessId, CreateDate = data.DueDate, Description = data.Comment, Midledesc = midleDesc, ConditionId = data.ConditionId, ExpenseId = data.ExpenseId, Signal = signal, Total = data.Payment.Value }); }
public BankTrans GetBankTrans(PayAccount data, RevenueTrans revenue, int businessId, int?categoryId) { return(new BankTrans() { Bank = revenue.Bank, AccountBankId = revenue.AccountBankId.Value, CreateDate = System.DateTime.UtcNow, DueDate = data.DueDate, BusinessEntityId = businessId, Description = data.Comment, MidleDesc = revenue.Midledesc, ChartAccountId = categoryId, Signal = 1, Total = revenue.Total, Deleted = false, RevenueTrans = revenue }); }
private void dlstPtReviews_DeleteCommand(object source, DataListCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument, CultureInfo.InvariantCulture); if (e.CommandName == "Delete") { if (VShopHelper.DeleteFeedBack(id)) { this.ShowMsg("删除成功", true); this.BindPtReview(); } else { this.ShowMsg("删除失败", false); } } else { FeedBackInfo feedBack = VShopHelper.GetFeedBack(id); if (feedBack != null) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); PayAccount account = new PayAccount(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey); NotifyClient client = new NotifyClient(account); if (client.UpdateFeedback(feedBack.FeedBackId, feedBack.OpenId)) { VShopHelper.UpdateFeedBackMsgType(feedBack.FeedBackId, "已处理"); this.ShowMsg("处理成功", true); this.BindPtReview(); } else { this.ShowMsg("处理失败", false); } } } }
public AccountModule() : base("/api/account") { Get("/{actorName}", async args => { try { var system = LoanerActors.DemoActorSystem .ActorSelection($"/user/demoSupervisor/*/{args.actorName}") .ResolveOne(TimeSpan.FromSeconds(3)); if (system.Exception != null) { throw system.Exception; } var response = await Task.Run( () => system.Result.Ask <MyAccountStatus>(new TellMeYourStatus(), TimeSpan.FromSeconds(1)) ); return(Response.AsJson(response.Message)); } catch (ActorNotFoundException) { return(new AccountStateViewModel($"{args.actorName} is not running at the moment")); } catch (Exception e) { return(new AccountStateViewModel($"{args.actorName} {e.Message}")); } }); Get("/{actorName}/info", async args => { try { string account = args.actorName; var path = $@"/user/demoSupervisor/*/{account}"; var system = LoanerActors.DemoActorSystem .ActorSelection(path) .ResolveOne(TimeSpan.FromSeconds(3)).Result; if (system.IsNobody()) { throw new ActorNotFoundException(); } var response = await Task.Run( () => system.Ask <MyAccountStatus>(new TellMeYourInfo(), TimeSpan.FromSeconds(3)) ); response.AccountState.AuditLog.Sort((x, y) => x.EventDate >= y.EventDate ? 1 : -1); return(Response.AsJson(new AccountStateViewModel(response.AccountState))); } catch (ActorNotFoundException) { return(new AccountStateViewModel($"{args.actorName} is not running at the moment")); } catch (Exception e) { return(new AccountStateViewModel($"{args.actorName} {e.Message}")); } }); Post("/{actorName}/pay", async args => { string account = args.actorName; var payment = this.Bind <Payment>(); try { var domanCommand = new PayAccount(account, payment.AmountToPay); var system = LoanerActors.DemoActorSystem .ActorSelection($"/user/demoSupervisor/*/{account}") .ResolveOne(TimeSpan.FromSeconds(3)); if (system.Exception != null) { throw system.Exception; } var response = await Task.Run( () => system.Result.Ask <MyAccountStatus>(domanCommand, TimeSpan.FromSeconds(30)) ); return(Response.AsJson(response)); } catch (ActorNotFoundException) { return(new AccountStateViewModel($"{args.actorName} is not running at the moment")); } catch (Exception e) { return(new AccountStateViewModel($"{args.actorName} {e.Message}")); } }); // // Get("/{actorName}/assessment", args => // { // InvoiceLineItem[] lineItems = // { // new InvoiceLineItem(new Tax(0)), // new InvoiceLineItem(new Dues(0)), // new InvoiceLineItem(new Reserve(0)) // }; // // // return lineItems; // }); // Post("/{actorName}/assessment", async args => // { // string account = args.actorName; // var assessment = this.Bind<SimulateAssessmentModel>(); // // try // { // var domanCommand = new BillingAssessment(account, assessment.LineItems); // var system = LoanerActors.DemoActorSystem // .ActorSelection($"/user/demoSupervisor/*/{account}") // .ResolveOne(TimeSpan.FromSeconds(3)); // if (system.Exception != null) throw system.Exception; // var response = await Task.Run( // () => system.Result.Ask<MyAccountStatus>(domanCommand, TimeSpan.FromSeconds(30)) // ); // return Response.AsJson(response); // } // catch (ActorNotFoundException) // { // return new AccountStateViewModel($"{args.actorName} is not running at the moment"); // } // catch (Exception e) // { // return new AccountStateViewModel($"{args.actorName} {e.Message}"); // } // }); }