/// <summary> /// 充值(充值指定类型的资金费用,如果没有该类型资金则创建该类型资金并充值) /// </summary> /// <param name="amount">金额</param> /// <param name="payType">支付类型</param> /// <param name="capitalType">资金类型</param> /// <param name="desc"></param> public void Recharge(decimal amount, string payType, string capitalType) { var capital = Capitals.SingleOrDefault(s => s.CapitalType == capitalType); if (capital == null) { capital = new Capital(Id, capitalType); Capitals.Add(capital); } capital.ChangeBalance(amount, BillingType.Recharge, payType); }
public OnCapitalBalanceChanged([NotNull] Capital capital, [NotNull] BillingType billingType, decimal changedAmount, string payType, string desc) : base() { Check.NotNull(capital, nameof(capital)); Check.NotNullOrWhiteSpace(capital.AccountId, nameof(AccountId)); Check.NotNullOrWhiteSpace(capital.CapitalType, nameof(CapitalType)); Check.NotNull(billingType, nameof(BillingType)); AccountId = capital.AccountId; CapitalType = capital.CapitalType; Balance = capital.Balance; ChangedAmount = changedAmount; PayType = payType; Desc = desc; BillingType = billingType.Key; }