diff options
author | ms <ms@taler.net> | 2021-07-02 15:51:33 +0200 |
---|---|---|
committer | ms <ms@taler.net> | 2021-07-02 15:51:33 +0200 |
commit | 70f6de4059d29764941f7a759cee462d09f10039 (patch) | |
tree | eb35f3fde4de65b69bdc87ca5297e7c28e1180c3 /buildbot | |
parent | 9ec41ad1a7609cca6e5d53775b90306890c94ed8 (diff) | |
download | deployment-70f6de4059d29764941f7a759cee462d09f10039.tar.gz deployment-70f6de4059d29764941f7a759cee462d09f10039.tar.bz2 deployment-70f6de4059d29764941f7a759cee462d09f10039.zip |
fix amount check
Diffstat (limited to 'buildbot')
-rwxr-xr-x | buildbot/check_tip_reserve.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/buildbot/check_tip_reserve.py b/buildbot/check_tip_reserve.py index ef821fa..320c614 100755 --- a/buildbot/check_tip_reserve.py +++ b/buildbot/check_tip_reserve.py @@ -24,6 +24,7 @@ def expect_env(name): MERCHANT_BACKEND_BASE_URL = expect_env("TALER_ENV_MERCHANT_BACKEND") TALER_ENV_FRONTENDS_APITOKEN = expect_env("TALER_ENV_FRONTENDS_APITOKEN") +TALER_CONFIG_CURRENCY = expect_env("TALER_CONFIG_CURRENCY") resp = requests.get( urljoin(MERCHANT_BACKEND_BASE_URL, @@ -40,15 +41,21 @@ if len(reserves) == 0: print("merchant backend has NO tip reserves active!") exit(1) -max_amount = Amount.parse(reserves[0].get("committed_amount")) +max_amount = Amount(TALER_CONFIG_CURRENCY, 0, 0) for item in reserves[1:]: - item_amount = Amount.parse(item.get("committed_amount")) - if item_amount > max_amount: - max_amount = item_amount + committed_amount = Amount.parse(item.get("committed_amount")) + allocated_amount = Amount.parse(item.get("merchant_initial_amount")) + confirmed_amount = Amount.parse(item.get("exchange_initial_amount")) + if allocated_amount != confirmed_amount: + print("The exchange never confirmed the tip reserve amount!") + exit(1) + remaining_amount = allocated_amount - committed_amount + if remaining_amount > max_amount: + max_amount = remaining_amount # FIXME, eventually, just check the largest amount left through # all the reserves. print(f"Largest tip reserve: {max_amount}") -print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n") +print("\n\n\n\n\n\n\n") print(f"=========================================") print(f"FULL DUMP FROM THE BACKEND:\n{resp.text}") |