Keep bacjward compatibility before using payment-method Unified.

This commit is contained in:
Gerhard Hoffmann 2024-09-27 14:24:10 +02:00
parent fd99c20bd9
commit d4363e71cd

View File

@ -989,7 +989,7 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
netto_parking_time, // minutes, netto
false, prepaid);
}
// qCritical() << __func__ << __LINE__;
double minCost = tariff->getPaymentOptions(paymentOptionIndex).pop_min_price;
if (cost < minCost) {
calcState.setDesc(QString("line=%1 minCost=%2, cost=%3").arg(__LINE__).arg(minCost).arg(cost));
@ -1145,6 +1145,9 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
QString endTime = p_endTime.first.c_str();
ticketEndTime = p_endTime.second;
qCritical() << __func__ << ":" << __LINE__ << endTime;
qCritical() << __func__ << ":" << __LINE__ << ticketEndTime.toString(Qt::ISODate);
if (endTime == CalcState::SUCCESS) {
calcState.setDesc(QString("SUCCESS"));
calcState.setStatus(endTime);
@ -1225,6 +1228,8 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
return calcState.set(CalcState::State::WRONG_ISO_TIME_FORMAT);
}
if (tariff->getPaymentOptions().pop_payment_method_id != PaymentMethod::Unified) {
if (pop_time_step_config == (int)ATBTimeStepConfig::TimeStepConfig::STATIC) {
// handle carry over for ticket-end-time
qCritical() << __func__ << ":" << __LINE__ << "ticketEndTime:" << ticketEndTime.toString(Qt::ISODate);
@ -1375,6 +1380,7 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
return calcState.set(CalcState::State::ABOVE_MAX_PARKING_TIME);
}
}
}
if (ticketEndTime.time().hour() == 0 && ticketEndTime.time().minute() == 0) {
ticketEndTime = ticketEndTime.addDays(-1);