payment quotation v2 + payment orchestration v2 draft

This commit is contained in:
Stephan D
2026-02-24 13:01:35 +01:00
parent 0646f55189
commit 6444813f38
289 changed files with 17005 additions and 16065 deletions

View File

@@ -0,0 +1,49 @@
package discovery
import "testing"
func TestNormalizeRailOperations(t *testing.T) {
got := NormalizeRailOperations([]string{
"send",
"payout.crypto",
"observe.confirm",
"unknown",
"EXTERNAL_CREDIT",
})
want := []string{
RailOperationSend,
RailOperationExternalCredit,
RailOperationObserveConfirm,
}
if len(got) != len(want) {
t.Fatalf("unexpected operations count: got=%d want=%d", len(got), len(want))
}
for i := range want {
if got[i] != want[i] {
t.Fatalf("unexpected operation[%d]: got=%q want=%q", i, got[i], want[i])
}
}
}
func TestExpandRailOperationLegacyAliases(t *testing.T) {
got := ExpandRailOperation("payout.fiat")
if len(got) != 2 {
t.Fatalf("unexpected operations count: got=%d want=2", len(got))
}
if got[0] != RailOperationExternalCredit {
t.Fatalf("unexpected first operation: got=%q want=%q", got[0], RailOperationExternalCredit)
}
if got[1] != RailOperationSend {
t.Fatalf("unexpected second operation: got=%q want=%q", got[1], RailOperationSend)
}
}
func TestIsKnownRail(t *testing.T) {
if !IsKnownRail("crypto") {
t.Fatalf("expected crypto rail to be known")
}
if IsKnownRail("telegram") {
t.Fatalf("did not expect telegram rail to be known")
}
}