Skip to content

Commit

Permalink
web-app: trim card-number
Browse files Browse the repository at this point in the history
  • Loading branch information
jurabek committed Feb 28, 2024
1 parent 6a72c62 commit 7332203
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/backend/services/web-app/src/lib/types/checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ export const creditCardSchema = z.object({
credit_card_cvv: z.number(),
credit_card_expiration_month: z.number().min(1).max(12),
credit_card_expiration_year: z.number().max(99),
credit_card_number: z
.string()
.regex(/^[0-9]{16}$/i, 'Invalid credit card number')
});
credit_card_number: z.string().transform(v => v.replace(/\s+/g, '')).pipe(z.string().min(1, { message: 'This field is required' }))
});;

export const checkoutScheme = z.object({
address: addressSchema,
Expand Down

0 comments on commit 7332203

Please sign in to comment.