Implement compute_procuct_price()
This commit is contained in:
parent
6d18ce4caa
commit
bd1bdf8a8c
@ -76,6 +76,32 @@ int CALCULATE_LIBRARY_API get_minimal_parkingprice(Configuration *cfg, PERMIT_TY
|
|||||||
return minPrice;
|
return minPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CALCULATE_LIBRARY_API compute_product_price(Configuration const *cfg, PERMIT_TYPE permitType) {
|
||||||
|
|
||||||
|
switch(permitType) {
|
||||||
|
case PERMIT_TYPE::SHORT_TERM_PARKING: { // e.g. szeged (customer_281)
|
||||||
|
} break;
|
||||||
|
case PERMIT_TYPE::DAY_TICKET_CHILD:
|
||||||
|
// [[fallthrough]];
|
||||||
|
case PERMIT_TYPE::DAY_TICKET_TEEN:
|
||||||
|
// [[fallthrough]];
|
||||||
|
case PERMIT_TYPE::DAY_TICKET_ADULT: {
|
||||||
|
std::optional<QVector<ATBTariffProduct>> products = cfg->getTariffProductForProductId(permitType);
|
||||||
|
if (products) {
|
||||||
|
QVector<ATBTariffProduct> product = products.value();
|
||||||
|
if (product.size() > 0) {
|
||||||
|
ATBTariffProduct const &p = product[0];
|
||||||
|
return p.m_tariff_product_price;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int CALCULATE_LIBRARY_API get_maximal_parkingprice(Configuration *cfg, PERMIT_TYPE permitType) {
|
int CALCULATE_LIBRARY_API get_maximal_parkingprice(Configuration *cfg, PERMIT_TYPE permitType) {
|
||||||
int maxPrice = -1;
|
int maxPrice = -1;
|
||||||
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
||||||
|
Loading…
Reference in New Issue
Block a user