Skip to content

Feat: validate currency iso 4217#178

Merged
Kaylahray merged 2 commits into
artisyn-io:mainfrom
Ezeh20:feat/validate-currency-iso-4217
Apr 28, 2026
Merged

Feat: validate currency iso 4217#178
Kaylahray merged 2 commits into
artisyn-io:mainfrom
Ezeh20:feat/validate-currency-iso-4217

Conversation

@Ezeh20

@Ezeh20 Ezeh20 commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Registers a custom iso4217 validator (/^[A-Z]{3}$/) in src/utils/validator.ts, following the same pattern as bcp47 and ianaTimezone
  • Replaces the weak min:3,max:3 rule on currencyPreference in src/utils/profileValidators.ts with iso4217
  • Updates docs/USER_PROFILE_PREFERENCES_API.md to document the ISO 4217 policy explicitly
  • Adds two new tests in src/controllers/__tests__/preferences.controller.test.ts:
    • Valid codes (USD, EUR, GBP, JPY, NGN) → 202
    • Invalid values (usd, US, USDD, 123, abc, u s) → 422 with currencyPreference error

Test plan

  • Run src/controllers/__tests__/preferences.controller.test.ts — both new currency tests pass
  • POST /api/preferences with currencyPreference: "usd" returns 422
  • POST /api/preferences with currencyPreference: "USD" returns 202
  • POST /api/preferences with currencyPreference: "123" returns 422

Closes #152

@Kaylahray Kaylahray merged commit 14f5d26 into artisyn-io:main Apr 28, 2026
1 check passed
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.

Validate currencyPreference As A Real ISO 4217 Currency Code

3 participants