Fixed new OCPI authorization is requested during Start Transaction when IOP sends a Remote Start
MODIFY
src/authorization/Authorizations.ts
src/authorization/Authorizations.ts
@@ -820,7 +820,7 @@ export default class Authorizations {
if (user) {
return { user };
}
- // Create the Tag as inactive and abort
+ // Notify
void this.notifyUnknownBadgeHasBeenUsedAndAbort(action, tenant, tagID, chargingStation);
}
// Get Authorized User
@@ -876,7 +876,7 @@ export default class Authorizations {
switch (authAction) {
// OCPP Authorize
case Action.AUTHORIZE:
- // Check IOP Remote Authorization on Charging Station
+ // Retrieve Authorization ID from Charging Station (Remote Start)
user.authorizationID = await Authorizations.checkAndGetOCPIAuthorizationIDFromIOPRemoteStartTransaction(
action, tenant, chargingStation, connector, tag, transaction);
// Not found: Request one from OCPI IOP
@@ -887,9 +887,14 @@ export default class Authorizations {
break;
// OCPP Start Transaction
case Action.START_TRANSACTION:
- // Retrieve Authorization ID
+ // Retrieve Authorization ID from OCPP Authorization with Roaming badge
user.authorizationID = await Authorizations.checkAndGetOCPIAuthorizationIDFromOCPPAuthorize(
tenant, transaction);
+ if (!user.authorizationID) {
+ // Retrieve Authorization ID from Charging Station (OCPI Remote Start)
+ user.authorizationID = await Authorizations.checkAndGetOCPIAuthorizationIDFromIOPRemoteStartTransaction(
+ action, tenant, chargingStation, connector, tag, transaction);
+ }
// Not found: Request one from OCPI IOP
if (!user.authorizationID) {
user.authorizationID = await ocpiClient.authorizeToken(

MODIFY
src/server/ocpi/service/cpo/v2.1.1/CPOCommandsService.ts
src/server/ocpi/service/cpo/v2.1.1/CPOCommandsService.ts
@@ -150,7 +150,7 @@ export default class CPOCommandsService {
if (!chargingStation.remoteAuthorizations) {
chargingStation.remoteAuthorizations = [];
}
- const existingAuthorization: RemoteAuthorization = chargingStation.remoteAuthorizations.find(
+ const existingAuthorization = chargingStation.remoteAuthorizations.find(
(authorization) => authorization.connectorId === connector.connectorId);
if (existingAuthorization) {
if (OCPIUtils.isAuthorizationValid(existingAuthorization.timestamp)) {
@@ -167,14 +167,12 @@ export default class CPOCommandsService {
existingAuthorization.id = startSession.authorization_id;
existingAuthorization.tagId = startSession.token.uid;
} else {
- chargingStation.remoteAuthorizations.push(
- {
+ chargingStation.remoteAuthorizations.push({
id: startSession.authorization_id,
connectorId: connector.connectorId,
timestamp: new Date(),
tagId: startSession.token.uid
- }
- );
+ });
}
// Save Auth
await ChargingStationStorage.saveChargingStationRemoteAuthorizations(

MODIFY
src/server/oicp/oicp-services-impl/oicp-2.3.0/CPORemoteAuthorizationsEndpoint.ts
src/server/oicp/oicp-services-impl/oicp-2.3.0/CPORemoteAuthorizationsEndpoint.ts
@@ -29,7 +29,7 @@ const MODULE_NAME = 'CPORemoteAuthorizationsEndpoint';
export default class CPORemoteAuthorizationsEndpoint extends AbstractEndpoint {
// Create OICP Service
- constructor(oicpService: AbstractOICPService) {
+ public constructor(oicpService: AbstractOICPService) {
super(oicpService, EP_IDENTIFIER);
}

Fixed new OCPI authorization is requested during Start Transaction when IOP sends a Remote Start