Skip to content

Require explicit country code prefix for non-Indonesian WhatsApp numbers - #681

Merged
mnindrazaka merged 2 commits into
mainfrom
claude/ecstatic-wozniak-2q5tny
Oct 3, 2026
Merged

mnindrazaka merged 2 commits into
mainfrom
claude/ecstatic-wozniak-2q5tny

Conversation

@mnindrazaka

Copy link
Copy Markdown
Collaborator

Summary

Tighten WhatsApp number validation to require an explicit country code prefix (either 0 for Indonesian numbers or + for international numbers). Numbers without a prefix are now rejected, and non-Indonesian numbers are formatted with a + prefix when displayed in input fields.

Changes

  • Validation logic: Numbers without 0 or + prefix are now rejected during normalization, even if they fall within the valid length range (8–15 digits). This prevents ambiguous numbers like 6591234567 from being accepted without explicit country code indication.
  • Input formatting: Non-Indonesian numbers are now prefixed with + when formatted for display (formatWhatsappNumberForInput), ensuring they remain valid if re-parsed. Indonesian numbers continue to be formatted with 0 prefix.
  • Test coverage: Added three test cases covering the new validation rules:
    • Numbers without prefix are rejected
    • Numbers with separators but no prefix are rejected
    • Non-Indonesian numbers without + are rejected

Implementation details

  • A hasExplicitCountryCode flag tracks whether the input started with +, allowing the validation to distinguish between numbers that were explicitly prefixed versus those that were not.
  • The check is applied after Indonesian number detection but before length validation, ensuring all non-Indonesian numbers must have an explicit + prefix.
  • Changes are synchronized across both TypeScript (libs/ui) and Go (apps/api) implementations.

https://claude.ai/code/session_01EkfojR2rGbgfbtPZufk3yD

A bare number like 85335473895 passed validation as a generic 8-15 digit
international number, but Fonnte never delivered to it. Without a leading
0, 62 or an explicit +, the number is now rejected on both the API and the
client. The checkout prefill adds + back to stored non-Indonesian numbers
so they stay valid on resubmit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EkfojR2rGbgfbtPZufk3yD
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
gatherloop-order Ignored Ignored Oct 3, 2026 2:15am UTC
gatherloop-pos Ignored Ignored Oct 3, 2026 2:15am UTC
gatherloop-ui-storybook Ignored Ignored Oct 3, 2026 2:15am UTC

@mnindrazaka
mnindrazaka merged commit 7292c84 into main Oct 3, 2026
7 checks passed
@mnindrazaka
mnindrazaka deleted the claude/ecstatic-wozniak-2q5tny branch October 3, 2026 02:24
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.

2 participants