Update payment status and increment attempts on processing error

This commit is contained in:
Jose Eduardo 2025-08-10 21:06:27 -04:00
parent 397fc866ec
commit 2bb71ef5a1

View File

@ -49,8 +49,15 @@ export class ProcessPaymentService {
`Error processing payment ${paymentId}:`,
error.message,
);
const status =
payment.attempts >= 2
? PaymentStatusEnum.FAILED
: PaymentStatusEnum.RETRY;
await this.repository.update(payment.id, {
status: PaymentStatusEnum.RETRY,
status,
attempts: +payment.attempts + 1,
});
}
}