Files
baya-monorepo/mvp/blocker-phases/05-bnpl-setup.md
T
2026-08-02 20:37:14 +03:30

32 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Phase 05 — BNPL doesn't work at all
**Blocker:** blockers.md § "Payments" (installments).
**Depends on:** nothing. Two distinct bugs, both small.
---
## Bug A — server-side: no active BNPL gateway is ever seeded
`SeedPaymentGatewaysAsync` (`ServiceCollectionExtensions.cs:135-154`) seeds exactly
one `PaymentGatewayType.Standard` (card) gateway row — **never** a `PaymentGatewayType.Bnpl` row.
`CheckBnplEligibilityQuery.Handler.cs:45-47` and `InitiateBnplOrderCommand.Handler.cs:42-44` both short-circuit
with "No active BNPL gateway is configured" **before** ever calling `IBnplProvider` (mock or real — both are
correctly registered, just unreached).
**Fix:** extend `SeedPaymentGatewaysAsync` (or add a sibling seeder called next to it in `Program.cs:137,156`)
to idempotently insert a `PaymentGatewayType.Bnpl` row (`ProviderCode="balinyaar"`, the in-house net-of-fee
provider per `archive/docs/rules/server/money.md` §6 — needs no external credentials), same
`AnyAsync(...)` idempotency guard as the existing seeder.
## Bug B — client-side: still fully mocked, and the mock itself is broken
`client/src/services/bnpl/constants.ts:18``USE_BNPL_MOCK = true`, never flipped.
Even as a demo the mock is broken: `client/.../bnpl/apis/mockApi.ts:5-8` imports directly from the retired
`bookingRequests` mock store, bypassing that domain's own (real) seam — so any real booking-request id 404s
inside the BNPL mock. That store only ever seeds ids `1`/`2`, which age out to `expired_no_response` almost
immediately, so the D1D5 wizard is practically unreachable today regardless.
**Fix:** once Bug A lands, flip `USE_BNPL_MOCK` to `false` — the real `CheckoutBnplController` endpoints are
otherwise complete. The mock's cross-import isn't worth fixing in isolation; it becomes moot once the flag
flips.