public decimal ApplyDiscount(RentalCollection rentals)
        {
            var originalPrice = rentals.GetTotalPrice();

            if (IsApplicable(rentals))
            {
                return(originalPrice * 0.7m);
            }
            else
            {
                return(originalPrice);
            }
        }
        //

        private void AddRental(CallbackParameterContainer instructionSet)
        {
            var client     = new FirstForRentalsService();
            var collection = RentalCollection.ReturnObject(instructionSet.Parameters[0]);

            var rentailId = client.InsertRental("1", collection.RentalId, collection.StartDate, collection.EndDate, collection.StartDestination, collection.EndDestination);

            var status = client.InsertPayment(rentailId, collection.RentalDate, collection.StartDestination, collection.EndDestination, collection.RentalAmount,
                                              collection.InsuranceAmount, collection.ExtrasAmount, collection.VatAmount, collection.TotalAmount,
                                              collection.DepositAmount, collection.DepositStatus, collection.PaymentStatus);

            if (status)
            {
                returnObject = new CallbackReturnContainer("VehicleRentalAdded");
            }
        }
Ejemplo n.º 3
0
 public Transaction()
 {
     Rentals = new RentalCollection();
 }
 private bool IsApplicable(RentalCollection rentals)
 {
     return(Enumerable.Range(3, 3).Contains(rentals.Rentals.Count()));
 }