5.5 KiB
5.5 KiB
Tasks: add-payment-provider-mollie
1. Scaffold package shell
- 1.1 Create
packages/universal/payment-provider-mollie/withpackage.json(name@suaveplan/payment-provider-mollie, version0.1.0,sideEffects: false, typemodule, MIT, authorSuaveplan Team, deps@suaveplan/payment+@suaveplan/payment-providers@suaveplan/error+tslib, devDeps@suaveplan/testing+@types/node+@vitest/coverage-istanbul+typescript+vite+vite-plugin-dts+vitest, all viaworkspace:^/catalog:/catalog:build/catalog:testing— zero bare versions).
- 1.2 Add
tsconfig.jsonandtsconfig.lib.jsonmirroring the binance sibling. - 1.3 Add
vite.config.tswithpreserveModules,lib.entry = src/index.ts, externals matching the deps. - 1.4 Add
vitest.config.tswithpool: "forks",istanbulcoverage at 100/100/100/100,testTimeout: 30000,setupFiles: ["./tests/setup/polyfills.ts"]. - 1.5 Add
tests/setup/polyfills.ts(no-op placeholder mirroring the binance pattern).
2. Implement MollieProvider + helpers
- 2.1 Create
src/mollie/mollie.tsexporting:MOLLIE_DEFAULT_BASE_URLconstantMOLLIE_PROVIDER_NAMEconstantformatMollieAmount(amount: bigint): stringparseMollieAmount(value: string): bigintmapMollieStatus(status: string): PaymentStatusmapMollieRefundStatus(status: string): RefundStatusMollieProviderclass implementingPaymentProvider
- 2.2 Import all foundation symbols from
@suaveplan/payment-providersper the contract:httpRequest,composeAbortSignal,FetchLike,ApiKeyConfig,PaymentProviderError,PAYMENT_PROVIDER_CODES,httpError,parseError. - 2.3 Import payment types from
@suaveplan/payment(verbatim re-import of the same symbols upstream used). - 2.4 Use
Authorization: Bearer <apiKey>header on every call. - 2.5 Marshal Money amounts via
formatMollieAmountoutbound andparseMollieAmountinbound; preserve the{ currency, value }shape on the wire. - 2.6 Raise ONLY
PaymentProviderError— every failure path bubbles throughhttpRequestwhich raises typed errors. - 2.7 Keep
mollie.tsunder 300 lines.
3. Tests + docs
- 3.1 Create
src/mollie/mollie.test.tscovering the full plan indesign.md. All imports go through@suaveplan/testing/runner; novi.spyOn(globalThis, "fetch"); recordingFetchLikeclosures injected via constructor. Everyithas{ timeout: 5000 }. - 3.2 Cover amount-marshalling edge cases (1 cent, exact major unit, large, over-precision parse, no-decimal parse, single-decimal parse).
- 3.3 Cover the full status-map matrix and refund-status-map matrix.
- 3.4 Cover the payment-method map (creditcard / ideal / undefined).
- 3.5 Cover the HTTP_ERROR surface (rejecting fetch + non-2xx response).
- 3.6 Create
src/mollie/mollie.mdwith the §4 mandatory sections (Purpose ≥2 sentences, Features, Basic + Advanced usage, API Reference for every export, Implementation Notes), ≥200 words excl. code. - 3.7 Create
src/mollie/index.tswith explicit named exports (rule 6a). - 3.8 Create
src/index.tswith explicit named package-root exports (rule 6a). - 3.9 Create root
README.mdwith all §5 mandatory sections (H1, description, install, quick-start, Modules linkingsrc/mollie/mollie.md).
4. Subpath exports
- 4.1 Add
./mollie/molliesubpath export topackage.json#exportsmirroring the binance sibling format. Final exports count: 2 entries (.+./mollie/mollie) +./package.json.
5. Verification gates (§13)
- 5.1 Step 0 — spec reconciliation: walk every
### Requirementin the delta and confirm every named export + every**Verified by:**test name exists in source. - 5.2 Step 1 —
bunx turbo lint typecheck test --filter=@suaveplan/payment-provider-mollie. - 5.3 Step 2 —
bunx turbo test:coverage --filter=@suaveplan/payment-provider-molliereports 100/100/100/100. - 5.4 Step 3 —
bunx turbo build --filter=@suaveplan/payment-provider-mollie. - 5.5 Step 4 — banned-pattern scan returns zero output.
- 5.6 Step 4a — barrel-shape scan returns zero output (no
export *in any<feature>/index.ts). - 5.7 Step 4b — test-runner import scan returns zero output (no
direct
vitest/bun:testimports). - 5.8 Step 5 — every
.ts(excl..test.ts,.types.ts,index.ts) has a sibling.md. - 5.9 Step 6 —
README.mdexists. - 5.10 Step 7 — no bare versions in
package.json. - 5.11 Step 8 — subpath-export count = 2 (
.+./mollie/mollie). - 5.12 Step 9 — security scan returns zero output.
- 5.13 Step 10 — dependent sweep:
bunx turbo test --filter=...@suaveplan/payment-provider-molliegreen (only the package itself).
6. Root-doc refresh (§13b)
- 6.1 Run
bun scripts/folder-reorg/generate-manifest.tsto refreshMANIFEST.md. - 6.2 Run
bun scripts/generate-missing.tsto refreshMISSING.yml. - 6.3 Hand-edit
STATUS.mdto add a row for@suaveplan/payment-provider-mollie(✅ shipped). - 6.4 Hand-edit
SUMMARY.mdparagraph for the new package. - 6.5
bunx markdownlint-cli2 --fixacross touched docs.
7. Fold + archive (§14)
- 7.1 Fold
specs/payment-provider-mollie/spec.mdintoopenspec/specs/payment-provider-mollie/spec.md. - 7.2 Move
openspec/changes/add-payment-provider-mollie/→openspec/archive/2026-05-17-add-payment-provider-mollie/.