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
|
||||
open class FlickerCode(
|
||||
val challengeHHD_UC: String,
|
||||
val parsedDataSet: String,
|
||||
val parsedDataSet: String? = null,
|
||||
val decodingError: String? = null
|
||||
) {
|
||||
|
||||
@get:JsonIgnore
|
||||
val decodingSuccessful: Boolean
|
||||
get() = decodingError == null
|
||||
get() = parsedDataSet != null
|
||||
|
||||
|
||||
override fun toString(): String {
|
||||
|
|
|
@ -6,22 +6,22 @@ import net.codinux.banking.client.model.config.NoArgConstructor
|
|||
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
@NoArgConstructor
|
||||
open class TanImage(
|
||||
val mimeType: String,
|
||||
val imageBytesBase64: String,
|
||||
val mimeType: String? = null,
|
||||
val imageBytesBase64: String? = null,
|
||||
val decodingError: String? = null
|
||||
) {
|
||||
|
||||
@get:JsonIgnore
|
||||
val decodingSuccessful: Boolean
|
||||
get() = decodingError == null
|
||||
get() = mimeType != null && imageBytesBase64 != null
|
||||
|
||||
|
||||
override fun toString(): String {
|
||||
if (decodingSuccessful == false) {
|
||||
return "Decoding error: $decodingError"
|
||||
mimeType?.let {
|
||||
return mimeType
|
||||
}
|
||||
|
||||
return mimeType
|
||||
return "Decoding error: $decodingError"
|
||||
}
|
||||
|
||||
}
|
|
@ -338,7 +338,11 @@ open class FinTs4kMapper {
|
|||
TanImage(image.mimeType, mapToBase64(image.imageBytes), mapException(image.decodingError))
|
||||
|
||||
@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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue