diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/serializer/MoneySerializer.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/serializer/MoneySerializer.kt deleted file mode 100644 index badabe60..00000000 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/serializer/MoneySerializer.kt +++ /dev/null @@ -1,33 +0,0 @@ -package net.dankito.banking.client.model.serializer - -import kotlinx.serialization.KSerializer -import kotlinx.serialization.descriptors.PrimitiveKind -import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor -import kotlinx.serialization.descriptors.SerialDescriptor -import kotlinx.serialization.encoding.Decoder -import kotlinx.serialization.encoding.Encoder -import net.dankito.banking.fints.model.Amount -import net.dankito.banking.fints.model.Currency -import net.dankito.banking.fints.model.Money - - -class MoneySerializer : KSerializer { - - override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("Money", PrimitiveKind.STRING) - - override fun serialize(encoder: Encoder, value: Money) { - encoder.encodeString(value.amount.string + " " + value.currency.code) - } - - override fun deserialize(decoder: Decoder): Money { - val value = decoder.decodeString() - val parts = value.split(" ") - - if (parts.size > 1) { - return Money(Amount(parts[0]), parts[1]) - } - - return Money(Amount(value), Currency.DefaultCurrencyCode) - } - -} \ No newline at end of file diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt index 50306303..6cfca5ab 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt @@ -1,10 +1,9 @@ package net.dankito.banking.fints.model import kotlinx.serialization.Serializable -import net.dankito.banking.client.model.serializer.MoneySerializer -@Serializable(with = MoneySerializer::class) +@Serializable open class Money( val amount: Amount, val currency: Currency