Exemple #1
0
        /// <summary>
        /// Get booking ids for a check in date and channel booking scenario
        /// </summary>
        /// <param name="checkInDate">Check in date</param>
        /// <param name="channelBookingScenario">Channel booking scenario</param>
        /// <returns>
        /// The list of bookings with Id populated only 
        /// </returns>
        public List<int> GetBookingIdsByCheckInDateAndChannelScenario(DateTime checkInDate, BookingScenarioTypeEnum channelBookingScenario)
        {
            const string SQL_QUERY = @"SELECT B.Id
                                       FROM Booking.Booking B
                                       INNER JOIN Booking.Orders O ON O.Id = B.OrderId
                                       INNER JOIN Distribution.Channel C ON C.Id = O.ChannelId
                                       INNER JOIN Distribution.ChannelBookingScenario CBS ON CBS.ChannelId = C.Id
                                       WHERE DATEADD(dd, 0, DATEDIFF(dd, 0, B.CheckinDatetime)) = @CheckinDate AND CBS.BookingScenarioCode = @BookingScenarioCode";

            var parameters = new List<SqlParameter>
            {
                DbHelper.CreateParameter(BookingMapper.Parameters.CheckinDate, checkInDate),
                DbHelper.CreateParameter(BookingMapper.Parameters.BookingScenarioCode, channelBookingScenario.GetCode())
            };

            return DbHelper.CreateValueList<int>(SQL_QUERY, BookingMapper.Parameters.Id.ToString(), parameters: parameters);
        }
            public void GetAgentPaymentAmountReturnsCorrectAmountsForScenariosGiven(BookingScenarioTypeEnum scenarioType, decimal totalBookingValue, decimal distributorPercentage, decimal expectedPercent)
            {
                // Arrange
                // done through test cases

                // Act
                SettlementManager settlementManager = new SettlementManager();

                decimal result = settlementManager.GetAgentPaymentAmount(scenarioType, totalBookingValue,
                                                                         distributorPercentage);

                // Assert
                Assert.AreEqual(expectedPercent, result, string.Format("percentage did not match test case. scenario:{0}, ttv:{1}, percentage:{2}, expected:{3}", scenarioType.GetCode(), totalBookingValue, distributorPercentage, expectedPercent));
            }  
Exemple #3
0
        /// <summary>
        /// Generate a modified event for all bookings that match the passed criteria
        /// This method is used by Eagle Batch Service to trigger events so the bookings are sent to Settlement
        /// This is because ABS will process all VPayments for LastMinute on the day of checking in so when the
        /// event is created the bookings will be resent to Settlement and will contain the payment details from ABS
        /// </summary>
        /// <param name="checkInDate">Check in date (Should always be TODAY)</param>
        /// <param name="channelBookingScenario">Channel booking scenario (Should always be VPAY)</param>
        /// <param name="eventNotes">Event notes</param>
        /// <returns>
        /// Count of bookings Ids
        /// </returns>
        public int ProcessAllBookingsByCheckInDateAndChannelScenario(DateTime checkInDate, BookingScenarioTypeEnum channelBookingScenario, string eventNotes)
        {
            var bookingIds = bookingDao.GetBookingIdsByCheckInDateAndChannelScenario(checkInDate, channelBookingScenario);

            foreach (var bookingId in bookingIds)
            {
                eventTrackingManager.CreateBookingEvent(bookingId, BookingEventType.Modified, eventNotes);
            }

            return bookingIds.Count;
        }
Exemple #4
0
        /// <summary>
        /// Calculate Agent payment from scenario type, total booking value, and distributor percentage
        /// </summary>
        /// <param name="bookingScenarioTypeEnum">For determining the scenario</param>
        /// <param name="totalBookingValue">total booking value to use</param>
        /// <param name="distributorPercentage">percentage from distributor</param>
        /// <returns>Agent payment amount (zero if not a particular scenario)</returns>
        public virtual decimal GetAgentPaymentAmount(BookingScenarioTypeEnum bookingScenarioTypeEnum, decimal totalBookingValue, decimal distributorPercentage)
        {
            if (bookingScenarioTypeEnum == BookingScenarioTypeEnum.DistributorDeposit)
            {
                // percentage stored as display percentage rather than actual percentage
                return totalBookingValue * (distributorPercentage / 100);
            }
            else if (bookingScenarioTypeEnum == BookingScenarioTypeEnum.OnAccountBooking)
            {
                return totalBookingValue;
            }

            return default(decimal);
        }