Add error handling for payment processor response in MakePaymentToProcessorService

This commit is contained in:
Jose Eduardo 2025-08-10 01:44:10 -04:00
parent 6b5bdf1448
commit ebe84fc757

View File

@ -22,10 +22,13 @@ export class MakePaymentToProcessorService {
const response = await firstValueFrom(
this.httpService.post(`${url}/payments`, paymentData, {
timeout: 2000, // 30 segundos
timeout: 2000,
}),
);
if (response.status !== 200) {
this.logger.error(response);
throw new Error(response.data.message || 'Payment processor error');
}
return response.status === 200;
}
}