Use Session optimized consumptions to send OCPI Session/CDR
MODIFY
src/client/ocpi/CpoOCPIClient.ts
src/client/ocpi/CpoOCPIClient.ts
@@ -1037,11 +1037,11 @@ export default class CpoOCPIClient extends OCPIClient {
return [];
}
const chargingPeriods: OCPIChargingPeriod[] = [];
- const consumptions = await ConsumptionStorage.getTransactionConsumptions(
+ const consumptions = await ConsumptionStorage.getOptimizedTransactionConsumptions(
tenant, { transactionId: transaction.id });
- if (consumptions.result) {
+ if (consumptions) {
// Build based on consumptions
- for (const consumption of consumptions.result) {
+ for (const consumption of consumptions) {
const chargingPeriod = this.buildChargingPeriod(consumption);
if (!Utils.isEmptyArray(chargingPeriod?.dimensions)) {
chargingPeriods.push(chargingPeriod);

Use Session optimized consumptions to send OCPI Session/CDR