Skip to content

feat: setup global request validation and payment DTOs#126

Open
Wisdom2788 wants to merge 2 commits intoMissBlue00:mainfrom
Wisdom2788:feature/backend-validation
Open

feat: setup global request validation and payment DTOs#126
Wisdom2788 wants to merge 2 commits intoMissBlue00:mainfrom
Wisdom2788:feature/backend-validation

Conversation

@Wisdom2788
Copy link
Copy Markdown

@Wisdom2788 Wisdom2788 commented Mar 26, 2026

Closes #3

Overview

Implements global request validation for Stellar Pay using NestJS ValidationPipe. This ensures all incoming payloads are strictly validated, sanitized, and transformed into DTO instances before reaching the controllers.

Changes

  • Global Validation: Configured ValidationPipe in main.ts with whitelist, forbidNonWhitelisted, and transform enabled.
  • DTO Implementation: Created CreatePaymentIntentDto with:
    • amount: Numeric, minimum 0.01.
    • currency: Strict Enum validation.
    • metadata: Optional object validation.
  • Dependencies: Added class-validator and class-transformer.

Checklist

  • Enable ValidationPipe in main.ts
  • Strip non-whitelisted properties
  • Throw error on unknown properties
  • Enable auto-transformation to DTO classes
  • Implement CreatePaymentIntentDto

How to Test

  1. Run pnpm install to get the new validation packages.
  2. Start the app: pnpm run start:dev.
  3. Test Validation: Send a POST with an amount < 0.01 or an invalid currency; verify a 400 Bad Request response.
  4. Test Strictness: Send a request with an extra field (e.g., unknown: true); verify it is rejected.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 26, 2026

@Wisdom2788 is attempting to deploy a commit to the missblue00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 26, 2026

@Wisdom2788 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@MissBlue00
Copy link
Copy Markdown
Owner

MissBlue00 commented Mar 27, 2026

@Wisdom2788 ci/cd checks failed, please resolve

@Wisdom2788
Copy link
Copy Markdown
Author

ci/cd checks passed, i await your approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backend: Configure global request validation and DTOs

2 participants