Check if charging station is public
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -420,7 +420,7 @@ export default class OCPPService {
if (transaction.ocpiData?.session) {
// Handle OCPI
await OCPPUtils.processOCPITransaction(headers.tenantID, transaction, chargingStation, TransactionAction.UPDATE);
- } else if (transaction.oicpData?.session) {
+ } else if (transaction.oicpData?.session.id) {
// Handle OICP
await OCPPUtils.processOICPTransaction(headers.tenantID, transaction, chargingStation, TransactionAction.UPDATE);
}
@@ -484,6 +484,7 @@ export default class OCPPService {
authorize.idTag, ServerAction.AUTHORIZE, Action.AUTHORIZE);
// Roaming User
if (user && !user.issuer) {
+ if (chargingStation.public) {
const tenant: Tenant = await TenantStorage.getTenant(headers.tenantID);
// OCPI User
if (Utils.isTenantComponentActive(tenant, TenantComponents.OCPI) && user.authorizationID) {
@@ -505,6 +506,15 @@ export default class OCPPService {
const response = await oicpClient.authorizeStart(authorize.idTag, user);
authorize.authorizationId = response.SessionID;
}
+ } else {
+ throw new BackendError({
+ user: user,
+ action: ServerAction.AUTHORIZE,
+ module: MODULE_NAME,
+ method: 'handleAuthorize',
+ message: 'Roaming user cannot authorize on private charging station'
+ });
+ }
}
// Set
authorize.user = user;

Check if charging station is public