Fixed Roaming RFID Cards cannot start a Transaction when access control is disabled in Site Area
MODIFY
src/scheduler/tasks/ocpi/OCPIPushCdrsTask.ts
src/scheduler/tasks/ocpi/OCPIPushCdrsTask.ts
@@ -73,7 +73,7 @@ export default class OCPIPushCdrsTask extends TenantSchedulerTask {
continue;
}
// Get Charging Station
- const chargingStation = await ChargingStationStorage.getChargingStation(tenant, transaction.chargeBoxID);
+ const chargingStation = await ChargingStationStorage.getChargingStation(tenant, transaction.chargeBoxID, { withSiteArea: true });
if (!chargingStation) {
await Logging.logError({
tenantID: tenant.id,
@@ -95,7 +95,7 @@ export default class OCPIPushCdrsTask extends TenantSchedulerTask {
continue;
}
// Roaming
- await OCPPUtils.processTransactionRoaming(tenant, transaction, chargingStation, tag, TransactionAction.END);
+ await OCPPUtils.processTransactionRoaming(tenant, transaction, chargingStation, chargingStation.siteArea, tag, TransactionAction.END);
// Save
await TransactionStorage.saveTransactionOcpiData(tenant, transaction.id, transaction.ocpiData);
await Logging.logInfo({

MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -229,7 +229,7 @@ export default class OCPPService {
transaction.phasesUsed = Utils.getUsedPhasesInTransactionInProgress(chargingStation, transaction);
}
// Roaming
- await OCPPUtils.processTransactionRoaming(tenant, transaction, chargingStation, transaction.tag, TransactionAction.UPDATE);
+ await OCPPUtils.processTransactionRoaming(tenant, transaction, chargingStation, chargingStation.siteArea, transaction.tag, TransactionAction.UPDATE);
// Save Transaction
await TransactionStorage.saveTransaction(tenant, transaction);
// Update Charging Station
@@ -384,7 +384,7 @@ export default class OCPPService {
// Billing
await OCPPUtils.processTransactionBilling(tenant, newTransaction, TransactionAction.START);
// Roaming
- await OCPPUtils.processTransactionRoaming(tenant, newTransaction, chargingStation, tag, TransactionAction.START);
+ await OCPPUtils.processTransactionRoaming(tenant, newTransaction, chargingStation, chargingStation.siteArea, tag, TransactionAction.START);
// Save it
await TransactionStorage.saveTransaction(tenant, newTransaction);
// Clean up
@@ -491,7 +491,7 @@ export default class OCPPService {
// Bill
await OCPPUtils.processTransactionBilling(tenant, transaction, TransactionAction.STOP);
// Roaming
- await OCPPUtils.processTransactionRoaming(tenant, transaction, chargingStation, transaction.tag, TransactionAction.STOP);
+ await OCPPUtils.processTransactionRoaming(tenant, transaction, chargingStation, chargingStation.siteArea, transaction.tag, TransactionAction.STOP);
// Save the transaction
await TransactionStorage.saveTransaction(tenant, transaction);
// Notify
@@ -914,7 +914,7 @@ export default class OCPPService {
try {
// Roaming
transactionUpdated = true;
- await OCPPUtils.processTransactionRoaming(tenant, transaction, chargingStation, tag, TransactionAction.END);
+ await OCPPUtils.processTransactionRoaming(tenant, transaction, chargingStation, chargingStation.siteArea, tag, TransactionAction.END);
} finally {
// Release the lock
await LockingManager.release(ocpiLock);
@@ -934,7 +934,7 @@ export default class OCPPService {
try {
// Roaming
transactionUpdated = true;
- await OCPPUtils.processTransactionRoaming(tenant, transaction, chargingStation, tag, TransactionAction.END);
+ await OCPPUtils.processTransactionRoaming(tenant, transaction, chargingStation, chargingStation.siteArea, tag, TransactionAction.END);
} finally {
// Release the lock
await LockingManager.release(oicpLock);

MODIFY
src/server/ocpp/utils/OCPPUtils.ts
src/server/ocpp/utils/OCPPUtils.ts
@@ -98,10 +98,11 @@ export default class OCPPUtils {
return token;
}
- public static async processTransactionRoaming(tenant: Tenant, transaction: Transaction,
- chargingStation: ChargingStation, tag: Tag, transactionAction: TransactionAction): Promise<void> {
+ public static async processTransactionRoaming(tenant: Tenant, transaction: Transaction, chargingStation: ChargingStation,
+ siteArea: SiteArea, tag: Tag, transactionAction: TransactionAction): Promise<void> {
try {
- if (transaction.user && !transaction.user.issuer) {
+ // Roaming User and ACL must be active in Site Area
+ if (transaction.user && !transaction.user.issuer && siteArea?.accessControl) {
// OCPI
if (Utils.isTenantComponentActive(tenant, TenantComponents.OCPI)) {
await OCPPUtils.processOCPITransaction(tenant, transaction, chargingStation, tag, transactionAction);

MODIFY
src/server/rest/v1/service/TransactionService.ts
src/server/rest/v1/service/TransactionService.ts
@@ -190,7 +190,7 @@ export default class TransactionService {
});
}
// Check Charging Station
- const chargingStation = await ChargingStationStorage.getChargingStation(req.tenant, transaction.chargeBoxID);
+ const chargingStation = await ChargingStationStorage.getChargingStation(req.tenant, transaction.chargeBoxID, { withSiteArea: true });
UtilsService.assertObjectExists(action, chargingStation, `Charging Station ID '${transaction.chargeBoxID}' does not exist`,
MODULE_NAME, 'handlePushTransactionCdr', req.user);
// Check Issuer
@@ -227,7 +227,7 @@ export default class TransactionService {
if (ocpiLock) {
try {
// Roaming
- await OCPPUtils.processTransactionRoaming(req.tenant, transaction, chargingStation, transaction.tag, TransactionAction.END);
+ await OCPPUtils.processTransactionRoaming(req.tenant, transaction, chargingStation, chargingStation.siteArea, transaction.tag, TransactionAction.END);
// Save
await TransactionStorage.saveTransactionOcpiData(req.tenant, transaction.id, transaction.ocpiData);
await Logging.logInfo({

Fixed Roaming RFID Cards cannot start a Transaction when access control is disabled in Site Area