feat(payment-requests) & fix(auth): restore payment-request.v1 contract and public validate endpoint (#30) - #35
Conversation
…ct and public validate endpoint - Restore docs/payment-request.v1.md and src/contracts/payment-request.v1.{ts,spec.ts} from pre-reset history (5d4e9de^), ported unchanged with its 13 error codes (Appendix A of the issue is a subset) - Scaffold PaymentRequestsModule and register it in AppModule - Add public POST /v1/payment-requests/validate returning { valid, normalized, errors } - Add unit and e2e coverage for the required golden vectors Closes Ding-Payments#30
|
@JoelVR17 eslint, tsc, build, unit (46) and e2e (7) all pass; verified the endpoint by hand against a running server. npm ci - passes locally on Windows, fails on the Linux CI runner. The committed package-lock.json is valid for the platform it was generated on (Windows) but not for Linux: on CI it errors with Missing: @emnapi/core@1.11.2 …. These are platform-specific optional deps pulled transitively by unrs-resolver (ESLint tooling). Same lockfile, npm ci green on Windows and red on Linux . And it can't be regenerated correctly from a Windows machine (Windows npm only records the win32 binding). Node version — CI uses Node 20, but @stellar/stellar-sdk@16.0.1 requires Node >=22 (EBADENGINE warning). Questions: Was CI already red on develop before this PR? |
Hey @cLamberti! Great to see you again in GrantFox Yes, the error was before this PR, so don't worry, Ill fix it locally. Thanks for your effort |
@JoelVR17 Thanks for confirming, and for the opportunity to contribute to your repo! Pura vida 🙌 |
Closes #30
Description
Implements S08 (#30): restores the canonical
payment-request.v1contract and exposes thepublic
POST /v1/payment-requests/validateendpoint. Also includes a required fix to theauth module (S03) that was leaving the
lintandtest:e2ejobs red ondevelop(see"Changes made").
Type of change
feat)fix)Changes made
S08 (#30):
docs/payment-request.v1.mdandsrc/contracts/payment-request.v1.{ts,spec.ts}from5d4e9de^, ported unchanged. The contract ships 13PAYMENT_REQUEST_*error codes; the issue's Appendix A (7) is a subset.PaymentRequestsModuleand registered it inAppModule.POST /v1/payment-requests/validate(@Public()), HTTP 200 for both valid and invalid payloads, response{ valid, normalized, errors }. Raw body (no DTO); validation is fully delegated to the contract, so unknown fields return 200 withPAYMENT_REQUEST_FIELD_UNKNOWN, not 400.@ApiBodywith example +@ApiOkResponse); rich schema deferred to SRV-036.Out of scope, deferred: request persistence (SRV-038), rate limiting (S18), detailed DTO/Swagger (SRV-036).
Auth fix (outside S08 scope, authorized by the maintainer):
SupabaseStrategy:secret→secretOrKey(passport-jwt 4.x crashed AppModule bootstrap with "requires a secret or key").src/auth/(typed theCurrentUserdecorator and its spec, referenced the jest mock directly in the guard spec).test/app.e2e-spec.ts: mockPrismaServiceso bootstrap tests run without a live database (CI does not spin up Postgres).Test plan
npm run start:dev: verified by hand against the running server (Swagger) —valid:truewithnormalized, andASSET_UNSUPPORTED/FIELD_UNKNOWN/TIMESTAMP_OUT_OF_WINDOWall correct.npm ci,eslint,prettier --check .,tsc --noEmit,build,test(46),test:e2e(7). Added.prettierignorefor vendored/docs dirs so the repo-wide format check passes.prettier --check .is pre-existing red ondevelop(95 tracked vendored files under.agents/,.claude/,docs/,README.md,eslint.config.mjs— none touched by this PR).Migrations / database
N/A
Checklist
Closes #30with the correct issue numbernpm run lintandnpm run testpass without errorsdocs/payment-request.v1.mdScreenshots