| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- # Retry timed-out endpoints with longer timeout + get full getApig data
- $apigId = "Vo3ROWEvDy"
- # --- Step 1: getApig full response ---
- Write-Host "=== Step 1: getApig (full) ===" -ForegroundColor Cyan
- $body1 = @{ authid = $apigId } | ConvertTo-Json -Compress
- try {
- $r1 = Invoke-RestMethod -Uri "https://server.fmode.cn/api/apig/getApig" -Method POST -ContentType "application/json" -Body $body1 -TimeoutSec 30
- $json1 = $r1 | ConvertTo-Json -Depth 10
- Write-Host $json1
- } catch {
- Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
- }
- Write-Host ""
- Write-Host "---"
- Write-Host ""
- # --- Step 3 retry: created-apigorder with fcompany (original field) ---
- Write-Host "=== Step 3a: created-apigorder (fcompany, original) ===" -ForegroundColor Cyan
- $now = Get-Date
- $tradeNo = "CTEST" + $now.ToString("yyyyMMddHHmmssfff")
- $orderBody3a = @{
- fcompany = "test-openclaw-user"
- type = "wxpay"
- authid = $apigId
- params = @{
- out_trade_no = $tradeNo
- total_fee = 0.01
- body = "test"
- }
- apigid = $apigId
- oldCount = 0
- count = 100
- } | ConvertTo-Json -Depth 3 -Compress
- try {
- $r3a = Invoke-RestMethod -Uri "https://server.fmode.cn/api/apig/created-apigorder" -Method POST -ContentType "application/json" -Body $orderBody3a -TimeoutSec 60
- Write-Host "Response (fcompany):" -ForegroundColor Green
- $r3a | ConvertTo-Json -Depth 8
- } catch {
- Write-Host "Error (fcompany): $($_.Exception.Message)" -ForegroundColor Red
- }
- Write-Host ""
- # --- Step 3b: created-apigorder with user (new field per Chen Bin) ---
- Write-Host "=== Step 3b: created-apigorder (user, new) ===" -ForegroundColor Cyan
- $orderBody3b = @{
- user = "test-openclaw-user"
- type = "wxpay"
- authid = $apigId
- params = @{
- out_trade_no = $tradeNo
- total_fee = 0.01
- body = "test"
- }
- apigid = $apigId
- oldCount = 0
- count = 100
- } | ConvertTo-Json -Depth 3 -Compress
- try {
- $r3b = Invoke-RestMethod -Uri "https://server.fmode.cn/api/apig/created-apigorder" -Method POST -ContentType "application/json" -Body $orderBody3b -TimeoutSec 60
- Write-Host "Response (user):" -ForegroundColor Green
- $r3b | ConvertTo-Json -Depth 8
- } catch {
- Write-Host "Error (user): $($_.Exception.Message)" -ForegroundColor Red
- }
- Write-Host ""
- # --- Step 5 retry: saveRecharge ---
- Write-Host "=== Step 5: saveRecharge (endpoint availability) ===" -ForegroundColor Cyan
- $rechargeBody = @{
- authComp = "test"
- authid = $apigId
- apigid = "test"
- oldCount = 0
- count = 100
- orderid = "test"
- } | ConvertTo-Json -Compress
- try {
- $r5 = Invoke-RestMethod -Uri "https://server.fmode.cn/api/apig/saveRecharge" -Method POST -ContentType "application/json" -Body $rechargeBody -TimeoutSec 60
- Write-Host "Response:" -ForegroundColor Green
- $r5 | ConvertTo-Json -Depth 5
- } catch {
- Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
- }
|