Address #14 with request correlation, bounded parser reasons, startup version reporting, and rate-limited storage and settlement logs. Preserve accounting and API identity contracts, extend portable tests, and update release versions and rollout guidance.
33 lines
1.0 KiB
C++
33 lines
1.0 KiB
C++
#pragma once
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace utils::bank
|
|
{
|
|
struct report { std::string id, decision, body; };
|
|
struct acknowledgement
|
|
{
|
|
bool valid = false;
|
|
std::string state, code, id;
|
|
// Fixed diagnostic vocabulary; never includes response text.
|
|
std::string reason = "schema";
|
|
int amount = 0, balance = 0;
|
|
};
|
|
acknowledgement parse_acknowledgement(const std::string& response);
|
|
// One game-thread writer; cancel intent is replaced by commit before points move.
|
|
class outbox
|
|
{
|
|
public:
|
|
outbox(std::filesystem::path root, std::string server, std::string endpoint);
|
|
std::vector<report> load() const;
|
|
void store(const std::string& body) const;
|
|
void erase(const std::string& id) const;
|
|
private:
|
|
std::filesystem::path file_;
|
|
std::string server_, endpoint_;
|
|
report decode(const std::string& body) const;
|
|
void save(const std::vector<report>& reports) const;
|
|
};
|
|
}
|