Skip to content

Commit

Permalink
feat: Add ChargingProfiles module
Browse files Browse the repository at this point in the history
  • Loading branch information
andacata committed Mar 11, 2024
1 parent bbd5fb5 commit a8e1200
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ class ChargingProfilesCpoServer(
method = HttpMethod.GET,
path = basePathSegments + listOf(
VariablePathSegment("sessionId")
)
),
queryParams = listOf("duration", "response_url")
) { req ->
req.httpResponse {
service
.getActiveChargingProfile(
sessionId = req.pathParams["sessionId"]!!,
duration = req.queryParams["duration"]!!.toInt(),
responseUrl = req.queryParams["responseUrl"]!!
responseUrl = req.queryParams["response_url"]!!
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ChargingProfilesScspServer(
req.httpResponse {
service
.postCallbackActiveChargingProfile(
requestId = req.queryParams["requestId"] ?: "",
requestId = req.pathParams["requestId"].orEmpty(),
result = mapper.readValue(req.body, ActiveChargingProfileResult::class.java)
)
}
Expand All @@ -62,7 +62,7 @@ class ChargingProfilesScspServer(
req.httpResponse {
service
.postCallbackChargingProfile(
requestId = req.queryParams["requestId"] ?: "",
requestId = req.pathParams["requestId"].orEmpty(),
result = mapper.readValue(req.body, ChargingProfileResult::class.java)
)
}
Expand All @@ -78,7 +78,7 @@ class ChargingProfilesScspServer(
req.httpResponse {
service
.postCallbackClearProfile(
requestId = req.queryParams["requestId"] ?: "",
requestId = req.pathParams["requestId"].orEmpty(),
result = mapper.readValue(req.body, ClearProfileResult::class.java)
)
}
Expand All @@ -94,7 +94,7 @@ class ChargingProfilesScspServer(
req.httpResponse {
service
.putActiveChargingProfile(
sessionId = req.queryParams["sessionId"] ?: "",
sessionId = req.pathParams["sessionId"].orEmpty(),
activeChargingProfile = mapper.readValue(req.body, ActiveChargingProfile::class.java)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CredentialsClient(
.parseBody()

override suspend fun post(
tokenA: String,
token: String,
credentials: Credentials,
debugHeaders: Map<String, String>
): OcpiResponseBody<Credentials> =
Expand All @@ -41,7 +41,7 @@ class CredentialsClient(
requestId = transportClient.generateRequestId(),
correlationId = transportClient.generateCorrelationId()
)
.authenticate(token = tokenA)
.authenticate(token = token)
)
.parseBody()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ open class CredentialsClientService(

// Initiate registration process
val credentials = buildCredentialClient().post(
tokenA = credentialsTokenA,
token = credentialsTokenA,
credentials = Credentials(
token = serverToken,
url = clientVersionsEndpointUrl,
Expand Down

0 comments on commit a8e1200

Please sign in to comment.