Add and implement utilities:

int getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId);
    int getMaximalParkingTime(Configuration const *cfg, PaymentMethod methodId);
    uint32_t getMinimalParkingPrice(Configuration const *cfg, PaymentMethod methodId);
    uint32_t getFirstDurationStep(Configuration const *cfg, PaymentMethod methodId);
This commit is contained in:
Gerhard Hoffmann 2023-12-07 16:27:09 +01:00
parent 56e2843ddb
commit 5b8d9c62cc
2 changed files with 23 additions and 0 deletions

View File

@ -82,4 +82,9 @@ namespace Utilities {
bool isCarryOverSet(Configuration const *cfg, PaymentMethod paymentMethodId); bool isCarryOverSet(Configuration const *cfg, PaymentMethod paymentMethodId);
bool isCarryOverNotSet(Configuration const *cfg, PaymentMethod paymentMethodId); bool isCarryOverNotSet(Configuration const *cfg, PaymentMethod paymentMethodId);
PaymentMethod getPaymentMethodId(Configuration const *cfg); PaymentMethod getPaymentMethodId(Configuration const *cfg);
int getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId);
int getMaximalParkingTime(Configuration const *cfg, PaymentMethod methodId);
uint32_t getMinimalParkingPrice(Configuration const *cfg, PaymentMethod methodId);
uint32_t getFirstDurationStep(Configuration const *cfg, PaymentMethod methodId);
} }

View File

@ -373,3 +373,21 @@ PaymentMethod Utilities::getPaymentMethodId(Configuration const *cfg) {
return PaymentMethod::Undefined; return PaymentMethod::Undefined;
} }
int Utilities::getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId) {
return std::max((int)cfg->PaymentOption.find(methodId)->second.pop_min_time, 0);
}
int Utilities::getMaximalParkingTime(Configuration const *cfg, PaymentMethod methodId) {
return std::max((int)cfg->PaymentOption.find(methodId)->second.pop_max_time, 0);
}
uint32_t Utilities::getMinimalParkingPrice(Configuration const *cfg, PaymentMethod methodId) {
return std::max((int)cfg->PaymentOption.find(methodId)->second.pop_min_price, 0);
}
uint32_t Utilities::getFirstDurationStep(Configuration const *cfg, PaymentMethod methodId) {
int popId = cfg->PaymentOption.find(methodId)->second.pop_id;
int punId = cfg->PaymentRate.find(popId)->second.pra_payment_unit_id;
return cfg->Duration.find(punId)->second.pun_id;
}