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