fix(checkout): handle cancelled status in Hyperswitch webhook

This commit is contained in:
senke 2026-02-22 14:42:57 +01:00
parent 9cd56a05a6
commit 5ac4c3988a

View file

@ -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