compute_duration_for_parking_ticket(): set calcState according to string
returned from tariff calculation.
This commit is contained in:
parent
8fa4335669
commit
57ccbc150a
@ -630,17 +630,77 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
|
||||
tariff->getPaymentOptions().pop_payment_method_id,
|
||||
cs.toLocal8Bit().constData(),
|
||||
price, false, true).c_str();
|
||||
|
||||
if (endTime == CalcState::SUCCESS) {
|
||||
calcState.setDesc(QString("SUCCESS"));
|
||||
calcState.setStatus(endTime);
|
||||
} else
|
||||
if (endTime == CalcState::ERROR_PARSING_ZONE_NR) {
|
||||
calcState.setStatus(endTime);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::ERROR_LOADING_TARIFF) {
|
||||
calcState.setStatus(endTime);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::ERROR_PARSING_TARIFF) {
|
||||
calcState.setStatus(endTime);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::NEGATIVE_PARKING_TIME) {
|
||||
calcState.setStatus(endTime);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::INVALID_START_DATE) {
|
||||
calcState.setStatus(endTime);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::WRONG_PARAM_VALUES) {
|
||||
calcState.setStatus(endTime);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::WRONG_ISO_TIME_FORMAT) {
|
||||
calcState.setStatus(endTime);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::ABOVE_MAX_PARKING_TIME) {
|
||||
calcState.setStatus(endTime);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::BELOW_MIN_PARKING_TIME) {
|
||||
calcState.setStatus(endTime);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::BELOW_MIN_PARKING_PRICE) {
|
||||
calcState.setStatus(endTime);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::ABOVE_MAX_PARKING_PRICE) {
|
||||
calcState.setDesc(CalcState::ABOVE_MAX_PARKING_PRICE);
|
||||
calcState.setStatus(CalcState::ABOVE_MAX_PARKING_PRICE);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::OVERPAID) {
|
||||
calcState.setDesc(CalcState::OVERPAID);
|
||||
calcState.setStatus(CalcState::OVERPAID);
|
||||
return calcState;
|
||||
} else
|
||||
if (endTime == CalcState::OUTSIDE_ALLOWED_PARKING_TIME) {
|
||||
calcState.setStatus(endTime);
|
||||
return calcState;
|
||||
} else {
|
||||
ticketEndTime = QDateTime::fromString(endTime,Qt::ISODate);
|
||||
|
||||
// DEBUG
|
||||
qCritical() << "compute_duration_for_parking_ticket(): ";
|
||||
qCritical() << " endTime: " << endTime;
|
||||
qCritical() << " ticketEndTime: " << ticketEndTime;
|
||||
//qCritical() << "compute_duration_for_parking_ticket(): ";
|
||||
//qCritical() << " endTime: " << endTime;
|
||||
//qCritical() << " ticketEndTime: " << ticketEndTime;
|
||||
|
||||
if (!ticketEndTime.isValid()) {
|
||||
calcState.setDesc(QString("ticketEndTime=%1").arg(endTime));
|
||||
return calcState.set(CalcState::State::WRONG_ISO_TIME_FORMAT);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return calcState.set(CalcState::State::INVALID_START_DATE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user