POST /validate/self-auth — Self Auth Doğrulama (Terminal Tarafından Çağrılır)
📋 Genel Bilgi
Müşteri, mobil veya web uygulaması üzerinden anlık bir QR kod veya PIN kodu oluşturur. Bu kodu mağazadaki kasiyer terminaline gösterir. Terminal bu token'ı doğrulayarak müşterinin bilgilerini ve onay durumlarını alır.
⚠️ Önemli: Bu endpoint'i terminal/kasiyer tarafı çağırır, müşteri tarafı değil. Müşteri önce mobil/web uygulamasından bir auth code üretir (QR veya PIN), sonra terminal bu kodu doğrular.
Base URL: {{url}}/validate/self-auth
Method: POST
Content-Type: application/json
🔐 Headers
| Header | Value |
|---|---|
| Authorization | Bearer {{masked_jwt_1}} |
| Content-Type | application/json |
📥 Request Body
{
"token": "{{auth_code}}",
"terminal_code": "TERM-003",
"store_code": "mobildev-mq"
}
Parametreler
| Alan | Tip | Zorunlu | Açıklama | Örnek |
|---|---|---|---|---|
token | string | ✅ | Müşterinin mobil/web uygulamasından ürettiği anlık auth code (QR/PIN) | "{{auth_code}}" |
terminal_code | string | ✅ | İşlemi gerçekleştiren terminal kodu | "TERM-003" |
store_code | string | ✅ | Mağaza kodu | "mobildev-mq" |
🔄 Akış Diyagramı (Self Auth)
Adım Açıklamaları:
| Adım | Taraf | İşlem |
|---|---|---|
| 1 | Müşteri → Mobil/Web | Uygulama üzerinden anlık auth code (QR veya PIN) üretir |
| 2 | Müşteri ← Mobil/Web | Üretilen QR/PIN müşteriye gösterilir |
| 3 | Terminal → API | Mağaza terminali, auth code'u doğrulamak için /validate/self-auth endpoint'ini çağırır |
| 4 | API → Terminal | Doğrulama sonucu (müşteri bilgisi, onay durumları) döner |
| 5 | Terminal ← Müşteri | Sonuç müşteriye gösterilir veya işlem devam eder |
✅ Response — 200 OK
{
"token": "{{auth_code}}",
"success": true,
"msisdn": "{{customer_msisdn}}",
"ip": "127.0.0.1",
"deviceInfo": {
"success": true,
"context": {
"requestId": "3e8ad7b5-60f4-4a69-9b70-a396616e8f85",
"timestamp": "2026-07-20T09:05:00.245Z",
"ip": "127.0.0.1",
"deviceContext": {
"deviceName": "Desktop Computer",
"deviceVendor": "",
"deviceModel": "",
"deviceType": "desktop",
"osName": "Windows",
"osVersion": "10",
"browserName": "Chrome",
"browserVersion": "150.0.0.0",
"cpuArchitecture": "amd64"
},
"ipContext": {
"country": null,
"countryCode": null,
"city": null,
"region": null,
"regionCode": null,
"latitude": null,
"longitude": null,
"timezone": null,
"postalCode": null,
"accuracyRadius": null
}
},
"parsedAt": "2026-07-20T09:05:00.245Z"
},
"ivt": {
"etk": {
"sms": 1,
"call": 1,
"email": 1,
"share": 1
},
"kvkk": {
"process": 1,
"share": 1,
"international": 1
},
"loyalty": -1,
"firstName": "{{customer_firstName}}",
"lastName": "{{customer_lastName}}",
"email": "{{customer_email}}"
}
}
Response Alanları
| Alan | Tip | Açıklama |
|---|---|---|
token | string | Doğrulanmış token |
success | boolean | Doğrulama sonucu |
msisdn | string | Müşteri telefon numarası |
ip | string | İstemci IP adresi (localhost: 127.0.0.1) |
deviceInfo.context | object | Cihaz ve IP detayları |
ivt.etk | object | EK onay durumları |
ivt.kvkk | object | KVKK onayları |
ivt.loyalty | integer | Sadakat puanı |
ivt.firstName | string | Müşteri adı |
ivt.lastName | string | Müşteri soyadı |
ivt.email | string | Müşteri e-posta |
❌ Error Responses
Tüm hata yanıtları aşağıdaki formatta döner:
{
"Response": {
"code": 5005,
"description": "Token cannot be empty"
},
"Success": false
}
| HTTP | code | Enum | description | Ne Zaman Oluşur |
|---|---|---|---|---|
| 400 | 5005 | SelfAuthValidateTokenEmpty | Token cannot be empty | token alanı boş gönderildi |
| 404 | 5002 | ValidateCodeNotFound | Verification code not found | Gönderilen token'a karşılık gelen aktif bir kayıt bulunamadı (exists(token) null döndü — hiç var olmamış ya da zaten kullanılmış olabilir) |
| 410 | 5007 | SelfAuthTokenExpired | Token has expired | Token bulundu ama expiredAt süresi geçmiş |
| 404 | 5003 | ValidateUserNotFound | User not found for verification | Token'a bağlı userId'ye karşılık gelen bir kullanıcı kaydı bulunamadı |
| 500 | 5006 | SelfAuthCustomerCreateProblem | A problem occurred while creating the customer | Kullanıcı bulundu ama customerId oluşturma işlemi başarısız oldu (0 döndü) |
Örnek — 400 Token Empty
{
"Response": {
"code": 5005,
"description": "Token cannot be empty"
},
"Success": false
}
Örnek — 404 Token Not Found
{
"Response": {
"code": 5002,
"description": "Verification code not found"
},
"Success": false
}
Örnek — 410 Token Expired
{
"Response": {
"code": 5007,
"description": "Token has expired"
},
"Success": false
}
Örnek — 404 User Not Found
{
"Response": {
"code": 5003,
"description": "User not found for verification"
},
"Success": false
}
Örnek — 500 Customer Create Problem
{
"Response": {
"code": 5006,
"description": "A problem occurred while creating the customer"
},
"Success": false
}
📝 Notlar
- Bu endpoint terminal/kasiyer tarafı tarafından çağrılır, müşteri tarafı değil.
- Müşteri önce mobil/web uygulamasından anlık auth code (QR veya PIN) üretir.
- Auth code geçicidir — belirli bir süre sonra süresi dolar.
ipContextalanları null döner çünkü doğrulama terminal üzerinden yapılır, müşteri IP'si doğrudan alınmaz.ivt.etkveivt.kvkkalanlarında müşterinin EK (Ek Onay) ve KVKK onay durumları bulunur.loyalty: -1değeri sadakat bilgisinin bulunamadığını gösterir.