Ana içeriğe geç

cURL Örnekleri

Hızlı test için cURL komutları.

Ortam Değişkenleri

export POS_API="https://stage.pos.muditakurye.com.tr"
export API_KEY="your-internal-api-key"

Health Check

curl -s $POS_API/health | jq
{
  "status": "ok",
  "database": "connected",
  "redis": "connected",
  "uptime": "2h15m"
}

Sipariş Oluşturma (Test)

curl -X POST $POS_API/internal/orders/new \
  -H "Content-Type: application/json" \
  -H "X-Internal-Api-Key: $API_KEY" \
  -H "X-Platform: YEMEK_POS" \
  -d '{
    "providerOrderId": "test-'$(date +%s)'",
    "providerRestaurantId": "my-rest-001",
    "customerName": "Test Müşteri",
    "customerPhone": "05551112233",
    "customerAddress": "Atatürk Mah. No:1",
    "latitude": 41.0082,
    "longitude": 28.9784,
    "totalAmount": 150.00,
    "paymentMethod": "ONLINE",
    "isPickup": false,
    "items": [
      {
        "name": "Test Ürün",
        "quantity": 1,
        "unitPrice": 150.00,
        "totalPrice": 150.00,
        "options": []
      }
    ]
  }' | jq

Sipariş Durumu Güncelleme

Onayla (VERIFY)

curl -X POST $POS_API/internal/orders/status \
  -H "Content-Type: application/json" \
  -H "X-Internal-Api-Key: $API_KEY" \
  -d '{
    "providerOrderId": "getir-order-123",
    "platform": "GETIR",
    "action": "VERIFY",
    "previousStatus": "RECEIVED"
  }' | jq

Hazırla (PREPARE)

curl -X POST $POS_API/internal/orders/status \
  -H "Content-Type: application/json" \
  -H "X-Internal-Api-Key: $API_KEY" \
  -d '{
    "providerOrderId": "getir-order-123",
    "platform": "GETIR",
    "action": "PREPARE"
  }' | jq

Kuryeye Ver (HANDOVER)

curl -X POST $POS_API/internal/orders/status \
  -H "Content-Type: application/json" \
  -H "X-Internal-Api-Key: $API_KEY" \
  -d '{
    "providerOrderId": "getir-order-123",
    "platform": "GETIR",
    "action": "HANDOVER"
  }' | jq

Teslim Et (DELIVER)

curl -X POST $POS_API/internal/orders/status \
  -H "Content-Type: application/json" \
  -H "X-Internal-Api-Key: $API_KEY" \
  -d '{
    "providerOrderId": "getir-order-123",
    "platform": "GETIR",
    "action": "DELIVER"
  }' | jq

İptal Et (CANCEL)

curl -X POST $POS_API/internal/orders/status \
  -H "Content-Type: application/json" \
  -H "X-Internal-Api-Key: $API_KEY" \
  -d '{
    "providerOrderId": "ys-order-456",
    "platform": "YEMEKSEPETI",
    "action": "CANCEL",
    "reason": "Ürün stokta yok"
  }' | jq

Tam Akış Testi

Aşağıdaki script sipariş oluşturur ve tüm durumlardan geçirir:

#!/bin/bash
set -e

POS_API="https://stage.pos.muditakurye.com.tr"
API_KEY="your-internal-api-key"
ORDER_ID="flow-test-$(date +%s)"

echo "1️⃣  Sipariş oluşturuluyor..."
curl -s -X POST $POS_API/internal/orders/new \
  -H "Content-Type: application/json" \
  -H "X-Internal-Api-Key: $API_KEY" \
  -H "X-Platform: YEMEK_POS" \
  -d "{
    \"providerOrderId\": \"$ORDER_ID\",
    \"providerRestaurantId\": \"rest-001\",
    \"customerName\": \"Flow Test\",
    \"totalAmount\": 100,
    \"paymentMethod\": \"ONLINE\",
    \"isPickup\": false,
    \"items\": [{\"name\": \"Test\", \"quantity\": 1, \"unitPrice\": 100, \"totalPrice\": 100, \"options\": []}]
  }" | jq

sleep 2

echo "2️⃣  Onaylıyor (VERIFY)..."
curl -s -X POST $POS_API/internal/orders/status \
  -H "Content-Type: application/json" \
  -H "X-Internal-Api-Key: $API_KEY" \
  -d "{\"providerOrderId\": \"$ORDER_ID\", \"platform\": \"YEMEK_POS\", \"action\": \"VERIFY\"}" | jq

sleep 1

echo "3️⃣  Hazırlıyor (PREPARE)..."
curl -s -X POST $POS_API/internal/orders/status \
  -H "Content-Type: application/json" \
  -H "X-Internal-Api-Key: $API_KEY" \
  -d "{\"providerOrderId\": \"$ORDER_ID\", \"platform\": \"YEMEK_POS\", \"action\": \"PREPARE\"}" | jq

sleep 1

echo "4️⃣  Teslim ediyor (DELIVER)..."
curl -s -X POST $POS_API/internal/orders/status \
  -H "Content-Type: application/json" \
  -H "X-Internal-Api-Key: $API_KEY" \
  -d "{\"providerOrderId\": \"$ORDER_ID\", \"platform\": \"YEMEK_POS\", \"action\": \"DELIVER\"}" | jq

echo "✅ Tam akış testi tamamlandı!"