4.7 KiB
4.7 KiB
Tasks — add-payment-provider-square
Every checkbox MUST reflect work actually done in this change. No retroactive ticking.
1. Spec authoring
- 1.1 Read
../suaveplan/enterprise/payment-providers.mdend-to-end - 1.2 Read upstream
src/square.ts,src/square.md,src/square.test.ts - 1.3 Read
openspec/AGENTS.mdSections 13 and 14 - 1.4 Read slim archive
openspec/archive/2026-05-17-slim-payment-providers/ - 1.5 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.6 Fill in
## Source mappingtable — every requirement cites a line range or appears in the "no source line" table with justification - 1.7 Draft
specs/payment-provider-square/spec.mdfromopenspec/templates/spec-delta.md - 1.8 Every requirement carries a
**Verified by:**line naming concreteit(...)titles
2. Implementation
- 2.1 Create
packages/universal/payment-provider-square/withpackage.json(0.1.0, deps:@suaveplan/payment-providers,@suaveplan/payment,tslib),tsconfig.json,tsconfig.lib.json,vite.config.ts,vitest.config.ts,tests/setup/polyfills.ts - 2.2
src/types/config.ts—SquareConfig extends ApiKeyConfigwithlocationId,sandbox?,randomId?,apiVersion?; export constantsSQUARE_DEFAULT_BASE_URL,SQUARE_SANDBOX_BASE_URL,SQUARE_DEFAULT_API_VERSION - 2.3
src/mapping/payment.ts—mapPaymentStatus,mapPayment,SquarePaymentDtotype - 2.4
src/mapping/refund.ts—mapRefundStatus,mapRefund,SquareRefundDtotype - 2.5
src/square/square.ts—SquareProvider implements PaymentProviderclass - 2.6
src/index.ts— explicit named re-exports (§6a)
3. Tests
- 3.1
src/square/square.test.ts— full lifecycle, deterministicrandomId, realFetchLikerecorder, sandbox URL flip, header pinning, idempotency-key forwarding - 3.2
src/mapping/payment.test.ts— every status branch, missing-card-details, approved-money branch - 3.3
src/mapping/refund.test.ts— every refund-status branch, reason fallback - 3.4
src/types/config.test.ts— type-level assertions (expectTypeOf) onSquareConfig extends ApiKeyConfigandlocationIdrequired-ness - 3.5
tests/dep-graph.test.ts— universal-tier purity gate (nonode:/bun:/fs/path/cryptoimports) - 3.6 Every
it(...)carries{ timeout: 5000 }
4. Documentation
- 4.1
src/square/square.md— sibling doc (≥200 words, basic + advanced examples, full API reference) - 4.2
src/types/config.md— sibling doc - 4.3
src/mapping/payment.md— sibling doc - 4.4
src/mapping/refund.md— sibling doc - 4.5
README.mdlinking every co-located.mdunder## Modules
5. Pre-archive verification (the 5-gate triple)
- 5.1
bun run check— Biome 0/0/0 across the touched files (run inside the package) - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/payment-provider-square— green - 5.3
bunx turbo test:coverage --filter=@suaveplan/payment-provider-square— 100/100/100/100 - 5.4 Manual spec-completeness audit (§12a) — every requirement implemented, every
Verified bytest exists with verbatim title - 5.5
bunx turbo build --filter=@suaveplan/payment-provider-square— green
6. Pre-archive 8-row checklist (skill Step 7)
- 6.1 Generics threaded;
expectTypeOfon literal-type claims (name: "square",SquareConfig extends ApiKeyConfig) - 6.2 No Zod boundaries claimed by spec — config is a TS interface, no runtime parse boundary in this package
- 6.3 No error codes added — the package reuses
PAYMENT_PROVIDER_CODESfrom the foundation and raises onlyPaymentProviderErrorvia the foundation'shttpRequest - 6.4 No strict-mode toggles claimed
- 6.5 No OTel instruments declared by this package (foundation owns metrics)
- 6.6 Idempotency-key generation tested with a deterministic injected
randomId - 6.7 No retroactive tick — every box reflects work done in this change
- 6.8 No
export *in any feature-module barrel — every<feature>/index.tsuses named re-exports - 6.9 No direct
vitest/bun:testimports — every test imports from@suaveplan/testing/runner
7. Archive
- 7.1 Fold spec delta into
openspec/specs/payment-provider-square/spec.md - 7.2 Move
openspec/changes/add-payment-provider-square/→openspec/archive/2026-05-17-add-payment-provider-square/ - 7.3 Refresh
STATUS.md(Pending→Completedrow added) - 7.4 Refresh
SUMMARY.md(per-package paragraph added) - 7.5 Refresh
MANIFEST.mdviabun scripts/folder-reorg/generate-manifest.ts(run after package lands) - 7.6 Add package row to
CLAUDE.mdlisting