[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Move Demobank reference into BankAccou
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Move Demobank reference into BankAccount. |
Date: |
Wed, 20 Oct 2021 13:35:42 +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 41db2f5 Move Demobank reference into BankAccount.
41db2f5 is described below
commit 41db2f5ef6beccd93b270731425ad8597d35a574
Author: ms <ms@taler.net>
AuthorDate: Wed Oct 20 13:34:11 2021 +0200
Move Demobank reference into BankAccount.
---
.../src/main/kotlin/tech/libeufin/sandbox/DB.kt | 30 ++++++++++++----------
.../src/main/kotlin/tech/libeufin/sandbox/Main.kt | 12 ++++-----
2 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index 63cf772..d164700 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -112,7 +112,6 @@ class DemobankConfigEntity(id: EntityID<Long>) :
LongEntity(id) {
* Created via the /demobanks/{demobankname}/register endpoint.
*/
object DemobankCustomersTable : LongIdTable() {
- val demobankConfig = reference("demobankConfig", DemobankConfigsTable)
val username = text("username")
val passwordHash = text("passwordHash")
val name = text("name").nullable()
@@ -120,7 +119,6 @@ object DemobankCustomersTable : LongIdTable() {
class DemobankCustomerEntity(id: EntityID<Long>) : LongEntity(id) {
companion object :
LongEntityClass<DemobankCustomerEntity>(DemobankCustomersTable)
- var demobankConfig by DemobankConfigEntity referencedOn
DemobankCustomersTable.demobankConfig
var username by DemobankCustomersTable.username
var passwordHash by DemobankCustomersTable.passwordHash
var name by DemobankCustomersTable.name
@@ -153,7 +151,6 @@ object EbicsHostsTable : IntIdTable() {
class EbicsHostEntity(id: EntityID<Int>) : IntEntity(id) {
companion object : IntEntityClass<EbicsHostEntity>(EbicsHostsTable)
-
var hostId by EbicsHostsTable.hostID
var ebicsVersion by EbicsHostsTable.ebicsVersion
var signaturePrivateKey by EbicsHostsTable.signaturePrivateKey
@@ -237,7 +234,6 @@ object EbicsUploadTransactionsTable : IdTable<String>() {
class EbicsUploadTransactionEntity(id: EntityID<String>) : Entity<String>(id) {
companion object : EntityClass<String,
EbicsUploadTransactionEntity>(EbicsUploadTransactionsTable)
-
var orderType by EbicsUploadTransactionsTable.orderType
var orderID by EbicsUploadTransactionsTable.orderID
var host by EbicsHostEntity referencedOn EbicsUploadTransactionsTable.host
@@ -261,7 +257,6 @@ object EbicsOrderSignaturesTable : IntIdTable() {
class EbicsOrderSignatureEntity(id: EntityID<Int>) : IntEntity(id) {
companion object :
IntEntityClass<EbicsOrderSignatureEntity>(EbicsOrderSignaturesTable)
-
var orderID by EbicsOrderSignaturesTable.orderID
var orderType by EbicsOrderSignaturesTable.orderType
var partnerID by EbicsOrderSignaturesTable.partnerID
@@ -274,8 +269,7 @@ class EbicsOrderSignatureEntity(id: EntityID<Int>) :
IntEntity(id) {
* FIXME: document this.
*/
object EbicsUploadTransactionChunksTable : IdTable<String>() {
- override val id =
- text("transactionID").entityId()
+ override val id = text("transactionID").entityId()
val chunkIndex = integer("chunkIndex")
val chunkContent = blob("chunkContent")
}
@@ -283,7 +277,6 @@ object EbicsUploadTransactionChunksTable :
IdTable<String>() {
// FIXME: Is upload chunking not implemented somewhere?!
class EbicsUploadTransactionChunkEntity(id: EntityID<String>) :
Entity<String>(id) {
companion object : EntityClass<String,
EbicsUploadTransactionChunkEntity>(EbicsUploadTransactionChunksTable)
-
var chunkIndex by EbicsUploadTransactionChunksTable.chunkIndex
var chunkContent by EbicsUploadTransactionChunksTable.chunkContent
}
@@ -299,7 +292,6 @@ object BankAccountFreshTransactionsTable : LongIdTable() {
}
class BankAccountFreshTransactionEntity(id: EntityID<Long>) : LongEntity(id) {
companion object :
LongEntityClass<BankAccountFreshTransactionEntity>(BankAccountFreshTransactionsTable)
-
var transactionRef by BankAccountTransactionEntity referencedOn
BankAccountFreshTransactionsTable.transactionRef
}
@@ -315,23 +307,25 @@ object BankAccountTransactionsTable : LongIdTable() {
val debtorName = text("debtorName")
val subject = text("subject")
/**
- * Amount is a stringified BigInt
+ * Amount is a BigInt in String form.
*/
val amount = text("amount")
val currency = text("currency")
val date = long("date")
-
/**
* Unique ID for this payment within the bank account.
*/
val accountServicerReference = text("accountServicerReference")
-
/**
* Payment information ID, which is a reference to the payment initiation
* that triggered this transaction. Typically, only available with
outgoing transactions.
*/
val pmtInfId = text("pmtInfId").nullable()
val direction = text("direction")
+ /**
+ * Bank account of the party whose 'direction' refers. This version allows
+ * only both parties to be registered at the running Sandbox.
+ */
val account = reference("account", BankAccountsTable)
}
@@ -377,8 +371,16 @@ object BankAccountsTable : IntIdTable() {
* as the owner. That allows tests using the --no-auth option to go on.
*/
val owner = text("owner")
- val isPublic = bool("isPublic")
- val demoBank = reference("demoBank", DemobankConfigsTable)
+ val isPublic = bool("isPublic").default(false)
+
+ /**
+ * Used only by the operations triggered under one /demobanks/$demobankId
endpoint.
+ *
+ * For example, current tests do never configure one demobank or one
customer account;
+ * for those, every bank account will have null demobank reference and
"admin" owner that
+ * do not point to any customer row.
+ */
+ val demoBank = reference("demoBank", DemobankConfigsTable).nullable()
}
class BankAccountEntity(id: EntityID<Int>) : IntEntity(id) {
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index d158580..8e4bc0b 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -627,7 +627,7 @@ val sandboxApp: Application.() -> Unit = {
val username = call.request.basicAuth()
val body = call.receiveJson<BankAccountRequest>()
if (!validateBic(body.bic)) {
- throw SandboxError(io.ktor.http.HttpStatusCode.BadRequest,
"invalid BIC (${body.bic})")
+ throw SandboxError(HttpStatusCode.BadRequest, "invalid BIC
(${body.bic})")
}
transaction {
val subscriber = getEbicsSubscriberFromDetails(
@@ -773,18 +773,18 @@ val sandboxApp: Application.() -> Unit = {
call.request.basicAuth()
val body = call.receiveJson<EbicsSubscriberElement>()
transaction {
- tech.libeufin.sandbox.EbicsSubscriberEntity.new {
+ EbicsSubscriberEntity.new {
partnerId = body.partnerID
userId = body.userID
systemId = null
hostId = body.hostID
- state = tech.libeufin.sandbox.SubscriberState.NEW
+ state = SubscriberState.NEW
nextOrderID = 1
}
}
call.respondText(
"Subscriber created.",
- io.ktor.http.ContentType.Text.Plain,
io.ktor.http.HttpStatusCode.OK
+ ContentType.Text.Plain, HttpStatusCode.OK
)
return@post
}
@@ -1163,17 +1163,17 @@ val sandboxApp: Application.() -> Unit = {
// Create new customer.
requireValidResourceName(req.username)
transaction {
- val bankAccount = BankAccountEntity.new {
+ BankAccountEntity.new {
iban = getIban()
label = req.username + "acct" // multiple accounts
per username not allowed.
currency = demobank.currency
balance = "${demobank.currency}:0"
owner = req.username
+ this.demoBank = demobank.id
}
DemobankCustomerEntity.new {
username = req.username
passwordHash = CryptoUtil.hashpw(req.password)
- demobankConfig = demobank
}
}
call.respondText("Registration successful")
--
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: Move Demobank reference into BankAccount.,
gnunet <=