{
 "info": {
  "_postman_id": "cc-integration-0001",
  "name": "CC Entegrasyon (Merchant → Biz)",
  "description": "API üzerinden bize bağlanan merchant'lar için. HMAC imza (X-API-Key/X-Timestamp/X-Nonce/X-Signature) collection pre-request script'inde OTOMATİK üretilir — CCApiAuth ile birebir aynı algoritma.\n\nDeğişkenler collection variables'tadır (Collection > Variables sekmesi). Doldur: cc_api_key, cc_api_token.\n\nİmza: message = apiKey|timestamp|nonce|json(cleanedBody); cleanedBody = string alanlar trim, boş('')/null düşer; signature = HMAC-SHA256(message, apiToken) hex.\n\n---\n\n## Hata Yanıtı Formatı\n\nTüm iş hataları şu zarfla döner ve **`data.error_code`** taşır (mesaj metni değişebilir, kod sabittir — merchant koda göre davranmalı):\n```\n{\n  \"status\": \"error\",\n  \"title\": \"HATA\",\n  \"description\": \"Geçersiz imza\",\n  \"message\": \"Geçersiz imza\",\n  \"data\": { \"error_code\": \"CC-AUTH-005\" },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}\n```\n> İstisna: alan **doğrulama** hataları (422) Laravel standart formatında döner ve `error_code` **taşımaz** (kod referansı: `CC-VALIDATION`).\n\n## Hata Kodları Kataloğu\n\n| error_code | HTTP | Anlam |\n|---|---|---|\n| CC-AUTH-001 | 401 | Zorunlu başlıklar eksik (X-API-Key/X-Timestamp/X-Nonce/X-Signature) |\n| CC-AUTH-002 | 401 | İstek zaman damgası ±300 sn dışında |\n| CC-AUTH-003 | 401 | Nonce tekrar kullanıldı (replay) |\n| CC-AUTH-004 | 401 | Api anahtarı geçersiz/bulunamadı |\n| CC-AUTH-005 | 401 | HMAC imzası uyuşmuyor |\n| CC-API-001 | 401 | Api servisi aktif değil |\n| CC-API-002 | 401 | İstek IP'si whitelist'te değil |\n| CC-API-003 | 400 | Tutar min/max limit dışında |\n| CC-API-004 | 400 | order_id bu api için daha önce kullanıldı |\n| CC-API-005 | 400 | Yeni işlem alımı geçici kapalı |\n| CC-BLOCK-001 | 403 | Müşteri (customer_ref/tc_no/ip) engelli |\n| CC-POOL-001 | 400 | Bu tutar için uygun modül aralığı yok |\n| CC-POOL-002 | 400 | Aralıkta aktif/kullanılabilir modül yok |\n| CC-MODULE-001 | 400 | Sağlayıcı/modül işlemi reddetti |\n| CC-TX-001 | 400 | İşlem bulunamadı (transaction_id yanlış/başka api) |\n| CC-TX-002 | 400 | İşlem sonuçlanmış, iptal edilemez |\n| CC-VALIDATION | 422 | Alan doğrulama hatası (error_code taşımaz — standart Laravel) |\n\n> Backend kaynağı: `app/CreditCardManager/Models/CCErrorCode.php` (tek doğruluk kaynağı).",
  "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
 },
 "variable": [
  {
   "key": "base_url",
   "value": "http://localhost:8000/api"
  },
  {
   "key": "cc_api_key",
   "value": ""
  },
  {
   "key": "cc_api_token",
   "value": ""
  },
  {
   "key": "order_id",
   "value": "ORD-1001"
  },
  {
   "key": "tc_no",
   "value": "11111111111"
  },
  {
   "key": "transaction_id",
   "value": ""
  },
  {
   "key": "pay_token",
   "value": ""
  },
  {
   "key": "kyc_code",
   "value": ""
  }
 ],
 "event": [
  {
   "listen": "prerequest",
   "script": {
    "type": "text/javascript",
    "exec": [
     "// ── CCApiAuth ile birebir aynı HMAC imzalama ──",
     "const key = pm.collectionVariables.get('cc_api_key');",
     "const token = pm.collectionVariables.get('cc_api_token');",
     "if (!key || !token) { console.warn('cc_api_key / cc_api_token boş — imza üretilemez'); }",
     "",
     "const ts = Math.floor(Date.now() / 1000).toString();",
     "const nonce = CryptoJS.lib.WordArray.random(16).toString(); // 32 hex (tek kullanımlık)",
     "",
     "let raw = '{}';",
     "if (pm.request.body && pm.request.body.mode === 'raw' && pm.request.body.raw) {",
     "  raw = pm.variables.replaceIn(pm.request.body.raw);",
     "}",
     "let bodyObj = {};",
     "try { bodyObj = JSON.parse(raw || '{}'); } catch (e) { bodyObj = {}; }",
     "",
     "// PHP CCApiAuth temizliği: string trim, '' ve null düş (üst seviye)",
     "const cleaned = {};",
     "Object.keys(bodyObj).forEach(function (k) {",
     "  let v = bodyObj[k];",
     "  if (typeof v === 'string') v = v.trim();",
     "  if (v !== '' && v !== null && v !== undefined) cleaned[k] = v;",
     "});",
     "",
     "// PHP json_encode: boş associative -> '[]', doluysa '{...}'",
     "const jsonString = Object.keys(cleaned).length === 0 ? '[]' : JSON.stringify(cleaned);",
     "",
     "const message = key + '|' + ts + '|' + nonce + '|' + jsonString;",
     "const sig = CryptoJS.HmacSHA256(message, token).toString(CryptoJS.enc.Hex);",
     "",
     "pm.request.headers.upsert({ key: 'X-API-Key', value: key });",
     "pm.request.headers.upsert({ key: 'X-Timestamp', value: ts });",
     "pm.request.headers.upsert({ key: 'X-Nonce', value: nonce });",
     "pm.request.headers.upsert({ key: 'X-Signature', value: sig });",
     "pm.request.headers.upsert({ key: 'Accept', value: 'application/json' });",
     "pm.request.headers.upsert({ key: 'Content-Type', value: 'application/json' });"
    ]
   }
  }
 ],
 "item": [
  {
   "name": "Create (işlem oluştur)",
   "event": [
    {
     "listen": "test",
     "script": {
      "type": "text/javascript",
      "exec": [
       "try {",
       "  const r = pm.response.json();",
       "  if (r && r.data) {",
       "    if (r.data.transaction_id) pm.collectionVariables.set('transaction_id', r.data.transaction_id);",
       "    if (r.data.pay_screen && r.data.pay_screen.pay_token) pm.collectionVariables.set('pay_token', r.data.pay_screen.pay_token);",
       "    if (r.data.kyc && r.data.kyc.code) pm.collectionVariables.set('kyc_code', r.data.kyc.code);",
       "    console.log('transaction_id / pay_token / kyc_code collection değişkenlerine yazıldı');",
       "  }",
       "} catch (e) { console.log(e); }"
      ]
     }
    }
   ],
   "request": {
    "method": "POST",
    "header": [],
    "url": {
     "raw": "{{base_url}}/v1/cc/payment/create",
     "host": [
      "{{base_url}}"
     ],
     "path": [
      "v1",
      "cc",
      "payment",
      "create"
     ]
    },
    "body": {
     "mode": "raw",
     "raw": "{\n  \"amount\": 250.75,\n  \"order_id\": \"{{order_id}}\",\n  \"customer_ref\": \"cust-123\",\n  \"customer_username\": \"aliveli\",\n  \"tc_no\": \"{{tc_no}}\",\n  \"first_name\": \"Ali\",\n  \"last_name\": \"Veli\",\n  \"birth_date\": \"1990-01-01\",\n  \"birth_place\": \"İstanbul\",\n  \"address\": \"Örnek Mah. No:1 İstanbul\",\n  \"city\": \"İstanbul\",\n  \"zip_code\": \"34000\",\n  \"email\": \"ali@example.com\",\n  \"phone\": \"+905551112233\",\n  \"return_url_success\": \"https://merchant-a.com/odeme/ok\",\n  \"return_url_fail\": \"https://merchant-a.com/odeme/fail\"\n}",
     "options": {
      "raw": {
       "language": "json"
      }
     }
    },
    "description": "ALL fields are REQUIRED. email and phone: a random/placeholder value is accepted if you do not collect them, but they must stay unique and stable per customer (used to match returning customers). phone must be E.164 with country code (e.g. +905321234567). birth_date: YYYY-MM-DD - never send an empty string. order_id must be unique per API service."
   },
   "response": [
    {
     "name": "200 — Native (pay_screen döner)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 250.75, \"order_id\": \"ORD-1001\", \"tc_no\": \"11111111111\" }"
      }
     },
     "status": "OK",
     "code": 200,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"success\",\n  \"title\": \"Başarılı\",\n  \"description\": \"İşlem oluşturuldu\",\n  \"message\": \"İşlem oluşturuldu\",\n  \"data\": {\n    \"transaction_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n    \"order_id\": \"ORD-1001\",\n    \"payment_type\": \"native\",\n    \"status\": { \"value\": \"CC_PROCESSING\", \"label\": \"İşlemde\" },\n    \"redirect_url\": null,\n    \"form_payload\": null,\n    \"pay_screen\": {\n      \"pay_token\": \"9f8e7d6c5b4a39281706a5b4c3d2e1f00112233445566778\",\n      \"pay_url\": \"http://localhost:8000/cc/pay/9f8e7d6c5b4a39281706a5b4c3d2e1f00112233445566778\"\n    },\n    \"kyc\": null\n  },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "200 — 3D (redirect_url döner)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 500, \"order_id\": \"ORD-1002\" }"
      }
     },
     "status": "OK",
     "code": 200,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"success\",\n  \"title\": \"Başarılı\",\n  \"description\": \"İşlem oluşturuldu\",\n  \"data\": {\n    \"transaction_id\": \"550e8400-e29b-41d4-a716-446655440001\",\n    \"order_id\": \"ORD-1002\",\n    \"payment_type\": \"3d\",\n    \"status\": { \"value\": \"CC_REDIRECT\", \"label\": \"3D Yönlendirme\" },\n    \"redirect_url\": \"http://localhost:8000/api/v1/cc/sandbox/3ds/550e8400-e29b-41d4-a716-446655440001\",\n    \"form_payload\": null,\n    \"pay_screen\": null,\n    \"kyc\": null\n  },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "200 — KYC gerekli (tutar .99)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 100.99, \"order_id\": \"ORD-1003\", \"tc_no\": \"11111111111\" }"
      }
     },
     "status": "OK",
     "code": 200,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"success\",\n  \"data\": {\n    \"transaction_id\": \"550e8400-e29b-41d4-a716-446655440002\",\n    \"order_id\": \"ORD-1003\",\n    \"payment_type\": \"native\",\n    \"status\": { \"value\": \"CC_KYC_REQUIRED\", \"label\": \"KYC Bekleniyor\" },\n    \"pay_screen\": { \"pay_token\": \"abc...\", \"pay_url\": \"http://localhost:8000/cc/pay/abc...\" },\n    \"kyc\": {\n      \"code\": \"483920\",\n      \"required_documents\": [\n        { \"key\": \"id_front\", \"title\": \"Kimlik Ön Yüz\", \"type\": \"image\", \"required\": true },\n        { \"key\": \"id_back\", \"title\": \"Kimlik Arka Yüz\", \"type\": \"image\", \"required\": true }\n      ],\n      \"expires_at\": \"2026-08-17 12:00:00\"\n    }\n  },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "401 — Geçersiz imza",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 250 }"
      }
     },
     "status": "Unauthorized",
     "code": 401,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"title\": \"HATA\",\n  \"description\": \"Geçersiz imza\",\n  \"message\": \"Geçersiz imza\",\n  \"data\": { \"error_code\": \"CC-AUTH-005\" },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "401 — Başlıklar eksik (CC-AUTH-001)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 250 }"
      }
     },
     "status": "Unauthorized",
     "code": 401,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"description\": \"Zorunlu başlıklar eksik\",\n  \"data\": { \"error_code\": \"CC-AUTH-001\" },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "401 — Api anahtarı geçersiz (CC-AUTH-004)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 250 }"
      }
     },
     "status": "Unauthorized",
     "code": 401,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"description\": \"Geçersiz Api anahtarı\",\n  \"data\": { \"error_code\": \"CC-AUTH-004\" },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "401 — IP whitelist dışı (CC-API-002)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 250 }"
      }
     },
     "status": "Unauthorized",
     "code": 401,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"description\": \"Ip adresi engellendi 1.2.3.4\",\n  \"data\": { \"error_code\": \"CC-API-002\" },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "400 — Tutar limit dışı (CC-API-003)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 999999 }"
      }
     },
     "status": "Bad Request",
     "code": 400,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"description\": \"Tutar 10,00 ₺ ve 50.000,00 ₺ arasında olmalıdır\",\n  \"data\": { \"error_code\": \"CC-API-003\" },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "400 — order_id kullanıldı (CC-API-004)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 250, \"order_id\": \"ORD-1001\" }"
      }
     },
     "status": "Bad Request",
     "code": 400,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"description\": \"Bu sipariş numarası kullanılmıştır, uniq bir order_id gönderiniz.\",\n  \"data\": { \"error_code\": \"CC-API-004\" },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "403 — Kullanıcı engelli (CC-BLOCK-001)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 250, \"tc_no\": \"11111111111\" }"
      }
     },
     "status": "Forbidden",
     "code": 403,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"description\": \"Bu kullanıcı engellenmiştir (TC No)\",\n  \"data\": { \"error_code\": \"CC-BLOCK-001\" },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "400 — Tutar için havuz yok (CC-POOL-001)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 7 }"
      }
     },
     "status": "Bad Request",
     "code": 400,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"description\": \"Bu tutar için uygun modül aralığı bulunamadı: 7 ₺\",\n  \"data\": { \"error_code\": \"CC-POOL-001\" },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "400 — Modül reddetti (CC-MODULE-001)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"amount\": 250 }"
      }
     },
     "status": "Bad Request",
     "code": 400,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"description\": \"Sağlayıcı işlemi reddetti\",\n  \"data\": { \"error_code\": \"CC-MODULE-001\" },\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    },
    {
     "name": "422 — Doğrulama (error_code YOK)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/create",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "create"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ }"
      }
     },
     "status": "Unprocessable Entity",
     "code": 422,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"description\": \"The amount field is required.\",\n  \"message\": \"The amount field is required.\",\n  \"timestamp\": \"2026-08-16T12:00:00+00:00\"\n}"
    }
   ]
  },
  {
   "name": "Check (durum sorgula)",
   "request": {
    "method": "POST",
    "header": [],
    "url": {
     "raw": "{{base_url}}/v1/cc/payment/check",
     "host": [
      "{{base_url}}"
     ],
     "path": [
      "v1",
      "cc",
      "payment",
      "check"
     ]
    },
    "body": {
     "mode": "raw",
     "raw": "{\n  \"transaction_id\": \"{{transaction_id}}\",\n  \"sync\": false\n}",
     "options": {
      "raw": {
       "language": "json"
      }
     }
    },
    "description": "## Durum Sorgulama\n\nKayıtlı işlem durumunu döndürür. `sync:true` gönderilirse sağlayıcıdan canlı durum da çekilir (`provider_status`).\n\n### Alanlar\n- `transaction_id` (zorunlu)\n- `sync` (ops., bool) — true ise modül `controlPayment` çağrılır\n\n### Kullanım\nCallback'i kaçırma ihtimaline karşı yedek/teyit mekanizması olarak periyodik değil, gerektiğinde çağır. Kaynak durum her zaman callback'tir; bu uç doğrulama içindir.\n\n### Yanıt\n`data.status` = { value, label } (transaction.status enum). `provider_status` sync=false ise `null`."
   },
   "response": [
    {
     "name": "200 — Onaylı",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/check",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "check"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"transaction_id\": \"550e...\", \"sync\": false }"
      }
     },
     "status": "OK",
     "code": 200,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"success\",\n  \"description\": \"İşlem durumu\",\n  \"data\": {\n    \"transaction_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n    \"order_id\": \"ORD-1001\",\n    \"status\": { \"value\": \"CC_APPROVED\", \"label\": \"Onaylandı\" },\n    \"payment_type\": { \"value\": \"native\", \"label\": \"Native / Arayüz\" },\n    \"amount\": \"250.75\",\n    \"final_amount\": \"250.75\",\n    \"kyc_required\": false,\n    \"provider_status\": null\n  },\n  \"timestamp\": \"2026-08-16T12:05:00+00:00\"\n}"
    },
    {
     "name": "400 — İşlem bulunamadı (CC-TX-001)",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/check",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "check"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"transaction_id\": \"yok\" }"
      }
     },
     "status": "Bad Request",
     "code": 400,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"description\": \"İşlem bulunamadı\",\n  \"data\": { \"error_code\": \"CC-TX-001\" },\n  \"timestamp\": \"2026-08-16T12:05:00+00:00\"\n}"
    }
   ]
  },
  {
   "name": "Cancel (işlem iptal)",
   "request": {
    "method": "POST",
    "header": [],
    "url": {
     "raw": "{{base_url}}/v1/cc/payment/cancel",
     "host": [
      "{{base_url}}"
     ],
     "path": [
      "v1",
      "cc",
      "payment",
      "cancel"
     ]
    },
    "body": {
     "mode": "raw",
     "raw": "{\n  \"transaction_id\": \"{{transaction_id}}\"\n}",
     "options": {
      "raw": {
       "language": "json"
      }
     }
    },
    "description": "## İşlem İptal\n\nSonuçlanmamış işlemleri iptal eder. İptal edilebilir durumlar: `CC_NEW`, `CC_PROCESSING`, `CC_REDIRECT`, `CC_KYC_REQUIRED`.\n\nSonuçlanmış (`CC_APPROVED`, `CC_CANCELLED`, `CC_REFUNDED`, `CC_CHARGEBACK`) işlemler iptal edilemez → 400.\n\n### Alanlar\n- `transaction_id` (zorunlu)\n\n### Yanıt\nBaşarıda `data.status` = `CC_CANCELLED` + merchant callback tetiklenir."
   },
   "response": [
    {
     "name": "200 — İptal edildi",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/cancel",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "cancel"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"transaction_id\": \"550e...\" }"
      }
     },
     "status": "OK",
     "code": 200,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"success\",\n  \"description\": \"İşlem iptal edildi\",\n  \"data\": {\n    \"transaction_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n    \"status\": { \"value\": \"CC_CANCELLED\", \"label\": \"İptal Edildi\" }\n  },\n  \"timestamp\": \"2026-08-16T12:06:00+00:00\"\n}"
    },
    {
     "name": "400 — İptal edilemez",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/cancel",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "cancel"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"transaction_id\": \"550e...\" }"
      }
     },
     "status": "Bad Request",
     "code": 400,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"error\",\n  \"description\": \"Bu işlem iptal edilemez (Onaylandı)\",\n  \"data\": { \"error_code\": \"CC-TX-002\" },\n  \"timestamp\": \"2026-08-16T12:06:00+00:00\"\n}"
    }
   ]
  },
  {
   "name": "Detail (işlem detay)",
   "request": {
    "method": "POST",
    "header": [],
    "url": {
     "raw": "{{base_url}}/v1/cc/payment/detail",
     "host": [
      "{{base_url}}"
     ],
     "path": [
      "v1",
      "cc",
      "payment",
      "detail"
     ]
    },
    "body": {
     "mode": "raw",
     "raw": "{\n  \"transaction_id\": \"{{transaction_id}}\"\n}",
     "options": {
      "raw": {
       "language": "json"
      }
     }
    },
    "description": "## İşlem Detay\n\nİşlemin tam kaydını döndürür (tutar, final_amount, durum, kyc_required, provider_ref, created_at). Sorgulama için `check` daha hafiftir; bu uç detay ekranları içindir.\n\n### Alanlar\n- `transaction_id` (zorunlu)"
   },
   "response": [
    {
     "name": "200 — Detay",
     "originalRequest": {
      "method": "POST",
      "header": [],
      "url": {
       "raw": "{{base_url}}/v1/cc/payment/detail",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "v1",
        "cc",
        "payment",
        "detail"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{ \"transaction_id\": \"550e...\" }"
      }
     },
     "status": "OK",
     "code": 200,
     "_postman_previewlanguage": "json",
     "header": [
      {
       "key": "Content-Type",
       "value": "application/json"
      }
     ],
     "cookie": [],
     "body": "{\n  \"status\": \"success\",\n  \"description\": \"İşlem detayı\",\n  \"data\": {\n    \"transaction_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n    \"order_id\": \"ORD-1001\",\n    \"payment_type\": { \"value\": \"native\", \"label\": \"Native / Arayüz\" },\n    \"amount\": \"250.75\",\n    \"final_amount\": \"250.75\",\n    \"status\": { \"value\": \"CC_APPROVED\", \"label\": \"Onaylandı\" },\n    \"kyc_required\": false,\n    \"provider_ref\": \"SBX-1A2B3C4D5E6F\",\n    \"created_at\": \"2026-08-16 12:00:00\"\n  },\n  \"timestamp\": \"2026-08-16T12:07:00+00:00\"\n}"
    }
   ]
  }
 ]
}