File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -469,13 +469,37 @@ ocpp::types::AuthorizationStatus ChargePoint::authorize(unsigned int connector_i
469469 Connector* connector = m_connectors.getConnector (connector_id);
470470 if (connector)
471471 {
472- // Check for reservation
472+ // Authorize reason
473473 if (connector->status == ChargePointStatus::Reserved)
474474 {
475+ // Authorize request to start a transaction on a reserved connector
475476 ret = m_reservation_manager->isTransactionAllowed (connector_id, id_tag);
476477 }
478+ else if (connector->transaction_id != 0 )
479+ {
480+ // Authorize request to stop a transaction
481+ if (id_tag == connector->transaction_id_tag )
482+ {
483+ // Same id tag which did start the transaction
484+ parent_id = connector->transaction_parent_id_tag ;
485+ ret = AuthorizationStatus::Accepted;
486+ }
487+ else
488+ {
489+ // Send authorize request to compare the parent id tags
490+ if (!connector->transaction_parent_id_tag .empty ())
491+ {
492+ ret = m_authent_manager->authorize (id_tag, parent_id);
493+ if ((ret != AuthorizationStatus::Accepted) || (parent_id != connector->transaction_parent_id_tag ))
494+ {
495+ ret = AuthorizationStatus::Invalid;
496+ }
497+ }
498+ }
499+ }
477500 else
478501 {
502+ // Authorize request to start a transaction
479503 ret = m_authent_manager->authorize (id_tag, parent_id);
480504 }
481505 }
You can’t perform that action at this time.
0 commit comments