$loginBody = '{"username":"admin","password":"admin123","tenantCode":"T202605253515"}'
$resp = Invoke-RestMethod -Uri 'http://localhost:8006/login' -Method POST -Body $loginBody -Headers @{'Content-Type'='application/json; charset=utf-8'}
$token = $resp.token
$authHeaders = @{'Authorization'="Bearer $token"; 'tenant-code'='T202605253515'; 'X-Frontend-Type'='company'}

# Test /his/redPacket/info (actual frontend API)
try {
  $r = Invoke-WebRequest -Uri 'http://localhost:8006/his/redPacket/info' -Method GET -Headers $authHeaders -UseBasicParsing -TimeoutSec 5 -ErrorAction Stop
  $body = $r.Content | ConvertFrom-Json
  Write-Output "his/redPacket/info -> code=$($body.code)"
} catch {
  $statusCode = 0
  if ($_.Exception.Response) { $statusCode = [int]$_.Exception.Response.StatusCode }
  Write-Output "his/redPacket/info -> $statusCode"
}

# Test /store/storeStatistics (actual endpoint)
try {
  $r2 = Invoke-WebRequest -Uri 'http://localhost:8006/store/storeStatistics/list' -Method GET -Headers $authHeaders -UseBasicParsing -TimeoutSec 5 -ErrorAction Stop
  $body2 = $r2.Content | ConvertFrom-Json
  Write-Output "store/storeStatistics/list -> code=$($body2.code)"
} catch {
  $statusCode2 = 0
  if ($_.Exception.Response) { $statusCode2 = [int]$_.Exception.Response.StatusCode }
  Write-Output "store/storeStatistics/list -> $statusCode2"
}
