commit f472eebf3cfb3daf62cdc9aa32f14b11f35b732b
parent 77c6e99c0d0f78d0fe2fba46f51be78dd0e6d30d
Author: ms <ms@taler.net>
Date: Thu, 19 May 2022 07:59:57 +0200
account deletion
Diffstat:
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/cli/bin/libeufin-cli b/cli/bin/libeufin-cli
@@ -1263,18 +1263,23 @@ def sandbox_demobank_info(obj, bank_account):
tell_user(resp, withsuccess=True)
@sandbox_demobank.command("delete",
- help="""delete the bank account pointed by LIBEUFIN_SANDBOX_{USERNAME, PASSWORD}."""
+ help="""delete bank account"""
+)
+@click.option(
+ "--bank-account",
+ help="Label of the bank account to delete.",
+ required=True
)
@click.pass_obj
-def sandbox_demobank_register(obj, public, name):
- url = obj.access_api_url ("/testing/unregister")
- req = dict(username=obj.username, password=obj.password, isPublic=public)
- if name != "":
- req.update(name=name)
+def sandbox_demobank_delete(obj, bank_account):
+ url = obj.access_api_url (f"/accounts/{bank_account}")
try:
- resp = post(
+ resp = delete(
url,
- json=req,
+ auth=auth.HTTPBasicAuth(
+ obj.username,
+ obj.password
+ )
)
except Exception as e:
print(e)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -1444,15 +1444,17 @@ val sandboxApp: Application.() -> Unit = {
call.respond(ret)
return@get
}
- post("/testing/unregister") {
+ delete("accounts/{account_name}") {
// Check demobank was created.
ensureDemobank(call)
transaction {
val bankAccount = getBankAccountWithAuth(call)
+ val customerAccount = getCustomer(bankAccount.owner)
bankAccount.delete()
+ customerAccount.delete()
}
call.respond(object {})
- return@post
+ return@delete
}
// Keeping the prefix "testing" not to break tests.
post("/testing/register") {