Skip to content

Commit

Permalink
Merge pull request #3 from IZIVIA/IDEV85/fix-correct_some_mistakes_in…
Browse files Browse the repository at this point in the history
…_cdr_and_tariff_domain

correct some mistakes in cdr and tariff domain
  • Loading branch information
anasquazbary authored Jul 18, 2022
2 parents f5e66a2 + f0a0ae8 commit 22f4160
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 32 deletions.
6 changes: 6 additions & 0 deletions ocpi-toolkit-2.2.1/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
id("com.izivia.ocpi.toolkit.processor")
id("java-library")
id("maven-publish")
}

dependencies {
Expand Down Expand Up @@ -50,6 +52,9 @@ publishing {
publications {
named<MavenPublication>("maven") {
artifactId = "ocpi-2-2-1"
groupId = "com.izivia"
version = "1.1"

from(components["java"])

pom {
Expand All @@ -60,3 +65,4 @@ publishing {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ data class Cdr(
val total_cost: Price,
val total_fixed_cost: Price? = null,
val total_energy: BigDecimal,
val total_energy_cost: BigDecimal? = null,
val total_energy_cost: Price? = null,
val total_time: BigDecimal,
val total_time_cost: Price? = null,
val total_parking_time: BigDecimal? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import java.time.Instant
energy charged this period, maximum current during this period etc.
*@property start_date_time Start timestamp of the charging period. A period ends when the next period
starts. The last period ends when the session ends.
*@property dimension List of relevant values for this charging period.
*@property dimensions List of relevant values for this charging period.
*@property tariff_id Unique identifier of the Tariff that is relevant for this Charging Period. If not
provided, no Tariff is relevant during this period.
*
*/
@Partial
data class ChargingPeriod(
val start_date_time: Instant,
val dimension: List<CdrDimension>,
val tariff_id: CiString
val dimensions: List<CdrDimension>,
val tariff_id: CiString? = null
)

Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
package com.izivia.ocpi.toolkit.modules.cdr.domain

enum class TokenType {
/**
* One time use Token ID generated by a server (or App.) The eMSP uses this to bind a Session to a
customer, probably an app user
*/
AD_HOC_USER,

/**
* Token ID generated by a server (or App.) to identify a user of an App. The same user uses the
same Token for every Session.
*/

APP_USER,

/**
* Other type of token
*/
OTHER_,

/**
* RFID Token
*/
RFID
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ import java.math.BigDecimal
data class PriceComponent(
val type: TariffDimensionType,
val price: BigDecimal,
val vat: BigDecimal,
val vat: BigDecimal? = null,
val step_size: Int
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package com.izivia.ocpi.toolkit.modules.tariff.domain
import com.izivia.ocpi.toolkit.annotations.Partial

/**
* @property price_component List of price components that describe the pricing of a tariff.
* @property price_components List of price components that describe the pricing of a tariff.
* @property restrictions Restrictions that describe the applicability of a tariff.
*/

@Partial
data class TariffElement(
val price_component: PriceComponent,
val restrictions: TariffRestrictions,
val price_components: List<PriceComponent>,
val restrictions: TariffRestrictions? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ TIME is for the duration of the reservation

@Partial
data class TariffRestrictions(
val start_time: String,
val end_time: String,
val start_date: String,
val end_date: String,
val min_kwh: BigDecimal,
val max_kwh: BigDecimal,
val min_current: BigDecimal,
val max_current: BigDecimal,
val min_power: BigDecimal,
val max_power: BigDecimal,
val min_duration: BigDecimal,
val max_duration: BigDecimal,
val day_of_week: DayOfWeek,
val reservation: ReservationRestrictionType,
val start_time: String? = null,
val end_time: String? = null,
val start_date: String? = null,
val end_date: String? = null,
val min_kwh: BigDecimal? = null,
val max_kwh: BigDecimal? = null,
val min_current: BigDecimal? = null,
val max_current: BigDecimal? = null,
val min_power: BigDecimal? = null,
val max_power: BigDecimal? = null,
val min_duration: Int? = null,
val max_duration: Int? = null,
val day_of_week: List<DayOfWeek>? = null,
val reservation: ReservationRestrictionType? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public data class CdrPartial(
public val total_cost: PricePartial?,
public val total_fixed_cost: PricePartial?,
public val total_energy: BigDecimal?,
public val total_energy_cost: BigDecimal?,
public val total_energy_cost: PricePartial?,
public val total_time: BigDecimal?,
public val total_time_cost: PricePartial?,
public val total_parking_time: BigDecimal?,
Expand Down Expand Up @@ -71,7 +71,7 @@ public fun Cdr.toPartial(): CdrPartial {
total_cost = total_cost.toPartial(),
total_fixed_cost = total_fixed_cost?.toPartial(),
total_energy = total_energy,
total_energy_cost = total_energy_cost,
total_energy_cost = total_energy_cost?.toPartial(),
total_time = total_time,
total_time_cost = total_time_cost?.toPartial(),
total_parking_time = total_parking_time,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import kotlin.collections.List
*/
public data class ChargingPeriodPartial(
public val start_date_time: Instant?,
public val dimension: List<CdrDimensionPartial>?,
public val dimensions: List<CdrDimensionPartial>?,
public val tariff_id: CiString?,
)

public fun ChargingPeriod.toPartial(): ChargingPeriodPartial {
return ChargingPeriodPartial(
start_date_time = start_date_time,
dimension = dimension.toPartial(),
dimensions = dimensions.toPartial(),
tariff_id = tariff_id
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import kotlin.collections.List
* Partial representation of [com.izivia.ocpi.toolkit.modules.tariff.domain.TariffElement]
*/
public data class TariffElementPartial(
public val price_component: PriceComponentPartial?,
public val price_components: List<PriceComponentPartial>?,
public val restrictions: TariffRestrictionsPartial?,
)

public fun TariffElement.toPartial(): TariffElementPartial {
return TariffElementPartial(
price_component = price_component.toPartial(),
restrictions = restrictions.toPartial()
price_components = price_components.toPartial(),
restrictions = restrictions?.toPartial()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package com.izivia.ocpi.toolkit.modules.tariff.domain

import java.math.BigDecimal
import java.time.DayOfWeek
import kotlin.Int
import kotlin.String
import kotlin.collections.List

Expand All @@ -24,9 +25,9 @@ public data class TariffRestrictionsPartial(
public val max_current: BigDecimal?,
public val min_power: BigDecimal?,
public val max_power: BigDecimal?,
public val min_duration: BigDecimal?,
public val max_duration: BigDecimal?,
public val day_of_week: DayOfWeek?,
public val min_duration: Int?,
public val max_duration: Int?,
public val day_of_week: List<DayOfWeek>?,
public val reservation: ReservationRestrictionType?,
)

Expand Down

0 comments on commit 22f4160

Please sign in to comment.