e47e6cfbdc
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FsEKyJrYF69Cj9ZXzFLRi
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
//go:build live
|
|
|
|
package lkgateway
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// Портфель ДЕПО в ЛК ЕСИА Финанс. PF_CONTRACT=ДД-816 PF_PORT=БР-859 PF_ISIN=RU0009029540[,…] [PF_GO=1 — отправить]
|
|
func TestLKPortfolioLive(t *testing.T) {
|
|
rc, err := NewRuntimeConfig("/var/lib/bj/.bj/setup.json")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
only := map[string]bool{}
|
|
for _, i := range strings.Split(os.Getenv("PF_ISIN"), ",") {
|
|
if i = strings.ToUpper(strings.TrimSpace(i)); i != "" {
|
|
only[i] = true
|
|
}
|
|
}
|
|
lines, skipped, err := lkPortfolioLines(context.Background(), rc, os.Getenv("PF_PORT"), only)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
body, _ := json.MarshalIndent(map[string]any{"data": map[string]any{os.Getenv("PF_CONTRACT"): lines}}, "", " ")
|
|
fmt.Println("запрос: POST /portfolio/import?import_type=depo_portfolio")
|
|
fmt.Println(string(body))
|
|
for _, s := range skipped {
|
|
fmt.Println("пропущено:", s)
|
|
}
|
|
if os.Getenv("PF_GO") != "1" {
|
|
return
|
|
}
|
|
code, resp, err := lkPortfolioPush(context.Background(), rc, os.Getenv("PF_CONTRACT"), lines)
|
|
fmt.Println("ответ HTTP", code, resp, err)
|
|
}
|