[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: give transaction ref to generated paym
From: |
gnunet |
Subject: |
[libeufin] branch master updated: give transaction ref to generated payments |
Date: |
Fri, 05 Feb 2021 13:24:55 +0100 |
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 39ccbb1 give transaction ref to generated payments
39ccbb1 is described below
commit 39ccbb160540daecb94f71e6741bbf5216cfbd29
Author: MS <ms@taler.net>
AuthorDate: Fri Feb 5 13:24:52 2021 +0100
give transaction ref to generated payments
---
sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt | 4 +++-
sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 13 ++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
index d3e3752..8fcb273 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
@@ -86,7 +86,9 @@ fun getEbicsSubscriberFromDetails(userID: String, partnerID:
String, hostID: Str
fun getRandomString(length: Int) : String {
val allowedChars = ('A'..'Z') + ('0'..'9')
- return (1..length)
+ val ret = (1..length)
.map { allowedChars.random() }
.joinToString("")
+ SandboxAssert(ret.length == length, "Unexpected random string")
+ return ret
}
\ No newline at end of file
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index b5e6574..90aee38 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -443,11 +443,11 @@ fun serverMain(dbName: String, port: Int) {
transaction {
val accountLabel = ensureNonNull(call.parameters["label"])
val account = getBankAccountFromLabel(accountLabel)
- val transactionReference = getRandomString(8)
+ val transactionReferenceCrdt = getRandomString(8)
+ val transactionReferenceDbit = getRandomString(8)
+
run {
- val random = Random.nextLong(0, Long.MAX_VALUE)
val amount = Random.nextLong(5, 25)
-
BankAccountTransactionsTable.insert {
it[creditorIban] = account.iban
it[creditorBic] = account.bic
@@ -455,7 +455,7 @@ fun serverMain(dbName: String, port: Int) {
it[debtorIban] = "DE64500105178797276788"
it[debtorBic] = "DEUTDEBB101"
it[debtorName] = "Max Mustermann"
- it[subject] = "sample transaction
$transactionReference"
+ it[subject] = "sample transaction
$transactionReferenceCrdt"
it[BankAccountTransactionsTable.amount] =
amount.toString()
it[currency] = account.currency
it[date] = Instant.now().toEpochMilli()
@@ -466,7 +466,6 @@ fun serverMain(dbName: String, port: Int) {
}
run {
- val random = Random.nextLong()
val amount = Random.nextLong(5, 25)
BankAccountTransactionsTable.insert {
@@ -476,11 +475,11 @@ fun serverMain(dbName: String, port: Int) {
it[creditorIban] = "DE64500105178797276788"
it[creditorBic] = "DEUTDEBB101"
it[creditorName] = "Max Mustermann"
- it[subject] = "sample transaction $random"
+ it[subject] = "sample transaction
$transactionReferenceDbit"
it[BankAccountTransactionsTable.amount] =
amount.toString()
it[currency] = account.currency
it[date] = Instant.now().toEpochMilli()
- it[pmtInfId] = random.toString()
+ it[accountServicerReference] =
transactionReferenceDbit
it[BankAccountTransactionsTable.account] =
account.id
it[direction] = "DBIT"
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: give transaction ref to generated payments,
gnunet <=