[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Improve casting.
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Improve casting. |
Date: |
Thu, 13 Feb 2020 17:03:15 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new eee4ed2 Improve casting.
eee4ed2 is described below
commit eee4ed248718e6826ab44802cf8407f8baf6387c
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Feb 13 17:02:55 2020 +0100
Improve casting.
---
nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index 8247511..b0367a0 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -86,6 +86,7 @@ fun testData() {
data class NotAnIdError(val statusCode: HttpStatusCode) : Exception("String ID
not convertible in number")
data class BankKeyMissing(val statusCode: HttpStatusCode) :
Exception("Impossible operation: bank keys are missing")
data class SubscriberNotFoundError(val statusCode: HttpStatusCode) :
Exception("Subscriber not found in database")
+data class UnknownBankAccountType(val statusCode: HttpStatusCode) :
Exception("Bank account is neither general nor national")
data class BankAccountNotFoundError(val statusCode: HttpStatusCode) :
Exception("Subscriber doesn't have bank account claimed by given 'acctid'")
data class UnreachableBankError(val statusCode: HttpStatusCode) :
Exception("Could not reach the bank")
data class UnparsableResponse(val statusCode: HttpStatusCode, val rawResponse:
String) :
@@ -967,10 +968,15 @@ fun main() {
this.subscriber =
getSubscriberEntityFromId(customerIdAtNexus)
accountId = it.id
accountHolder = it.accountHolder
- /* FIXME: how to figure out whether that's
a general or national account number?
- * This should affect the cast below */
- iban = (it.accountNumberList?.get(0) as
EbicsTypes.GeneralAccountNumber).value // FIXME: eventually get *all* of them
- bankCode = (it.bankCodeList?.get(0) as
EbicsTypes.GeneralBankCode).value // FIXME: eventually get *all* of them
+ iban = when (it.accountNumberList?.get(0))
{
+ is EbicsTypes.GeneralAccountNumber -> {
+ (it.accountNumberList?.get(0) as
EbicsTypes.GeneralAccountNumber).value
+ }
+ is EbicsTypes.NationalAccountNumber ->
{
+ (it.accountNumberList?.get(0) as
EbicsTypes.NationalAccountNumber).value
+ }
+ else -> throw
UnknownBankAccountType(HttpStatusCode.NotFound)
+ }
}
}
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: Improve casting.,
gnunet <=