# Tasks: add-payment-provider-adyen ## 1. Scaffold the package - [ ] 1.1 Create `packages/universal/payment-provider-adyen/` with `package.json` (name `@suaveplan/payment-provider-adyen`, version `0.1.0`, `sideEffects: false`, runtime deps on `@suaveplan/payment`, `@suaveplan/payment-providers`, `tslib`). - [ ] 1.2 Add `vite.config.ts` (lib build, preserveModules, externals). - [ ] 1.3 Add `vitest.config.ts` (forks pool, istanbul 100/100/100/100). - [ ] 1.4 Add `tsconfig.json` + `tsconfig.lib.json`. - [ ] 1.5 Add `tests/setup/polyfills.ts` and `tests/dep-graph.test.ts`. ## 2. Implement `AdyenConfig` - [ ] 2.1 Create `src/types/adyen.ts` exporting `AdyenConfig` as a sibling-local re-export / extension of `MerchantKeyConfig`. - [ ] 2.2 Create `src/types/adyen.md`. - [ ] 2.3 Create `src/types/index.ts` (named re-export, rule 6a). ## 3. Implement `AdyenProvider` - [ ] 3.1 Create `src/adyen/adyen.ts` exporting `class AdyenProvider implements PaymentProvider` with `name = "adyen"`. - [ ] 3.2 Constructor accepts `AdyenConfig`; injectable `randomId` is used to generate the default `reference` when `idempotencyKey` is omitted. - [ ] 3.3 Six methods (`createIntent`, `confirmIntent`, `captureIntent`, `cancelIntent`, `refund`, `getIntent`) all dispatch via the slim core's `httpRequest`, with `X-API-Key` header and `merchantAccount` in the body where Adyen requires it. - [ ] 3.4 Status / refund / payment-method mapping ported verbatim from upstream. - [ ] 3.5 Every failure path surfaces a `PaymentProviderError` (via the slim core's `httpRequest`). - [ ] 3.6 Create `src/adyen/adyen.md` (Purpose ≥2 sentences, Features, Basic + Advanced usage, API Reference, Implementation Notes — ≥200 words excluding code). - [ ] 3.7 Create `src/adyen/index.ts` (named re-export). - [ ] 3.8 Create `src/adyen/adyen.test.ts` covering all 24 verified-by test names verbatim, using a real recording `FetchLike` closure (no mocks). ## 4. Wire barrels + subpath exports - [ ] 4.1 Create `src/index.ts` re-exporting `AdyenProvider` and `AdyenConfig` via explicit named exports (rule 6a). - [ ] 4.2 Add subpath exports for `.`, `./adyen/adyen`, `./types/adyen`. ## 5. README + root-doc refresh (§13b) - [ ] 5.1 Author `README.md` (description, install, quick start, Modules list). - [ ] 5.2 Run `bun scripts/folder-reorg/generate-manifest.ts` to refresh `MANIFEST.md`. - [ ] 5.3 Run `bun scripts/generate-missing.ts` to refresh `MISSING.yml`. - [ ] 5.4 Hand-edit `STATUS.md` to add the new package row. - [ ] 5.5 Hand-edit `SUMMARY.md` to add the new package paragraph. - [ ] 5.6 `bunx markdownlint-cli2 --fix` across touched docs. ## 6. Verification gates (§13) - [ ] 6.1 Step 0 — spec reconciliation walk. - [ ] 6.2 Step 1 — `bunx turbo lint typecheck test --filter=@suaveplan/payment-provider-adyen`. - [ ] 6.3 Step 2 — `bunx turbo test:coverage --filter=@suaveplan/payment-provider-adyen` reports 100/100/100/100. - [ ] 6.4 Step 3 — `bunx turbo build --filter=@suaveplan/payment-provider-adyen`. - [ ] 6.5 Step 4 — banned-pattern scan zero. - [ ] 6.6 Step 4a — barrel-shape scan zero. - [ ] 6.7 Step 4b — runner-import scan zero. - [ ] 6.8 Step 5 — every `.ts` has a sibling `.md`. - [ ] 6.9 Step 6 — README present. - [ ] 6.10 Step 7 — no bare versions. - [ ] 6.11 Step 8 — subpath-export count matches feature-module count (2 features + root = 3 entries). - [ ] 6.12 Step 9 — security scan zero. - [ ] 6.13 Step 10 — dependent sweep (`bunx turbo test --filter=...@suaveplan/payment-provider-adyen`) green. ## 7. Fold + archive (§14) - [ ] 7.1 Fold `specs/payment-provider-adyen/spec.md` into `openspec/specs/payment-provider-adyen/spec.md`. - [ ] 7.2 Move `openspec/changes/add-payment-provider-adyen/` → `openspec/archive/2026-05-17-add-payment-provider-adyen/`.