compute_price_for_parking_ticket(): compute paymentOptionIndex.
(a tariff-file can conatin more than one payment options).
This commit is contained in:
parent
e2c02420f0
commit
1852f552a3
@ -445,8 +445,11 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
bool prepaid)
|
bool prepaid)
|
||||||
{
|
{
|
||||||
CalcState calcState;
|
CalcState calcState;
|
||||||
double minMin = tariff->getPaymentOptions().pop_min_time;
|
|
||||||
double maxMin = tariff->getPaymentOptions().pop_max_time;
|
int paymentOptionIndex = tariff->getPaymentOptionIndex(start_parking_time);
|
||||||
|
|
||||||
|
double minMin = tariff->getPaymentOptions(paymentOptionIndex).pop_min_time;
|
||||||
|
double maxMin = tariff->getPaymentOptions(paymentOptionIndex).pop_max_time;
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
qCritical() << "compute_price_for_parking_ticket() " << endl
|
qCritical() << "compute_price_for_parking_ticket() " << endl
|
||||||
@ -477,11 +480,13 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
double cost = -1;
|
double cost = -1;
|
||||||
if (start_parking_time.isValid()) {
|
if (start_parking_time.isValid()) {
|
||||||
if (tariff->getPaymentOptions().pop_payment_method_id == PaymentMethod::Steps) {
|
if (tariff->getPaymentOptions().pop_payment_method_id == PaymentMethod::Steps) {
|
||||||
calcState = Calculator::GetInstance().isParkingAllowed(tariff, start_parking_time);
|
// hier muesste man unterscheiden: uebertrag oder nicht?
|
||||||
|
calcState = Calculator::GetInstance().isParkingAllowed(tariff, start_parking_time,
|
||||||
|
netto_parking_time, paymentOptionIndex);
|
||||||
if (calcState.getStatus() == CalcState::State::OUTSIDE_ALLOWED_PARKING_TIME) {
|
if (calcState.getStatus() == CalcState::State::OUTSIDE_ALLOWED_PARKING_TIME) {
|
||||||
return calcState;
|
return calcState;
|
||||||
}
|
}
|
||||||
cost = Calculator::GetInstance().GetCostFromDuration(tariff, start_parking_time, netto_parking_time);
|
cost = Calculator::GetInstance().GetCostFromDuration(tariff, start_parking_time, netto_parking_time, paymentOptionIndex);
|
||||||
} else {
|
} else {
|
||||||
cost = Calculator::GetInstance().GetCostFromDuration(
|
cost = Calculator::GetInstance().GetCostFromDuration(
|
||||||
tariff,
|
tariff,
|
||||||
@ -491,7 +496,7 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
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(paymentOptionIndex).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));
|
||||||
return calcState.set(CalcState::State::BELOW_MIN_PARKING_PRICE);
|
return calcState.set(CalcState::State::BELOW_MIN_PARKING_PRICE);
|
||||||
|
Loading…
Reference in New Issue
Block a user