public void Record(PhoneCall phoneCall, PhoneCallCosting phoneCallCosting, IClock clock) { var numberOfMinutesCoveredByAllowance = new Minutes(); if (_freeCallAllowance != null) numberOfMinutesCoveredByAllowance = _freeCallAllowance.MinutesWhichCanCover(phoneCall, clock); var numberOfMinutesToChargeFor = phoneCall.Minutes.Subtract(numberOfMinutesCoveredByAllowance); var costOfCall = phoneCallCosting.DetermineCostOfCall(numberOfMinutesToChargeFor); Causes(new PhoneCallCharged(this.Id, phoneCall, costOfCall, numberOfMinutesCoveredByAllowance)); }
public void Record(PhoneCall phoneCall, PhoneCallCosting phoneCallCosting, IClock clock) { var numberOfMinutesCoveredByAllowance = new Minutes(); if (_freeCallAllowance != null) { numberOfMinutesCoveredByAllowance = _freeCallAllowance.MinutesWhichCanCover(phoneCall, clock); } var numberOfMinutesToChargeFor = phoneCall.Minutes.Subtract(numberOfMinutesCoveredByAllowance); var costOfCall = phoneCallCosting.DetermineCostOfCall(numberOfMinutesToChargeFor); Causes(new PhoneCallCharged(this.Id, phoneCall, costOfCall, numberOfMinutesCoveredByAllowance)); }
public override Money DetermineCostOfCall(Minutes minutes) { return new Money(0); }
public Money DetermineCostOfCall(Minutes minutes) { return minutes.CostAt(PricePerMinute); }
public PhoneCallCharged(Guid aggregateId, PhoneCall phoneCall, Money costOfCall, Minutes coveredByAllowance) : base (aggregateId) { PhoneCall = phoneCall; CostOfCall = costOfCall; CoveredByAllowance = coveredByAllowance; }
public PayAsYouGoInclusiveMinutesOffer() { spendThreshold = new Money(10m); FreeMinutes = new Minutes(90); }
public Minutes Subtract(Minutes minutes) { return(new Minutes(Number - minutes.Number)); }
public CreditSatisfiesFreeCallAllowanceOffer(Guid aggregateId, DateTime offerSatisfied, Minutes freeMinutes) : base(aggregateId) { OfferSatisfied = offerSatisfied; FreeMinutes = freeMinutes; }
public virtual Money DetermineCostOfCall(Minutes minutes) { return(minutes.CostAt(PricePerMinute)); }
public void Subtract(Minutes minutes) { Allowance = Allowance.Subtract(minutes); }
public FreeCallAllowance(Minutes allowance, DateTime dateStarted) { Allowance = allowance; DateStarted = dateStarted; }
public PayAsYouGoInclusiveMinutesOffer(Money spendThreshold, Minutes freeMinutes) { this.spendThreshold = spendThreshold; FreeMinutes = freeMinutes; }
public PhoneCall(PhoneNumber numberDialled, DateTime callStart, Minutes callLength) { NumberDialled = numberDialled; Minutes = callLength; StartTime = callStart; }
public Minutes Subtract(Minutes minutes) { return new Minutes(Number - minutes.Number); }
public bool IsGreaterOrEqualTo(Minutes minutes) { return this.Number >= minutes.Number; }
public bool IsGreaterOrEqualTo(Minutes minutes) { return(this.Number >= minutes.Number); }
public PhoneCallCharged(Guid aggregateId, PhoneCall phoneCall, Money costOfCall, Minutes coveredByAllowance) : base(aggregateId) { PhoneCall = phoneCall; CostOfCall = costOfCall; CoveredByAllowance = coveredByAllowance; }