compute_price_for_parking_ticket(): add handling for PaymentMethod::Steps.
This commit is contained in:
parent
57d6b85f52
commit
aba38d2614
@ -428,14 +428,23 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
return calcState.set(CalcState::State::SUCCESS);
|
return calcState.set(CalcState::State::SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double cost = -1;
|
||||||
if (start_parking_time.isValid()) {
|
if (start_parking_time.isValid()) {
|
||||||
double cost = Calculator::GetInstance().GetCostFromDuration(
|
if (tariff->getPaymentOptions().pop_payment_method_id == PaymentMethod::Steps) {
|
||||||
|
calcState = Calculator::GetInstance().isParkingAllowed(tariff, start_parking_time);
|
||||||
|
if (calcState.getStatus() == CalcState::State::OUTSIDE_ALLOWED_PARKING_TIME) {
|
||||||
|
return calcState;
|
||||||
|
}
|
||||||
|
cost = Calculator::GetInstance().GetCostFromDuration(tariff, start_parking_time, netto_parking_time);
|
||||||
|
} else {
|
||||||
|
cost = Calculator::GetInstance().GetCostFromDuration(
|
||||||
tariff,
|
tariff,
|
||||||
tariff->getPaymentOptions().pop_payment_method_id,
|
tariff->getPaymentOptions().pop_payment_method_id,
|
||||||
start_parking_time, // starting time
|
start_parking_time, // starting time
|
||||||
end_parking_time, // return value: end time
|
end_parking_time, // return value: end time
|
||||||
netto_parking_time, // minutes, netto
|
netto_parking_time, // minutes, netto
|
||||||
false, prepaid);
|
false, prepaid);
|
||||||
|
}
|
||||||
double minCost = tariff->getPaymentOptions().pop_min_price;
|
double minCost = tariff->getPaymentOptions().pop_min_price;
|
||||||
if (cost < minCost) {
|
if (cost < minCost) {
|
||||||
calcState.setDesc(QString("minCost=%1, cost=%2").arg(minCost, cost));
|
calcState.setDesc(QString("minCost=%1, cost=%2").arg(minCost, cost));
|
||||||
@ -445,8 +454,10 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
// DEBUG
|
// DEBUG
|
||||||
qCritical() << " -> calculated cost (price->netto) = " << cost;
|
qCritical() << " -> calculated cost (price->netto) = " << cost;
|
||||||
|
|
||||||
|
price->brutto = price->vat = price->vat_percentage = 0;
|
||||||
price->units = cost;
|
price->units = cost;
|
||||||
price->netto = cost;
|
price->netto = cost;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return calcState.set(CalcState::State::INVALID_START_DATE);
|
return calcState.set(CalcState::State::INVALID_START_DATE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user