Implemented compute_price_for_daily_ticket().
This commit is contained in:
parent
6bf3960349
commit
4c1cd45866
@ -497,3 +497,27 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_daily_ticket(parking_tariff
|
|||||||
return calcState.set(CalcState::State::SUCCESS);
|
return calcState.set(CalcState::State::SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CalcState CALCULATE_LIBRARY_API compute_price_for_daily_ticket(
|
||||||
|
parking_tariff_t *tariff,
|
||||||
|
QDateTime const &startDatetime,
|
||||||
|
QDateTime &endDatetime,
|
||||||
|
PERMIT_TYPE permitType,
|
||||||
|
struct price_t *price) {// return value
|
||||||
|
CalcState calcState;
|
||||||
|
|
||||||
|
|
||||||
|
if (startDatetime.isValid()) {
|
||||||
|
if (std::optional<struct price_t> p =
|
||||||
|
Calculator::GetInstance().GetDailyTicketPrice(tariff,
|
||||||
|
startDatetime,
|
||||||
|
endDatetime,
|
||||||
|
permitType)) {
|
||||||
|
*price = p.value();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return calcState.set(CalcState::State::INVALID_START_DATE);
|
||||||
|
}
|
||||||
|
return calcState.set(CalcState::State::SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user