Skip to content

Commit

Permalink
Merge pull request #578 from EVerest/577-do-not-send-the-idtoken-in-t…
Browse files Browse the repository at this point in the history
…ransactionended-message-when-it-is-ended-because-remote-stop-or-ev-disconnected

Send idToken at finish transaction only if it is deauthorized using a token
  • Loading branch information
jannejy authored Apr 25, 2024
2 parents 315b808 + 6c4bcf5 commit eb8e36b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,13 @@ void ChargePoint::on_transaction_finished(const int32_t evse_id, const DateTime&

const auto trigger_reason = utils::stop_reason_to_trigger_reason_enum(reason);

// E07.FR.02 The field idToken is provided when the authorization of the transaction has been ended
const std::optional<IdToken> transaction_id_token =
trigger_reason == ocpp::v201::TriggerReasonEnum::StopAuthorized ? id_token : std::nullopt;

this->transaction_event_req(TransactionEventEnum::Ended, timestamp, transaction, trigger_reason, seq_no,
std::nullopt, this->evses.at(static_cast<int32_t>(evse_id))->get_evse_info(), id_token,
meter_values, std::nullopt, this->is_offline(), std::nullopt);
std::nullopt, this->evses.at(static_cast<int32_t>(evse_id))->get_evse_info(),
transaction_id_token, meter_values, std::nullopt, this->is_offline(), std::nullopt);

this->database_handler->transaction_metervalues_clear(transaction_id);

Expand Down

0 comments on commit eb8e36b

Please sign in to comment.