Start transaction with null car ID
MODIFY
src/storage/mongodb/TransactionStorage.ts
src/storage/mongodb/TransactionStorage.ts
@@ -57,7 +57,7 @@ export default class TransactionStorage {
siteAreaID: Utils.convertToObjectID(transactionToSave.siteAreaID),
connectorId: Utils.convertToInt(transactionToSave.connectorId),
tagID: transactionToSave.tagID,
- carID: Utils.convertToObjectID(transactionToSave.carID),
+ carID: transactionToSave.carID ? Utils.convertToObjectID(transactionToSave.carID) : null,
userID: Utils.convertToObjectID(transactionToSave.userID),
chargeBoxID: transactionToSave.chargeBoxID,
meterStart: Utils.convertToInt(transactionToSave.meterStart),
@@ -1235,11 +1235,15 @@ export default class TransactionStorage {
];
case TransactionInErrorType.NO_BILLING_DATA:
return [
- { $match: { $or: [
+ {
+ $match: {
+ $or: [
{ 'billingData': { $exists: false } },
{ 'billingData.invoiceID': { $exists: false } },
{ 'billingData.invoiceID': { $eq: null } }
- ] } },
+ ]
+ }
+ },
{ $addFields: { 'errorCode': TransactionInErrorType.NO_BILLING_DATA } }
];
break;

Start transaction with null car ID