diff options
-rwxr-xr-x | integration-tests/test-ebics.py | 2 | ||||
-rw-r--r-- | nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt | 13 | ||||
-rw-r--r-- | nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 4 | ||||
-rw-r--r-- | sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt | 1 | ||||
-rw-r--r-- | util/src/main/kotlin/time.kt | 10 | ||||
-rw-r--r-- | util/src/test/kotlin/CryptoUtilTest.kt | 1 |
6 files changed, 12 insertions, 19 deletions
diff --git a/integration-tests/test-ebics.py b/integration-tests/test-ebics.py index 10c873d4..a0adfeac 100755 --- a/integration-tests/test-ebics.py +++ b/integration-tests/test-ebics.py @@ -179,5 +179,3 @@ resp = get( ) assert(resp.status_code == 200) assert(len(resp.json().get("payments")) == 1) - - diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt index 50018b56..40d78839 100644 --- a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt +++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt @@ -20,13 +20,6 @@ import java.time.ZonedDateTime import java.time.Instant import java.time.ZoneId -fun getSubscriberEntityFromNexusUserId(nexusUserId: String?): EbicsSubscriberEntity { - return transaction { - val nexusUser = extractNexusUser(expectId(nexusUserId)) - getEbicsSubscriberFromUser(nexusUser) - } -} - fun calculateRefund(amount: String): Amount { // fixme: must apply refund fees! return Amount(amount) @@ -449,8 +442,4 @@ fun userHasRights(nexusUser: NexusUserEntity, iban: String): Boolean { }.firstOrNull() } return row != null -} - -fun parseDate(date: String): DateTime { - return DateTime.parse(date, DateTimeFormat.forPattern("YYYY-MM-DD")) -} +}
\ No newline at end of file diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt index 61ae1cc5..460b4c21 100644 --- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt +++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt @@ -273,7 +273,7 @@ fun main() { ret.payments.add( RawPayment( creditorIban = it.creditorIban, - debitorIban = "FIXME", + debitorIban = it.debitorIban, subject = it.subject, amount = "${it.currency}:${it.sum}", date = DateTime(it.date).toDashedDate() @@ -712,7 +712,7 @@ fun main() { currency = camt53doc.pickString("//*[local-name()='Ntry']//*[local-name()='Amt']/@Ccy") amount = camt53doc.pickString("//*[local-name()='Ntry']//*[local-name()='Amt']") status = camt53doc.pickString("//*[local-name()='Ntry']//*[local-name()='Sts']") - bookingDate = parseDate(camt53doc.pickString("//*[local-name()='BookgDt']//*[local-name()='Dt']")).millis + bookingDate = parseDashedDate(camt53doc.pickString("//*[local-name()='BookgDt']//*[local-name()='Dt']")).millis nexusUser = extractNexusUser(id) creditorName = camt53doc.pickString("//*[local-name()='RltdPties']//*[local-name()='Dbtr']//*[local-name()='Nm']") creditorIban = camt53doc.pickString("//*[local-name()='CdtrAcct']//*[local-name()='IBAN']") diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt index e31b44df..cad50ffe 100644 --- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt +++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt @@ -164,6 +164,7 @@ fun buildCamtString(type: Int, history: MutableList<RawPayment>): MutableList<St history.forEach { val dashedDate = DateTime.parse(it.date).toDashedDate() val zonedDateTime = DateTime.now().toZonedString() + logger.debug("Dashed date for CAMT: $dashedDate") ret.add( constructXml(indent = true) { root("Document") { diff --git a/util/src/main/kotlin/time.kt b/util/src/main/kotlin/time.kt index e2d2df9d..07fe4a72 100644 --- a/util/src/main/kotlin/time.kt +++ b/util/src/main/kotlin/time.kt @@ -1,6 +1,7 @@ package tech.libeufin.util import org.joda.time.DateTime +import org.joda.time.format.DateTimeFormat import java.time.ZoneId import java.time.ZonedDateTime import java.time.format.DateTimeFormatter @@ -13,5 +14,10 @@ fun DateTime.toZonedString(): String { } fun DateTime.toDashedDate(): String { - return this.toString("Y-MM-dd") -}
\ No newline at end of file + return this.toString("y-MM-d") +} + +fun parseDashedDate(date: String): DateTime { + logger.debug("Parsing date: $date") + return DateTime.parse(date, DateTimeFormat.forPattern("y-M-d")) +} diff --git a/util/src/test/kotlin/CryptoUtilTest.kt b/util/src/test/kotlin/CryptoUtilTest.kt index 705f4434..da545bf7 100644 --- a/util/src/test/kotlin/CryptoUtilTest.kt +++ b/util/src/test/kotlin/CryptoUtilTest.kt @@ -158,7 +158,6 @@ class CryptoUtilTest { // from Crockford32 encoding to binary. fun base32ToBytesTest() { val expectedEncoding = "C9P6YRG" - val blob = "blob".toByteArray(Charsets.UTF_8) assert(Base32Crockford.decode(expectedEncoding).toString(Charsets.UTF_8) == "blob") } } |