🔐 Test OTP Login

OTP (locale / verifica)

1. Genera OTP

POST /?action=otp_generate
{
  "uid": "test-user-1"
}

2. Verifica OTP Locale

POST /?action=otp_verify_local
{
  "uid": "test-user-1",
  "otp_code": "123456"
}

3. Verifica OTP (con DOI se registrazione)

POST /?action=verify_otp
{
  "email": "user@example.com",
  "otp_code": "123456",
  "is_registration": true,
  "uid": "PNISV3sRwtjyz3d",
  "access_token": "eyJhbGciOi..."
}

Offer terms (QNTerm)

3a. QNTerm

Risolve offer_id da config (id × type) e chiama Piano offer/term/list. Se uid è vuoto, il backend lo prende da cookie __utp (JWT sub). In debug: step #69 uid_resolve + campo uid_source (body|cookie_utp|bearer|none).

POST /?action=QNTerm
{
  "id": "QN",
  "type": "offer",
  "uid": "…"   // opzionale se cookie __utp
}

3a2. offer_term_list (offer_id diretto)

POST /?action=offer_term_list
{ "offer_id": "YOUR_OFFER_ID" }

3a3. QNTermUpgrade

Esegue Piano term/change/do. uid opzionale in body se presente cookie __utp (JWT sub).

POST /?action=QNTermUpgrade
{
  "uid": "…",   // opzionale se cookie __utp
  "termid": "TM…",
  "subscriptionid": "RC…"
}

Access list & User Collector

3b. QNUserAccessList

Pubblica. Valida __utp/access_token via Piano /api/v3/user/access/list?aid=… (o JWT locale se session.skip_token_validation), poi lato server Piano publisher/user/access/list per uid.

POST /?action=QNUserAccessList
{
  "access_token": "…"   // oppure cookie __utp / Bearer
}

3b2. token_validation (privata / debug)

Solo con debug interno. Chiama Piano /api/v3/user/access/list?aid=… col token e restituisce uid. Utile per verificare URL/endpoint.

POST /?action=token_validation
{ "access_token": "…" }

3b3. QNUserCollector

Pubblica. Bind uid da sessione/token, valida access token, poi ingest login User Collector.

POST /?action=QNUserCollector
{
  "uid": "…",            // opzionale se cookie __utp
  "accessToken": "…"     // opzionale se cookie __utp
}

Piano.io

4. Login

POST /?action=login
Passwordless:
{ "email": "user@example.com", "stay_logged_in": false }

Con password:
{ "email": "user@example.com", "password": "secret", "stay_logged_in": false }

5. Registrazione

POST /?action=register
{
  "email": "user@example.com",
  "consents": {
    "terms_conditions": true,
    "profiling_consent": false,
    "marketing_consent": false
  },
  "is_magic_link_sent": true
}

6. Aggiorna Profilo

POST /?action=update_profile
Il frontend fa una sola chiamata. Il backend splitta:
1) first_name / last_name / email → form Piano
2) otp_phone / city / birth_date → JSON custom fields
{
  "uid": "PNIkNUVX7tk2nm4",
  "first_name": "Luca",
  "last_name": "Giuliani",
  "birth_date": "1990-01-15",
  "city": "Roma",
  "otp_phone": "331222222"
}

7. DOI Confirm

POST /?action=doi_confirm
{
  "uid": "PNIdym3yvtjbazv"
}

8. Get User

POST /?action=get_user
{ "uid": "PNIxxxx" }

POST /?action=get_user_email
{ "email": "user@example.com" }
Risposta data: uid, email, first_name, last_name, city, birth_date, otp_phone, has_otp_phone, profile_complete

9. Search User (per telefono)

POST /?action=search_user
{
  "phone": "3331234567"
}

10. Access Token

POST /?action=access_token
{
  "uid": "PNIdym3yvtjbazv"
}

Email (diagnostica SMTP)

11. Test invio email

POST /?action=test_mail
{
  "to": "tua@email.com"
}
Risposta: config SMTP + steps (EHLO, AUTH, MAIL FROM, RCPT TO, DATA) con errore esatto se fallisce

12. Test invio SMS

POST /?action=test_sms
{
  "phone": "3331234567"
}
Risposta: esito gateway + debug (receiver normalizzato, http_code, response)

📋 Log Chiamate