The Aggregated Purchase Duration (APD) Tariff Selection supports top-up for purchase made during a specified period. These purchases may be ended but must be made in the specified period to be included in the Top-up.
The Aggregated Purchase Duration (APD) Tariff Selection summarizes the number of parking minutes used for a given license plate and tariff id and optional the Country/State within a predefined period. The provider accepts license plate and optional Country/State input and looks up ongoing and completed purchases for this license plate for the configured period and tariff id.
The Tariff id used in the look-up is configured in the Service Provider Configuration section and will be returned in the response. The period to use for the evaluation of purchase history is configured in the same section.
There are two types of the Evaluation Time Window:
•Relative time = Within the last X minutes from the time when the evaluation is done.
•Absolute time = Within interval between last occurrence and now. Specify the date using the following fields.
oMinute (0-59)
oHour (0-23)
oDayOfWeek (1-7)
oDayOfMonth (1-31)
All of these settings can be configured together. Using DayOfWeek and DayOfMonth in combinations is however not recommended.
The number of minutes (DurationInMinutes) is part of the response from the provider, together with the start time and the tariff id. The start time is set to the current time if there are no active ongoing purchases for the given license plate, Country/State, and tariff id. Otherwise it is set to the end time of the active ongoing purchase. Start time is hence set to either now or a time in the future.
A CWT should then be able to calculate the cost of the new purchase following these steps.
1.Calculate the cost of all purchases (incl. new purchase) in scope:
oCalculation Start = providerResponse.Start – providerResponse.DurationInMinutes
oCalculation End = user selected end time.
2.Calculate the cost for earlier purchases in scope:
oCalculation Start = providerResponse.Start – providerResponse.DurationInMinutes
oCalculation End = providerResponse.Start
3.New purchase:
oAmount = AllPurchasesInScope.Amount – EarlierPurchasesInScope.Amount
oStart = providerResponse.Start
oEnd = user selected end time
Since we aggregate time from several purchases, not necessarily continuous, this will only work if all purchases in this period are made with the same Tariff.
The number of minutes is used by CWT to determine three things:
1.To prevent new purchase, if all the time allowed for the day was already used up.
2.To determine the current price in case the tariff is different depending on how much time was already used up.
3.To restrict the purchase end time, in case the parker is trying to park for longer than is allowed.
Examples
•Evaluate Rolling Daily, starting 05:00
=> Hour = 5
•Evaluate Rolling Weekly, starting Monday 04:30
=> DayOfWeek = 1, Hour = 4, Minute = 30
•Evaluate Rolling Monthly, starting 1st 00:00
=> DayOfMonth = 1