gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: Payto


From: gnunet
Subject: [libeufin] branch master updated: Payto
Date: Tue, 02 Jun 2020 11:39:31 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new e8ad95a  Payto
e8ad95a is described below

commit e8ad95a7d7974780850ffe20829ab60e5a67399c
Author: MS <ms@taler.net>
AuthorDate: Tue Jun 2 11:37:44 2020 +0200

    Payto
    
    iban/bic/name are all mandatory now.
---
 nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt |  8 ++---
 nexus/src/test/kotlin/taler.kt                     | 35 ----------------------
 2 files changed, 4 insertions(+), 39 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
index 9d1c5f8..349acbb 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
@@ -108,11 +108,11 @@ fun parsePayto(paytoUri: String): Payto {
 
 
     /**
-     * payto://iban/BIC?/IBAN?name=<name>
+     * payto://iban/BIC/IBAN?name=<name>
      * payto://x-taler-bank/<bank hostname>/<plain account number>
      */
 
-    val ibanMatch = 
Regex("payto://iban/([A-Z0-9]+/)?([A-Z0-9]+)\\?name=(\\w+)").find(paytoUri)
+    val ibanMatch = 
Regex("payto://iban/([A-Z0-9]+)/([A-Z0-9]+)\\?name=(\\w+)").find(paytoUri)
     if (ibanMatch != null) {
         val (bic, iban, name) = ibanMatch.destructured
         return Payto(name, iban, bic.replace("/", ""))
@@ -141,10 +141,10 @@ fun <T : Entity<Long>> SizedIterable<T>.orderTaler(delta: 
Int): List<T> {
  * 'iban'.
  */
 fun buildPaytoUri(name: String, iban: String, bic: String): String {
-    return "payto://x-taler-bank/localhost/$iban"
+    return "payto://iban/$bic/$iban?name=$name"
 }
 fun buildPaytoUri(iban: String, bic: String): String {
-    return "payto://x-taler-bank/localhost/$iban"
+    return "payto://iban/$bic/$iban"
 }
 
 /** Builds the comparison operator for history entries based on the sign of 
'delta'  */
diff --git a/nexus/src/test/kotlin/taler.kt b/nexus/src/test/kotlin/taler.kt
deleted file mode 100644
index 8cb59ad..0000000
--- a/nexus/src/test/kotlin/taler.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package tech.libeufin.nexus
-
-import io.ktor.routing.RootRouteSelector
-import io.ktor.routing.Route
-import io.ktor.util.InternalAPI
-import org.junit.Test
-import tech.libeufin.util.Amount
-import java.math.BigDecimal
-import tech.libeufin.util.parseAmount
-
-class TalerTest {
-
-//    @InternalAPI
-//    val taler = Taler(Route(null, RootRouteSelector("unused")))
-//
-//    @InternalAPI
-//    @Test
-//    fun paytoParserTest() {
-//        val payto = taler.parsePayto("payto://iban/ABC/XYZ?name=foo")
-//        assert(payto.bic == "ABC" && payto.iban == "XYZ" && payto.name == 
"foo")
-//        val paytoNoBic = taler.parsePayto("payto://iban/XYZ?name=foo")
-//        assert(paytoNoBic.bic == "" && paytoNoBic.iban == "XYZ" && 
paytoNoBic.name == "foo")
-//    }
-//
-//    @InternalAPI
-//    @Test
-//    fun amountParserTest() {
-//        val amount = parseAmount("EUR:1")
-//        assert(amount.currency == "EUR" && 
amount.amount.equals(BigDecimal(1)))
-//        val amount299 = parseAmount("EUR:2.99")
-//        assert(amount299.amount.compareTo(Amount("2.99")) == 0)
-//        val amount25 = parseAmount("EUR:2.5")
-//        assert(amount25.amount.compareTo(Amount("2.5")) == 0)
-//    }
-}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]