From 8bc4226185f438f275417ec44717fd2e8c12e444 Mon Sep 17 00:00:00 2001 From: Sidney Gomes Date: Tue, 21 Jul 2026 19:51:57 -0300 Subject: [PATCH] fix: clear fake customer IDs from mock users so Asaas can create valid customer records --- server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.ts b/server.ts index 14e48fe..831d7f3 100644 --- a/server.ts +++ b/server.ts @@ -333,7 +333,7 @@ app.post('/api/courses/:id/unlock', authenticateToken, checkoutRateLimiter, asyn try { let customerId = user.asaasCustomerId; const apiKey = AsaasService.getApiKey(); - if (apiKey && (customerId?.startsWith('cus_sim_') || customerId?.startsWith('cus_fallback_'))) { + if (apiKey && (customerId?.startsWith('cus_sim_') || customerId?.startsWith('cus_fallback_') || ['cus_test', 'cus_00001', 'cus_00002', 'cus_00003', 'cus_00004'].includes(customerId || ''))) { customerId = null; } if (!customerId) { @@ -517,7 +517,7 @@ app.post('/api/subscription/subscribe', authenticateToken, async (req: Authentic try { let customerId = user.asaasCustomerId; const apiKey = AsaasService.getApiKey(); - if (apiKey && (customerId?.startsWith('cus_sim_') || customerId?.startsWith('cus_fallback_'))) { + if (apiKey && (customerId?.startsWith('cus_sim_') || customerId?.startsWith('cus_fallback_') || ['cus_test', 'cus_00001', 'cus_00002', 'cus_00003', 'cus_00004'].includes(customerId || ''))) { customerId = null; } if (!customerId) {