Beispiel #1
0
 public Money PayableAt(Money money, Amount expense, Timestamp time) =>
 money is GiftCard gift && gift.ValidBefore.CompareTo(time) < 0 ? Amount.Zero(expense.Currency)
Beispiel #2
0
 public virtual Amount Subtract(Amount other) =>
 other == null ? throw new ArgumentNullException(nameof(other))
     : other.Currency != this.Currency ? throw new ArgumentException("Mismatched currency.")
     : other.Value > this.Value ? throw new ArgumentException("Insufficient funds.")
     : new Amount(this.Currency, this.Value - other.Value);
Beispiel #3
0
 public virtual Amount Add(Amount other) =>
 other == null ? throw new ArgumentNullException(nameof(other))
     : other.Currency != this.Currency ? throw new ArgumentException("Mismatched currency.")
     : new Amount(this.Currency, this.Value + other.Value);
 public (Amount paid, Wallet remaining) Pay(Amount expense, Timestamp time) =>
 this.Moneys
Beispiel #5
0
 public override Tuple <Amount, Money> Take(Currency currency, decimal amount) =>
 Tuple.Create(Amount.Zero(currency), (Money)this);
 public InvoiceLine(Amount basePrice, ITax tax)
 {
     BasePrice =
         basePrice ?? throw new ArgumentNullException(nameof(basePrice));
     Tax = tax ?? throw new ArgumentNullException(nameof(tax));
 }