Wire FX conversion + deposit invoice creation into the booking hold #3

Closed
opened 2026-07-18 22:19:46 +00:00 by padreug · 1 comment
Owner

The money path is stubbed, so the happy path can't complete end-to-end (even over HTTP).

Work

  • views_api.py:_to_sats() — replace NotImplementedError with lnbits.utils.exchange_rates.fiat_amount_as_satoshis(amount, currency); pass through unchanged for sat/sats. This is the single place FX happens; the result becomes the canonical amount_sat and must not be recomputed downstream.
  • api_request_booking (and the Nostr equivalent) — after writing the held booking, create_invoice(wallet_id=room.wallet, amount=deposit_sat, extra={"tag": "chatelet", "booking_id": booking.id}), store payment_hash, set status awaiting_payment.
  • Deliver the bolt11 to the guest (REST: return it; Nostr: DM — see check-in-DM issue).

Notes

  • tasks.py:on_invoice_paid already keys off extra["tag"] == "chatelet" and get_booking_by_payment_hash, so once the invoice carries those, settle works.
  • Respect settings.deposit_percent (already computed into deposit_sat).

Acceptance

On FakeWallet: request a booking → receive a bolt11 → pay it → booking flips to confirmed, dates hard-blocked.

The money path is stubbed, so the happy path can't complete end-to-end (even over HTTP). ### Work - [ ] `views_api.py:_to_sats()` — replace `NotImplementedError` with `lnbits.utils.exchange_rates.fiat_amount_as_satoshis(amount, currency)`; pass through unchanged for `sat`/`sats`. This is the **single** place FX happens; the result becomes the canonical `amount_sat` and must not be recomputed downstream. - [ ] `api_request_booking` (and the Nostr equivalent) — after writing the `held` booking, `create_invoice(wallet_id=room.wallet, amount=deposit_sat, extra={"tag": "chatelet", "booking_id": booking.id})`, store `payment_hash`, set status `awaiting_payment`. - [ ] Deliver the bolt11 to the guest (REST: return it; Nostr: DM — see check-in-DM issue). ### Notes - `tasks.py:on_invoice_paid` already keys off `extra["tag"] == "chatelet"` and `get_booking_by_payment_hash`, so once the invoice carries those, settle works. - Respect `settings.deposit_percent` (already computed into `deposit_sat`). ### Acceptance On FakeWallet: request a booking → receive a bolt11 → pay it → booking flips to `confirmed`, dates hard-blocked.
Author
Owner

Shipped in PR #7 (FX conversion + deposit invoice into the booking hold) and released in catalog v0.1.0. Closing (auto-close phrasing never fired).

Shipped in PR #7 (FX conversion + deposit invoice into the booking hold) and released in catalog v0.1.0. Closing (auto-close phrasing never fired).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aiolabs/chatelet#3
No description provided.