commit b26b024f9fadcf5b74afed8daaa681ca593fa19c
parent 0312a6ef550f6ca3a5c615f573e86f16ecd05bf7
Author: Antoine A <>
Date: Wed, 25 Jun 2025 17:04:15 +0200
nexus: improving resilience in the event of authorization errors
Diffstat:
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/cli/EbicsFetch.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/cli/EbicsFetch.kt
@@ -365,6 +365,7 @@ private suspend fun fetchEbicsDocuments(
peek: Boolean
): Boolean {
val lastExecutionTime: Instant? = pinnedStart
+ var success = true
for ((doc, orders) in orders.groupBy { it.doc() }) {
if (doc == null) {
logger.debug("Skip unsupported orders {}", orders)
@@ -385,8 +386,20 @@ private suspend fun fetchEbicsDocuments(
registerPayload(client.db, client.cfg, payload, doc)
}
} catch (e: Exception) {
- // Ignore no data errors
- if (e !is EbicsError.Code || e.bankCode != EbicsReturnCode.EBICS_NO_DOWNLOAD_DATA_AVAILABLE) {
+ if (e is EbicsError.Code) {
+ when (e.bankCode) {
+ EbicsReturnCode.EBICS_NO_DOWNLOAD_DATA_AVAILABLE -> continue
+ EbicsReturnCode.EBICS_AUTHORISATION_ORDER_IDENTIFIER_FAILED -> {
+ e.fmtLog(logger)
+ success = false
+ continue
+ }
+ else -> {
+ e.fmtLog(logger)
+ return false
+ }
+ }
+ } else {
e.fmtLog(logger)
return false
}
@@ -394,7 +407,7 @@ private suspend fun fetchEbicsDocuments(
}
}
}
- return true
+ return success
}
@Serializable