fix(tochka): allow saving credential with empty customerCode/accountCode

User flow: paste JWT -> save -> «Проверить» fetches customers list ->
fill customerCode/accountId from that list. Required min(1) blocked this.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
admin
2026-05-01 23:12:43 +03:00
parent c8f0306abb
commit 5e57fdfd11
+3 -1
View File
@@ -10,7 +10,9 @@ const ENV = ['sandbox', 'prod'] as const;
const CredentialUpsert = z.object({ const CredentialUpsert = z.object({
environment: z.enum(ENV), environment: z.enum(ENV),
jwt: z.string().min(5), jwt: z.string().min(5),
customerCode: z.string().min(1).max(100), // customerCode/accountCode можно оставить пустыми и заполнить после «Проверить»:
// тестовый запрос к /open-banking/v1.0/customers вернёт реальные коды.
customerCode: z.preprocess((v) => (typeof v === 'string' ? v.trim() : v), z.string().max(100).default('')),
accountCode: optionalText(100), accountCode: optionalText(100),
bankAccountId: z.string().uuid().nullable(), bankAccountId: z.string().uuid().nullable(),
}); });