Snippets

OICP 2.1 Authorize Stop | Java

Created by Gregor Schermuly last modified Julius Poessnecker
1
2
3
4
5
6
7
The service description can be found in the OICP 2.1.

Section:
3.1.2 eRoamingAuthorizeStop

To download the latest OICP Version, please visit our website:
https://www.hubject.com/downloads/
/**
 * Create a new OICP v2.0 AuthorizeStop request.
 *
 * @param EVSEOperatorId the unique identification of the EVSE operator for this request.
 * @param SessionId the unique identification of the EV charging session for this request.
 * @return a new AuthorizeStop request builder object.
 */
public AuthorizeStopRequest AuthorizeStop(final EVSEOperator_Id     EVSEOperatorId,
                                          final ChargingSession_Id  SessionId)
{ ... }


/**
 * Create a new OICP v2.0 AuthorizeStop request.
 *
 * @param EVSEOperatorId the unique identification of the EVSE operator for this request.
 * @param SessionId the unique identification of the EV charging session for this request.
 * @param AuthToken the authentication token for this request.
 * @return a new AuthorizeStop request builder object.
 */
public AuthorizeStopRequest AuthorizeStop(final EVSEOperator_Id     EVSEOperatorId,
                                          final ChargingSession_Id  SessionId,
                                          final Auth_Token          AuthToken)
{ ... }


// AuthorizeStopRequest builder methods

public AuthorizeStopRequest setSessionId(ChargingSession_Id SessionId)
{ ... }


public AuthorizeStopRequest setPartnerSessionId(ChargingSession_Id PartnerSessionId)
{ ... }


public AuthorizeStopRequest setEVSEId(EVSE_Id EVSEId)
{ ... }


public AuthorizeStopRequest setAuthToken(Auth_Token AuthToken)
{ ... }


public AuthorizeStopRequest setQRCodeIdentification(EVCO_Id  EVCOId,
                                                    PIN      PIN)
{ ... }


public AuthorizeStopRequest setPlugAndChargeIdentification(EVCO_Id EVCOId)
{ ... }


public AuthorizeStopRequest setRemoteIdentification(EVCO_Id EVCOId)
{ ... }
CPOClient       HubjectCPO    = new CPOClient("api.playground.hubject.com");
EVSEOperator_Id EVSEOperator  = EVSEOperator_Id.Parse("DE*GEF");
Auth_Token      AuthToken     = Auth_Token.     Parse("16EC7B0F");

CompletableFuture req = HubjectCPO.

    AuthorizeStart(EVSEOperator,
                   AuthToken).

    Run(StartResult -> {

        if (StartResult.getAuthorizationStatus() == AuthorizationStatus.Authorized)
        {

            System.out.println("Authorized!");

            try {

                HubjectCPO.
                    AuthorizeStop(EVSEOperator,
                                  StartResult.getSessionId(),
                                  AuthToken).

                    Run(StopResult -> {

                        if (StopResult.getAuthorizationStatus() == AuthorizationStatus.Authorized)
                            System.out.println("Authorized!");

                        else {
                            System.out.println(StopResult.getStatusCode().getCode());
                            System.out.println(StopResult.getStatusCode().getDescription());
                            System.out.println(StopResult.getStatusCode().getAdditionalInfo());
                        }

                    });

            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
        }

        else {
            System.out.println(StartResult.getStatusCode().getCode());
            System.out.println(StartResult.getStatusCode().getDescription());
            System.out.println(StartResult.getStatusCode().getAdditionalInfo());
        }

    });

// Wait for the future to complete...
req.get();

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.