public void Pay(Billing billing) { if (!CanPay(billing)) { throw new DomainException($"{Identifier.Id} company cannot pay for the billing"); } Balance -= billing.Money; }
private void UpdateBilling() { Money billingMoney = Money.Zero(Billing.Money.Currency); foreach (var trigger in Triggers) { billingMoney += trigger.Money; } Billing = new Billing(billingMoney, Billing.CompanyIdentifier); }
public TriggerOrder(string description, IList <Trigger> triggers, Billing billing) { Description = description; Triggers = triggers; Billing = billing; }
public TriggerOrder(string description, CompanyIdentifier companyIdentifier, Currency currency) { Description = description; Triggers = new List <Trigger>(); Billing = new Billing(Money.Zero(currency), companyIdentifier); }
public bool CanPay(Billing billing) => Money.AreCurrenciesMatch(billing.Money, Balance) && ((Balance + MaximumDebit[Balance.Currency]) >= billing.Money);
public TriggerOrder(string description, IList <Trigger> triggers, Billing billing) { Description = description; Triggers = ImmutableList.CreateRange(triggers); ScheduledDate = DateTime.UtcNow + TimeSpan.FromSeconds(5); }