mirror of
https://github.com/Such-Software/wowcheckout.git
synced 2026-10-17 05:51:45 +02:00
fix: include fiat amount in BTCPay webhook payload; quiet wallet-rpc spam
Mirror of xmrcheckout commit eb15c52. Same two bugs, same fix. 1. _build_payload now emits amount (fiat), currency, and amount_crypto so Medusa's capture workflow captures the right value instead of 0 (which leaves payments authorized forever). 2. get_status() no longer calls set_daemon without an open wallet (was flooding logs with RPC -13). _daemon_height() probe is sufficient for daemon reachability. 3. Silenced monero.backends.jsonrpc.wallet logger for expected transient close_wallet errors.
This commit is contained in:
@@ -118,6 +118,10 @@ def _build_payload(
|
||||
invoice: Invoice,
|
||||
manually_marked: bool,
|
||||
) -> dict[str, object]:
|
||||
metadata = invoice.metadata_json or {}
|
||||
quote = metadata.get("quote") if isinstance(metadata, dict) else None
|
||||
fiat_amount = quote.get("fiat_amount") if isinstance(quote, dict) else None
|
||||
fiat_currency = quote.get("fiat_currency") if isinstance(quote, dict) else None
|
||||
return {
|
||||
"type": event_type,
|
||||
"timestamp": int(time.time()),
|
||||
@@ -127,7 +131,19 @@ def _build_payload(
|
||||
"overPaid": False,
|
||||
"partiallyPaid": False,
|
||||
"afterExpiration": _after_expiration(invoice),
|
||||
"metadata": invoice.metadata_json or {},
|
||||
"metadata": metadata,
|
||||
# Fiat amount/currency so downstream processors (e.g. Medusa) can
|
||||
# capture at the right number. Omitting this defaults Medusa's capture
|
||||
# to 0 which leaves captured_at NULL and payment_collection stuck at
|
||||
# authorized forever.
|
||||
"amount": str(fiat_amount) if fiat_amount is not None else None,
|
||||
"currency": fiat_currency,
|
||||
# Crypto amount is also useful for reconciliation in some downstreams.
|
||||
"amount_crypto": (
|
||||
str(invoice.amount_xmr)
|
||||
if getattr(invoice, "amount_xmr", None) is not None
|
||||
else None
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user