Made parsedDataSet, mimeType and imageBytesBase64 nullable, as in case of decoding error they are not set
This commit is contained in:
parent
0bf5b19f4a
commit
00b26e3bd0
|
@ -7,13 +7,13 @@ import net.codinux.banking.client.model.config.NoArgConstructor
|
||||||
@NoArgConstructor
|
@NoArgConstructor
|
||||||
open class FlickerCode(
|
open class FlickerCode(
|
||||||
val challengeHHD_UC: String,
|
val challengeHHD_UC: String,
|
||||||
val parsedDataSet: String,
|
val parsedDataSet: String? = null,
|
||||||
val decodingError: String? = null
|
val decodingError: String? = null
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@get:JsonIgnore
|
@get:JsonIgnore
|
||||||
val decodingSuccessful: Boolean
|
val decodingSuccessful: Boolean
|
||||||
get() = decodingError == null
|
get() = parsedDataSet != null
|
||||||
|
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
|
|
|
@ -6,22 +6,22 @@ import net.codinux.banking.client.model.config.NoArgConstructor
|
||||||
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||||
@NoArgConstructor
|
@NoArgConstructor
|
||||||
open class TanImage(
|
open class TanImage(
|
||||||
val mimeType: String,
|
val mimeType: String? = null,
|
||||||
val imageBytesBase64: String,
|
val imageBytesBase64: String? = null,
|
||||||
val decodingError: String? = null
|
val decodingError: String? = null
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@get:JsonIgnore
|
@get:JsonIgnore
|
||||||
val decodingSuccessful: Boolean
|
val decodingSuccessful: Boolean
|
||||||
get() = decodingError == null
|
get() = mimeType != null && imageBytesBase64 != null
|
||||||
|
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
if (decodingSuccessful == false) {
|
mimeType?.let {
|
||||||
return "Decoding error: $decodingError"
|
return mimeType
|
||||||
}
|
}
|
||||||
|
|
||||||
return mimeType
|
return "Decoding error: $decodingError"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -338,7 +338,11 @@ open class FinTs4kMapper {
|
||||||
TanImage(image.mimeType, mapToBase64(image.imageBytes), mapException(image.decodingError))
|
TanImage(image.mimeType, mapToBase64(image.imageBytes), mapException(image.decodingError))
|
||||||
|
|
||||||
@OptIn(ExperimentalEncodingApi::class)
|
@OptIn(ExperimentalEncodingApi::class)
|
||||||
protected open fun mapToBase64(bytes: ByteArray): String {
|
protected open fun mapToBase64(bytes: ByteArray?): String? {
|
||||||
|
if (bytes == null || bytes.isEmpty()) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return Base64.Default.encode(bytes)
|
return Base64.Default.encode(bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue