/** * Handles a {@link StartTransactionCommand}. * * @param command the command which needs to be applied to the ChargingStation. */ @CommandHandler public void handle(StartTransactionCommand command, MetaData metaData) { if (command.getStartTransactionInfo().getEvseId().getNumberedId() > numberOfEvses) { apply(new EvseNotFoundEvent(id, command.getStartTransactionInfo().getEvseId(), command.getIdentityContext()), metaData); return; } apply(new TransactionStartedEvent(command.getChargingStationId(), command.getTransactionId(), command.getStartTransactionInfo(), command.getIdentityContext()), metaData); }
/** * Initiates a StartTransactionCommand without authorizing the identification. Normally this method is called by the * futureEventCallback of {@link #startTransaction}. * * @param chargingStationId charging station identifier. * @param transactionId transaction identifier. * @param startTransactionInfo information about the started transaction. * @param addOnIdentity add on identifier. */ public void startTransactionNoAuthorize(ChargingStationId chargingStationId, TransactionId transactionId, StartTransactionInfo startTransactionInfo, AddOnIdentity addOnIdentity) { IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity()); StartTransactionCommand command = new StartTransactionCommand(chargingStationId, transactionId, startTransactionInfo, identityContext); commandGateway.send(command); }