feat(falukant): add transport cost option to product price calculations
All checks were successful
Deploy to production / deploy (push) Successful in 2m49s
All checks were successful
Deploy to production / deploy (push) Successful in 2m49s
- Updated the `getProductPricesInCitiesBatch` method in FalukantService to accept an options parameter for including transport costs in price calculations. - Modified the tax calculation logic to conditionally apply transport costs based on the new parameter, enhancing the accuracy of pricing based on regional differences. - Adjusted the FalukantController to pass the includeTransportCosts option from the request body, improving flexibility in pricing queries.
This commit is contained in:
@@ -262,11 +262,17 @@ class FalukantController {
|
||||
const body = req.body || {};
|
||||
const items = Array.isArray(body.items) ? body.items : [];
|
||||
const currentRegionId = body.currentRegionId != null ? parseInt(body.currentRegionId, 10) : null;
|
||||
const includeTransportCosts = body.includeTransportCosts === true || body.includeTransportCosts === 'true';
|
||||
const valid = items.map(i => ({
|
||||
productId: parseInt(i.productId, 10),
|
||||
currentPrice: parseFloat(i.currentPrice)
|
||||
})).filter(i => !Number.isNaN(i.productId) && !Number.isNaN(i.currentPrice));
|
||||
return this.service.getProductPricesInCitiesBatch(userId, valid, Number.isNaN(currentRegionId) ? null : currentRegionId);
|
||||
return this.service.getProductPricesInCitiesBatch(
|
||||
userId,
|
||||
valid,
|
||||
Number.isNaN(currentRegionId) ? null : currentRegionId,
|
||||
{ includeTransportCosts }
|
||||
);
|
||||
});
|
||||
this.renovate = this._wrapWithUser((userId, req) => this.service.renovate(userId, req.body.element), { blockInDebtorsPrison: true });
|
||||
this.renovateAll = this._wrapWithUser((userId) => this.service.renovateAll(userId), { blockInDebtorsPrison: true });
|
||||
|
||||
Reference in New Issue
Block a user