@EventHandler public void handle(TransactionStartedEvent event) { LOG.debug("TransactionStartedEvent for [{}] received!", event.getChargingStationId()); StartTransactionInfo startTransactionInfo = event.getStartTransactionInfo(); IdentifyingToken identifyingToken = startTransactionInfo.getIdentifyingToken(); Transaction transaction = new Transaction(event.getChargingStationId().getId(), event.getTransactionId().getId(), startTransactionInfo.getEvseId(), identifyingToken.getToken(), startTransactionInfo.getMeterStart(), startTransactionInfo.getTimestamp(), identifyingToken.getMobilityServiceProvider(), identifyingToken.getVisibleId()); repository.createOrUpdate(transaction); }
@EventHandler protected void onEvent(TransactionStartedEvent event) { LOG.info("Sending notifyRequestResult for a TransactionStartedEvent to the source PMS"); String authorizationIdentifier = event.getStartTransactionInfo().getIdentifyingToken().getToken(); Integer transactionId = ((NumberedTransactionId) event.getTransactionId()).getNumber(); SessionInfo sessionInfo = destinationSessionRepository.findSessionInfoByAuthorizationId(authorizationIdentifier); sessionInfo.setTransactionId(transactionId); sessionInfo.getSessionStateMachine().eventStartOk(); sessionInfo.setMeterStart(event.getStartTransactionInfo().getMeterStart()); sessionInfo.setStartTimestamp(event.getStartTransactionInfo().getTimestamp()); destinationSessionRepository.insertOrUpdateSessionInfo(sessionInfo); String requestIdentifier = sessionInfo.getRequestIdentifier(); SourceEndpoint sourceEndpoint = sourceEndpointRepository.findSourceEndpointByPmsIdentifier(sessionInfo.getPmsIdentifier()); SourceClient sourceClient = new SourceClient(sourceEndpoint.getSourceEndpointUrl()); DestinationNotifyRequestResultRequest destinationNotifyRequestResultRequest = new DestinationNotifyRequestResultRequest(requestIdentifier); sourceClient.notifyRequestResult(destinationNotifyRequestResultRequest); LOG.info("Received a notifyRequestResultResponse from the source PMS"); }
StartTransactionInfo extendedStartTransactionInfo = new StartTransactionInfo(startTransaction.getEvseId(), startTransaction.getMeterStart(), startTransaction.getTimestamp(), identifyingToken, startTransaction.getAttributes());
NumberedTransactionId transactionId = new NumberedTransactionId(chargingStationId, protocolIdentifier, transaction.getId().intValue()); IdentifyingToken identifyingToken = resultEvent.getIdentifyingToken(); StartTransactionInfo extendedStartTransactionInfo = new StartTransactionInfo(startTransactionInfo.getEvseId(), startTransactionInfo.getMeterStart(), startTransactionInfo.getTimestamp(), identifyingToken, startTransactionInfo.getAttributes());