Use public endpoint for game bank requests (Refs #13)

This commit is contained in:
2026-10-12 22:20:37 -04:00
parent 9cce0be438
commit 3bb0b5178e
9 changed files with 169 additions and 29 deletions
+8
View File
@@ -81,6 +81,14 @@ int main(int argc, char** argv)
{"code","ok"},{"amount",2000},{"balance",3000}};
const auto ack = parse_acknowledgement(valid.dump());
assert(ack.valid && ack.amount == 2000 && ack.balance == 3000 && ack.id == "one");
auto empty = valid;
empty["state"] = "balance"; empty["request_id"] = "";
empty["amount"] = 0; empty["balance"] = 0;
const auto zero = parse_acknowledgement(empty.dump());
assert(zero.valid && zero.amount == 0 && zero.balance == 0);
empty["ok"] = false; empty["state"] = "rejected";
empty["request_id"] = "one"; empty["code"] = "insufficient_balance";
assert(parse_acknowledgement(empty.dump()).valid);
for (const auto& field : {"amount","balance"})
for (const auto& bad : {nlohmann::json(-1),nlohmann::json(1.5),nlohmann::json("100"),nlohmann::json(1000001)})
{