use of ocpp.cs._2015._10.StopTransactionResponse in project steve by RWTH-i5-IDSG.
the class CentralSystemService16_Service method stopTransaction.
public StopTransactionResponse stopTransaction(StopTransactionRequest parameters, String chargeBoxIdentity) {
int transactionId = parameters.getTransactionId();
String stopReason = parameters.isSetReason() ? parameters.getReason().value() : null;
UpdateTransactionParams params = UpdateTransactionParams.builder().chargeBoxId(chargeBoxIdentity).transactionId(transactionId).stopTimestamp(parameters.getTimestamp()).stopMeterValue(Integer.toString(parameters.getMeterStop())).stopReason(stopReason).build();
ocppServerRepository.updateTransaction(params);
if (parameters.isSetTransactionData()) {
ocppServerRepository.insertMeterValues(chargeBoxIdentity, parameters.getTransactionData(), transactionId);
}
// Get the authorization info of the user
if (parameters.isSetIdTag()) {
IdTagInfo idTagInfo = ocppTagService.getIdTagInfo(parameters.getIdTag());
return new StopTransactionResponse().withIdTagInfo(idTagInfo);
} else {
return new StopTransactionResponse();
}
}
Aggregations