API, Flussi e Integrazioni
Licenze, attivazioni, aggiornamenti e collegamenti tra control center, client e servizi esterni.
Licenze, attivazioni, aggiornamenti e collegamenti tra control center, client e servizi esterni.
Questo documento descrive il layer di integrazione della piattaforma:
E' pensato per essere leggibile sia da un team tecnico sia da un cliente avanzato che voglia comprendere come la piattaforma opera realmente.
GET /api/v1/platform/statusScopo:
GET /api/v1/catalog/homeRestituisce una risposta aggregata che include:
GET /api/v1/catalog/collectionsRestituisce:
GET /api/v1/catalog/collections/{collection}Restituisce:
GET /api/v1/catalog/productsSupporta:
GET /api/v1/catalog/products/{product}Restituisce:
POST /api/v1/commerce/checkoutPayload logico:
{
"lines": [
{
"variant_id": 123,
"quantity": 2
}
]
}
Funzioni del backend:
Risposta logica:
{
"data": {
"checkout_url": "https://shopify-domain/cart/..."
}
}
POST /api/v1/customer/loginPayload logico:
{
"email": "cliente@example.com",
"password": "password",
"device_subscription_id": "optional-device-id"
}
Effetti:
POST /api/v1/customer/registerCrea il cliente su Shopify e genera la sessione locale applicativa.
POST /api/v1/customer/password/recoverDelegato alla meccanica di recovery prevista da Shopify.
POST /api/v1/customer/logoutDisponibile solo con middleware customer.auth.
Effetti:
GET /api/v1/customer/meRestituisce:
GET /api/v1/customer/ordersRestituisce:
POST /api/v1/push/devicesPayload logico:
{
"subscription_id": "sub-001",
"onesignal_id": "one-user-001",
"push_token": "token",
"platform": "android",
"notification_email": "cliente@example.com",
"notifications_enabled": true
}
Scopo:
POST /api/v1/shopify/webhooksLa piattaforma usa un endpoint unico per tutti i topic supportati. Il controller distingue il comportamento in base all'header X-Shopify-Topic.
Esempi di topic supportati:
products/createproducts/updateproducts/deletecollections/createcollections/updatecollections/deleteorders/createorders/paidorders/cancelledwebhook_eventssequenceDiagram
participant U as Utente Installazione
participant W as Wizard Laravel
participant DB as Database
participant S as Shopify
U->>W: Compila step database
W->>DB: Salva configurazione e verifica connessione
U->>W: Crea admin
W->>DB: Crea user e shop
U->>W: Inserisce credenziali Shopify
W->>S: Test connessione e token exchange
U->>W: Avvia import
W->>S: Scarica catalogo
W->>DB: Salva prodotti, varianti, collection
U->>W: Registra webhook
W->>S: Crea subscription webhook
U->>W: Salva branding
W->>DB: Salva app settings
sequenceDiagram
participant A as App Flutter
participant B as Backend Laravel
participant S as Shopify Storefront
participant O as OneSignal
A->>B: POST /customer/login
B->>S: customerAccessTokenCreate
S-->>B: customerAccessToken
B->>S: query customer
B->>B: Crea customer session locale
B->>O: Allinea identita' push se device presente
B-->>A: token sessione + profilo
sequenceDiagram
participant A as App Flutter
participant B as Backend Laravel
participant S as Shopify Storefront
A->>B: GET /customer/orders
B->>B: Valida customer session
B->>S: query customer.orders
S-->>B: lista ordini
B-->>A: ordini normalizzati
sequenceDiagram
participant A as App Flutter
participant B as Backend Laravel
participant S as Shopify Storefront
A->>B: POST /commerce/checkout
B->>B: Valida righe e varianti locali
B->>S: cartCreate
S-->>B: checkoutUrl
B-->>A: checkoutUrl
A->>S: Apre checkout esterno
sequenceDiagram
participant S as Shopify
participant B as Backend Laravel
participant DB as Database
participant O as OneSignal
participant A as App Flutter
S->>B: webhook orders/paid
B->>B: Valida HMAC
B->>DB: Registra webhook event
B->>DB: Cerca push devices per email ordine
B->>O: Invia push
O-->>A: Notifica al cliente
La piattaforma usa un modello ibrido:
Questa architettura riduce:
pur mantenendo:
Il payload push puo' includere:
Quando un prodotto e' associato, il backend invia metadati sia in:
datacustom_dataQuesta doppia scrittura aumenta la compatibilita' col parsing lato mobile.
Prodotti, varianti, ordini e customer core appartengono a Shopify.
Branding, slide, visibilita' collection, immagini categorie e logiche push appartengono al backend Laravel.
L'app parla con Laravel. Questo consente: