metallkart-erp/scripts/test-relay.sh
louis ecedb11db4 Archivage projet ERP - etat final avant pause (2026-08-03)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-08-28 13:43:58 +03:00

40 lines
1.3 KiB
Bash

#!/bin/bash
set -e
BASE="https://erp-staging.metdesigntver.ru/api/v1"
SECRET="lwChZSo15B6eTt3OjmviMXxaVqgcE0uU"
echo "=== 1. Login ==="
curl -s -c /tmp/erp_cookie.txt "${BASE}/auth/login" \
-H "Content-Type: application/json" \
-d '{"email":"gruart@cifem-rus.ru","password":"MetallKart2026!"}' | head -c 100
echo ""
echo "=== 2. test-enqueue (admin auth) ==="
curl -s -w "\nHTTP %{http_code}" -b /tmp/erp_cookie.txt \
-H "Content-Type: application/json" \
-d '{"chatId":"test-chat-42","text":"Hello from ERP test"}' \
"${BASE}/max-relay/test-enqueue"
echo ""
echo "=== 3. GET outbound (relay secret) ==="
curl -s -w "\nHTTP %{http_code}" -H "X-Relay-Secret: ${SECRET}" \
"${BASE}/max-relay/outbound"
echo ""
echo "=== 4. POST inbound regular message ==="
curl -s -w "\nHTTP %{http_code}" -H "X-Relay-Secret: ${SECRET}" \
-H "Content-Type: application/json" \
-d '{"channel":"MAX","type":"message_created","chatId":"c1","text":"Bonjour"}' \
"${BASE}/max-relay/inbound"
echo ""
echo "=== 5. POST inbound pairing code ==="
curl -s -w "\nHTTP %{http_code}" -H "X-Relay-Secret: ${SECRET}" \
-H "Content-Type: application/json" \
-d '{"channel":"MAX","type":"message_created","chatId":"c1","text":"ABCD-EFG"}' \
"${BASE}/max-relay/inbound"
echo ""
echo "=== DONE ==="