Update payment status and increment attempts on processing error
This commit is contained in:
parent
397fc866ec
commit
2bb71ef5a1
@ -49,8 +49,15 @@ export class ProcessPaymentService {
|
|||||||
`Error processing payment ${paymentId}:`,
|
`Error processing payment ${paymentId}:`,
|
||||||
error.message,
|
error.message,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const status =
|
||||||
|
payment.attempts >= 2
|
||||||
|
? PaymentStatusEnum.FAILED
|
||||||
|
: PaymentStatusEnum.RETRY;
|
||||||
|
|
||||||
await this.repository.update(payment.id, {
|
await this.repository.update(payment.id, {
|
||||||
status: PaymentStatusEnum.RETRY,
|
status,
|
||||||
|
attempts: +payment.attempts + 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user