Пример #1
0
        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));
        }
Пример #3
0
 public override Money DetermineCostOfCall(Minutes minutes)
 {
     return new Money(0);
 }
Пример #4
0
 public Money DetermineCostOfCall(Minutes minutes)
 {
     return minutes.CostAt(PricePerMinute);
 }
Пример #5
0
 public PhoneCallCharged(Guid aggregateId, PhoneCall phoneCall, Money costOfCall, Minutes coveredByAllowance) : base (aggregateId)
 {
     PhoneCall = phoneCall;
     CostOfCall = costOfCall;
     CoveredByAllowance = coveredByAllowance;
 }
Пример #6
0
 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));
 }
Пример #10
0
 public void Subtract(Minutes minutes)
 {
     Allowance = Allowance.Subtract(minutes);
 }
Пример #11
0
 public FreeCallAllowance(Minutes allowance, DateTime dateStarted)
 {
     Allowance = allowance;
     DateStarted = dateStarted;
 }
 public PayAsYouGoInclusiveMinutesOffer(Money spendThreshold, Minutes freeMinutes)
 {
     this.spendThreshold = spendThreshold;
     FreeMinutes = freeMinutes;
 }
Пример #13
0
 public PhoneCall(PhoneNumber numberDialled, DateTime callStart, Minutes callLength)
 {
     NumberDialled = numberDialled;
     Minutes = callLength;
     StartTime = callStart;
 }
Пример #14
0
 public PayAsYouGoInclusiveMinutesOffer(Money spendThreshold, Minutes freeMinutes)
 {
     this.spendThreshold = spendThreshold;
     FreeMinutes         = freeMinutes;
 }
Пример #15
0
 public Minutes Subtract(Minutes minutes)
 {            
     return new Minutes(Number - minutes.Number);
 }
Пример #16
0
 public bool IsGreaterOrEqualTo(Minutes minutes)
 {
     return this.Number >= minutes.Number;
 }
 public PayAsYouGoInclusiveMinutesOffer()
 {
     spendThreshold = new Money(10m);
     FreeMinutes = new Minutes(90);
 }
Пример #18
0
 public CreditSatisfiesFreeCallAllowanceOffer(Guid aggregateId, DateTime offerSatisfied, Minutes freeMinutes)
     : base(aggregateId)
 {
     OfferSatisfied = offerSatisfied;
     FreeMinutes    = freeMinutes;
 }
Пример #19
0
 public FreeCallAllowance(Minutes allowance, DateTime dateStarted)
 {
     Allowance   = allowance;
     DateStarted = dateStarted;
 }
 public PhoneCall(PhoneNumber numberDialled, DateTime callStart, Minutes callLength)
 {
     NumberDialled = numberDialled;
     Minutes       = callLength;
     StartTime     = callStart;
 }
Пример #21
0
 public void Subtract(Minutes minutes)
 {
     Allowance = Allowance.Subtract(minutes);
 }
 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;
 }