[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 01/02: avoid git status
From: |
gnunet |
Subject: |
[libeufin] 01/02: avoid git status |
Date: |
Thu, 13 Feb 2020 15:53:53 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libeufin.
commit e1e7997a52755917c2ce1e9a7250e6b3c0cd6196
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Feb 13 13:41:11 2020 +0100
avoid git status
---
nexus/src/main/kotlin/tech/libeufin/nexus/Db.kt | 2 +-
nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 25 +++++++++++++----------
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Db.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Db.kt
index e49f8ef..e2591d2 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Db.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Db.kt
@@ -58,7 +58,7 @@ const val ID_MAX_LENGTH = 50
object EbicsAccountsInfoTable : IntIdTable() {
val accountId = text("accountId")
- val subscriber = reference("subscriber", EbicsSubscribersTable)
+ val subscriber = reference("subscriberId", EbicsSubscribersTable)
val accountHolder = text("accountHolder").nullable()
val iban = text("iban")
val bankCode = text("bankCode")
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index 809bd9a..7f1dcc1 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -41,6 +41,7 @@ import io.ktor.server.netty.Netty
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
import org.apache.commons.compress.archivers.zip.ZipFile
import org.apache.commons.compress.utils.SeekableInMemoryByteChannel
+import org.jetbrains.exposed.dao.EntityID
import org.jetbrains.exposed.exceptions.ExposedSQLException
import org.jetbrains.exposed.sql.StdOutSqlLogger
import org.jetbrains.exposed.sql.addLogger
@@ -98,6 +99,14 @@ data class BankInvalidResponse(val statusCode:
HttpStatusCode) : Exception("Miss
val logger: Logger = LoggerFactory.getLogger("tech.libeufin.nexus")
+fun getSubscriberEntityFromId(id: String): EbicsSubscriberEntity {
+ return transaction {
+ EbicsSubscriberEntity.findById(id) ?: throw SubscriberNotFoundError(
+ HttpStatusCode.NotFound
+ )
+ }
+}
+
fun getSubscriberDetailsFromId(id: String): EbicsClientSubscriberDetails {
return transaction {
val subscriber = EbicsSubscriberEntity.findById(
@@ -297,7 +306,7 @@ fun main() {
val ret = EbicsAccountsInfoResponse()
transaction {
EbicsAccountInfoEntity.find {
- EbicsAccountsInfoTable.subscriber eq id
+ EbicsAccountsInfoTable.subscriberId eq id
}.forEach {
ret.accounts.add(
EbicsAccountInfoElement(
@@ -433,20 +442,14 @@ fun main() {
when (response) {
is EbicsDownloadSuccessResult -> {
val payload =
XMLUtil.convertStringToJaxb<HTDResponseOrderData>(response.orderData.toString(Charsets.UTF_8))
- if (null == payload.value.partnerInfo.accountInfoList)
{
- throw Exception(
- "Inconsistent state: customers MUST have at
least one bank account"
- )
- }
transaction {
- val subscriber =
EbicsSubscriberEntity.findById(customerIdAtNexus)
- // FIXME: see if "!!" can be avoided
-
payload.value.partnerInfo.accountInfoList!!.forEach {
+ payload.value.partnerInfo.accountInfoList?.forEach
{
EbicsAccountInfoEntity.new {
- this.subscriber = subscriber!! /* FIXME:
Always true here, but to be avoided */
+ this.subscriber =
getSubscriberEntityFromId(customerIdAtNexus)
accountId = it.id
accountHolder = it.accountHolder
- /* FIXME: how to figure out whether that's
a general or national account number? */
+ /* 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
}
--
To stop receiving notification emails like this one, please contact
address@hidden.