update order only if status is pending_payment
This commit is contained in:
@@ -239,7 +239,9 @@ export class PaymentsService {
|
||||
if (payment.status === PaymentStatusEnum.Paid) {
|
||||
throw new BadRequestException(PaymentMessage.PAYMENT_ALREADY_PAID);
|
||||
}
|
||||
payment.order.status = OrderStatus.PAID;
|
||||
if(payment.order.status === OrderStatus.PENDING_PAYMENT) {
|
||||
payment.order.status = OrderStatus.PAID;
|
||||
}
|
||||
payment.status = PaymentStatusEnum.Paid;
|
||||
payment.paidAt = new Date();
|
||||
em.persist(payment);
|
||||
@@ -262,9 +264,6 @@ export class PaymentsService {
|
||||
payment.order.status = OrderStatus.CANCELED;
|
||||
}
|
||||
|
||||
private markAsPaid(order: Order) {
|
||||
order.status = OrderStatus.PAID;
|
||||
}
|
||||
|
||||
private async getOrCreateLatestPendingPayment(
|
||||
orderId: string,
|
||||
|
||||
Reference in New Issue
Block a user