예제 #1
0
 public Money PayableAt(Money money, Amount expense, Timestamp time) =>
 money is GiftCard gift && gift.ValidBefore.CompareTo(time) < 0 ? Amount.Zero(expense.Currency)
예제 #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);
예제 #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);
예제 #4
0
 public (Amount paid, Wallet remaining) Pay(Amount expense, Timestamp time) =>
 this.Moneys
예제 #5
0
 public override Tuple <Amount, Money> Take(Currency currency, decimal amount) =>
 Tuple.Create(Amount.Zero(currency), (Money)this);
예제 #6
0
 public InvoiceLine(Amount basePrice, ITax tax)
 {
     BasePrice =
         basePrice ?? throw new ArgumentNullException(nameof(basePrice));
     Tax = tax ?? throw new ArgumentNullException(nameof(tax));
 }