Soft stop external transactions
MODIFY
src/client/ocpi/EmspOCPIClient.ts
src/client/ocpi/EmspOCPIClient.ts
@@ -409,11 +409,11 @@ export default class EmspOCPIClient extends OCPIClient {
module: MODULE_NAME, method: 'remoteStopSession'
});
}
- if (!transaction.issuer) {
+ if (transaction.issuer) {
throw new BackendError({
...LoggingHelper.getTransactionProperties(transaction),
action: ServerAction.OCPI_EMSP_START_SESSION,
- message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} Transaction belongs to an external organization`,
+ message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} Transaction belongs to a local organization`,
module: MODULE_NAME, method: 'remoteStopSession',
detailedMessages: { transaction }
});

MODIFY
src/server/rest/v1/service/TransactionService.ts
src/server/rest/v1/service/TransactionService.ts
@@ -339,12 +339,12 @@ export default class TransactionService {
// Get data
const { transaction, chargingStation, connector } =
await TransactionService.checkAndGetTransactionChargingStationConnector(action, req.tenant, req.user, transactionID);
+ req.body.chargingStationID = transaction.chargeBoxID;
+ req.body.args = { transactionId: transaction.id };
// Handle the routing
if (chargingStation.issuer) {
// OCPP Remote Stop
if (!chargingStation.inactive && connector.currentTransactionID === transaction.id) {
- req.body.chargingStationID = transaction.chargeBoxID;
- req.body.args = { transactionId: transaction.id };
await ChargingStationService.handleOcppAction(ServerAction.CHARGING_STATION_REMOTE_STOP_TRANSACTION, req, res, next);
// Transaction Soft Stop
} else {
@@ -352,8 +352,14 @@ export default class TransactionService {
transaction, chargingStation, connector, req, res, next);
}
} else {
+ // eslint-disable-next-line no-lonely-if
+ if (connector.currentTransactionID === transaction.id) {
// OCPI Remote Stop
await ChargingStationService.handleOcpiAction(ServerAction.OCPI_EMSP_STOP_SESSION, req, res, next);
+ } else {
+ await TransactionService.transactionSoftStop(ServerAction.TRANSACTION_SOFT_STOP,
+ transaction, chargingStation, connector, req, res, next);
+ }
}
}

Soft stop external transactions