Made parsedDataSet, mimeType and imageBytes nullable, as in case of decoding error they are not set
This commit is contained in:
parent
be3a2df6d9
commit
9aad2a5101
|
@ -3,12 +3,12 @@ package net.codinux.banking.fints.tan
|
|||
|
||||
open class FlickerCode(
|
||||
val challengeHHD_UC: String,
|
||||
val parsedDataSet: String,
|
||||
val parsedDataSet: String? = null,
|
||||
val decodingError: Exception? = null
|
||||
) {
|
||||
|
||||
val decodingSuccessful: Boolean
|
||||
get() = decodingError == null
|
||||
get() = parsedDataSet != null
|
||||
|
||||
|
||||
override fun toString(): String {
|
||||
|
|
|
@ -45,7 +45,7 @@ open class FlickerCodeDecoder {
|
|||
} catch (e: Exception) {
|
||||
log.error(e) { "Could not decode challenge $challengeHHD_UC" }
|
||||
|
||||
return FlickerCode(challengeHHD_UC, "", e)
|
||||
return FlickerCode(challengeHHD_UC, null, e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@ package net.codinux.banking.fints.tan
|
|||
|
||||
|
||||
open class TanImage(
|
||||
val mimeType: String,
|
||||
val imageBytes: ByteArray,
|
||||
val mimeType: String? = null,
|
||||
val imageBytes: ByteArray? = null,
|
||||
val decodingError: Exception? = null
|
||||
) {
|
||||
|
||||
val decodingSuccessful: Boolean
|
||||
get() = decodingError == null
|
||||
get() = mimeType != null && imageBytes != null
|
||||
|
||||
|
||||
override fun toString(): String {
|
||||
|
@ -16,7 +16,7 @@ open class TanImage(
|
|||
return "Decoding error: $decodingError"
|
||||
}
|
||||
|
||||
return "$mimeType ${imageBytes.size} bytes"
|
||||
return "$mimeType ${imageBytes?.size} bytes"
|
||||
}
|
||||
|
||||
}
|
|
@ -29,7 +29,7 @@ open class TanImageDecoder {
|
|||
} catch (e: Exception) {
|
||||
log.error(e) { "Could not decode challenge HHD_UC to TanImage: $challengeHHD_UC" }
|
||||
|
||||
return TanImage("", ByteArray(0), e)
|
||||
return TanImage(null, null, e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue