chore: add check address

This commit is contained in:
2026-02-24 18:26:20 +01:00
parent c51188857c
commit a87e9a1441
4 changed files with 52 additions and 0 deletions
+8
View File
@@ -6,6 +6,7 @@ package handlers
import (
"gestion/db"
"gestion/models"
"gestion/services"
"log"
"net/http"
@@ -305,6 +306,13 @@ func ValidateBasket(c *gin.Context) {
return
}
cmd := &models.Command{DeliveryAddress: req.DeliveryAddress}
if err := database.CheckAddress(cmd); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error(), "corrected_address": cmd.DeliveryAddress})
return
}
req.DeliveryAddress = cmd.DeliveryAddress
log.Printf("🛒 [CHECKOUT] Début checkout pour: %s", usernameStr)
// ============================================