diff options
author | MS <ms@taler.net> | 2023-07-29 09:10:41 +0200 |
---|---|---|
committer | MS <ms@taler.net> | 2023-07-29 09:10:41 +0200 |
commit | 4332cd279ce2a330be7e84baac6685522606629c (patch) | |
tree | 91f38efa0412475be4eec511d624d4c5bcfbaafd /sandbox/src/main/kotlin/tech/libeufin | |
parent | 48c1cc4ce7e338d14093b2e04ccd621282a451ee (diff) | |
download | libeufin-4332cd279ce2a330be7e84baac6685522606629c.tar.gz libeufin-4332cd279ce2a330be7e84baac6685522606629c.tar.bz2 libeufin-4332cd279ce2a330be7e84baac6685522606629c.zip |
balance accounting
avoiding passing DB objects as function arguments.
Diffstat (limited to 'sandbox/src/main/kotlin/tech/libeufin')
-rw-r--r-- | sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 12 | ||||
-rw-r--r-- | sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt index 0dc7b742..cd886e55 100644 --- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt +++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt @@ -545,14 +545,14 @@ private suspend fun confirmWithdrawal(call: ApplicationCall) { logger.debug("Withdrawal ${wo.wopid} confirmed? ${wo.confirmationDone}") if (!wo.confirmationDone) { wireTransfer( - debitAccount = wo.walletBankAccount, - creditAccount = exchangeBankAccount, + debitAccount = wo.walletBankAccount.label, + creditAccount = exchangeBankAccount.label, amount = wo.amount, subject = wo.reservePub ?: throw internalServerError( "Cannot transfer funds without reserve public key." ), // provide the currency. - demobank = ensureDemobank(call) + demobank = ensureDemobank(call).name ) wo.confirmationDone = true } @@ -1347,9 +1347,9 @@ val sandboxApp: Application.() -> Unit = { * of 'bankAccount' be correctly accessed. */ transaction { wireTransfer( - debitAccount = bankAccount, - creditAccount = getBankAccountFromIban(payto.iban), - demobank = bankAccount.demoBank, + debitAccount = bankAccount.label, + creditAccount = getBankAccountFromIban(payto.iban).label, + demobank = bankAccount.demoBank.name, subject = payto.message ?: throw badRequest( "'message' query parameter missing in Payto address" ), diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt index 9a449f84..f867fca2 100644 --- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt +++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt @@ -160,7 +160,7 @@ fun wireTransfer( } // Book a CRDT and a DBIT transaction and return the unique reference thereof. -fun wireTransfer( +private fun wireTransfer( debitAccount: BankAccountEntity, creditAccount: BankAccountEntity, demobank: DemobankConfigEntity, |