fix(checkout): handle cancelled status in Hyperswitch webhook
This commit is contained in:
parent
9cd56a05a6
commit
5ac4c3988a
1 changed files with 8 additions and 0 deletions
|
|
@ -579,6 +579,14 @@ func (s *Service) ProcessPaymentWebhook(ctx context.Context, payload []byte) err
|
|||
}
|
||||
s.logger.Info("Order failed via Hyperswitch webhook", zap.String("order_id", order.ID.String()), zap.String("payment_id", paymentID))
|
||||
return nil
|
||||
case "cancelled", "canceled":
|
||||
order.Status = "cancelled"
|
||||
order.PaymentStatus = status
|
||||
if err := s.db.WithContext(ctx).Save(&order).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
s.logger.Info("Order cancelled via Hyperswitch webhook", zap.String("order_id", order.ID.String()), zap.String("payment_id", paymentID))
|
||||
return nil
|
||||
default:
|
||||
s.logger.Debug("Hyperswitch webhook: ignoring status", zap.String("status", status), zap.String("payment_id", paymentID))
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue