fix: clear fake customer IDs from mock users so Asaas can create valid customer records
Build and Deploy (Gitea) / build-and-deploy (push) Has been cancelled Details

This commit is contained in:
Sidney Gomes 2026-07-21 19:51:57 -03:00
parent f495d94019
commit 8bc4226185
1 changed files with 2 additions and 2 deletions

View File

@ -333,7 +333,7 @@ app.post('/api/courses/:id/unlock', authenticateToken, checkoutRateLimiter, asyn
try { try {
let customerId = user.asaasCustomerId; let customerId = user.asaasCustomerId;
const apiKey = AsaasService.getApiKey(); 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; customerId = null;
} }
if (!customerId) { if (!customerId) {
@ -517,7 +517,7 @@ app.post('/api/subscription/subscribe', authenticateToken, async (req: Authentic
try { try {
let customerId = user.asaasCustomerId; let customerId = user.asaasCustomerId;
const apiKey = AsaasService.getApiKey(); 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; customerId = null;
} }
if (!customerId) { if (!customerId) {