#!/bin/bash # Test SilverPAY Integration for LittleShop # This script tests the SilverPAY integration endpoints LITTLESHOP_URL="http://localhost:5000" SILVERPAY_URL="https://admin.thebankofdebbie.giize.com" echo "============================================" echo "Testing SilverPAY Integration for LittleShop" echo "============================================" echo # Test 1: Check SilverPAY Connection echo "1. Testing SilverPAY Connection..." echo " Endpoint: $LITTLESHOP_URL/api/silverpay-test/connection" curl -s "$LITTLESHOP_URL/api/silverpay-test/connection" | python3 -m json.tool || echo "Failed to connect to LittleShop" echo # Test 2: Check Exchange Rate echo "2. Testing Exchange Rate API..." echo " Endpoint: $LITTLESHOP_URL/api/silverpay-test/exchange-rate?crypto=BTC&fiat=GBP" curl -s "$LITTLESHOP_URL/api/silverpay-test/exchange-rate?crypto=BTC&fiat=GBP" | python3 -m json.tool || echo "Failed to get exchange rate" echo # Test 3: Create Test Order echo "3. Creating Test SilverPAY Order..." echo " Endpoint: $LITTLESHOP_URL/api/silverpay-test/create-order" ORDER_RESPONSE=$(curl -s -X POST "$LITTLESHOP_URL/api/silverpay-test/create-order" \ -H "Content-Type: application/json" \ -d '{ "amount": 10.00, "currency": "BTC", "externalId": "TEST-'$(date +%s)'" }') echo "$ORDER_RESPONSE" | python3 -m json.tool || echo "Failed to create order" # Extract order ID if successful ORDER_ID=$(echo "$ORDER_RESPONSE" | python3 -c "import sys, json; data=json.load(sys.stdin); print(data.get('orderId', ''))" 2>/dev/null) if [ ! -z "$ORDER_ID" ]; then echo echo "4. Checking Order Status..." echo " Order ID: $ORDER_ID" echo " Endpoint: $LITTLESHOP_URL/api/silverpay-test/order/$ORDER_ID" curl -s "$LITTLESHOP_URL/api/silverpay-test/order/$ORDER_ID" | python3 -m json.tool || echo "Failed to get order status" fi echo echo "============================================" echo "Direct SilverPAY API Test (if accessible)" echo "============================================" echo # Test direct SilverPAY API echo "Testing SilverPAY API Health..." echo " Endpoint: $SILVERPAY_URL/health" curl -s "$SILVERPAY_URL/health" | python3 -m json.tool || echo "SilverPAY API not accessible" echo echo "============================================" echo "Test Complete!" echo "============================================" echo echo "Integration Summary:" echo "1. LittleShop is configured to use: $([ "$ORDER_ID" != "" ] && echo "SilverPAY ✅" || echo "BTCPay Server (or error)")" echo "2. SilverPAY API Status: $(curl -s -o /dev/null -w "%{http_code}" "$SILVERPAY_URL/health")" echo "3. To switch providers, set 'PaymentProvider:UseSilverPay' to true/false in appsettings.json" echo