This commit is contained in:
parent
5d3a3adb86
commit
1a38cfe5d7
7 changed files with 169 additions and 17 deletions
|
|
@ -155,9 +155,42 @@ public:
|
|||
|
||||
std::optional<PaidStatus> CheckPaid(const std::string&, std::int64_t) override {
|
||||
std::error_code ec;
|
||||
return PaidStatus{
|
||||
std::filesystem::exists(marker_, ec) ? PayState::Paid : PayState::Pending,
|
||||
"fake" };
|
||||
if (std::filesystem::exists(marker_, ec)) {
|
||||
return PaidStatus{ PayState::Paid, "fake" };
|
||||
}
|
||||
PaidStatus out;
|
||||
out.state = PayState::Pending;
|
||||
out.method = "fake";
|
||||
// "<marker>.seen" is the in-flight state: money visible on the
|
||||
// network, finality still pending. It exists so the e2e suite can
|
||||
// drive the order page's "your payment is on its way" notice the
|
||||
// same way the marker itself drives "paid".
|
||||
std::filesystem::path seenMarker = marker_;
|
||||
seenMarker += ".seen";
|
||||
out.seen = std::filesystem::exists(seenMarker, ec);
|
||||
return out;
|
||||
}
|
||||
|
||||
// The crypto slot's fake renders payment INSTRUCTIONS, like the real
|
||||
// EURC rail, so the suites exercise the order page's self-hosted branch
|
||||
// (address, window, the in-flight notice) rather than the hosted button
|
||||
// that slot never shows in production. The bank fake keeps the button,
|
||||
// mirroring Mollie. Fixed values, so assertions can pin them.
|
||||
std::optional<PayInstructions> Instructions(const std::string&,
|
||||
std::int64_t totalMinor) const override {
|
||||
if (name_ != "fake-crypto" || totalMinor <= 0) return std::nullopt;
|
||||
PayInstructions out;
|
||||
out.address = "0x" + std::string(40, 'f');
|
||||
out.amount = Money::FormatMinor(totalMinor);
|
||||
out.deadlineUnix =
|
||||
std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::system_clock::now().time_since_epoch()).count()
|
||||
+ 24 * 3600;
|
||||
PayChainOption chain;
|
||||
chain.name = "fake-chain";
|
||||
chain.contract = "0x" + std::string(40, 'f');
|
||||
out.chains.push_back(std::move(chain));
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string_view Name() const override { return name_; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue