Add error handling for payment processor response in MakePaymentToProcessorService
This commit is contained in:
parent
6b5bdf1448
commit
ebe84fc757
@ -22,10 +22,13 @@ export class MakePaymentToProcessorService {
|
|||||||
|
|
||||||
const response = await firstValueFrom(
|
const response = await firstValueFrom(
|
||||||
this.httpService.post(`${url}/payments`, paymentData, {
|
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;
|
return response.status === 200;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user