diff --git a/internal/lkgateway/incoming_order.go b/internal/lkgateway/incoming_order.go index da1e432..56e24b5 100644 --- a/internal/lkgateway/incoming_order.go +++ b/internal/lkgateway/incoming_order.go @@ -244,7 +244,7 @@ func findOrderResponses(contrDID string) []orderResponse { Pkg: dir, Kind: kind, Done: done, Rejected: done && respTextRejected(body), Time: mt.In(time.FixedZone("МСК", 3*3600)).Format("02.01.2006 15:04:05"), Text: orderRespSummary(body), - No: strings.TrimSpace(xmlTag(body, "BizMsgIdr")), + No: nsdRespNoDate(body), }, mt}) } sort.Slice(tmp, func(i, j int) bool { return tmp[i].mt.Before(tmp[j].mt) }) @@ -479,3 +479,15 @@ func respTextRejected(body string) bool { low := strings.ToLower(body) return strings.Contains(low, "отказ") || strings.Contains(low, "reject") || strings.Contains(low, "не исполнен") } + +// nsdRespNoDate — «номер от дата» документа НРД: BizMsgIdr и дата CreDt (МСК), например «50878767 от 29.09.2026». +func nsdRespNoDate(body string) string { + no := strings.TrimSpace(xmlTag(body, "BizMsgIdr")) + if no == "" { + return "" + } + if t, err := time.Parse(time.RFC3339, strings.TrimSpace(xmlTag(body, "CreDt"))); err == nil { + return no + " от " + t.In(time.FixedZone("МСК", 3*3600)).Format("02.01.2006") + } + return no +} diff --git a/internal/lkgateway/nocounter_test.go b/internal/lkgateway/nocounter_test.go index 07765b9..cad068e 100644 --- a/internal/lkgateway/nocounter_test.go +++ b/internal/lkgateway/nocounter_test.go @@ -63,3 +63,13 @@ func TestOrderRespNo(t *testing.T) { t.Fatalf("без MS010 — пусто: %q", got) } } + +func TestNSDRespNoDate(t *testing.T) { + body := "50878767sese.025.001.10MS0102026-09-29T12:43:28Z" + if got := nsdRespNoDate(body); got != "50878767 от 29.09.2026" { + t.Fatalf("%q", got) + } + if got := nsdRespNoDate("2026-09-29T21:30:00Z1"); got != "1 от 30.09.2026" { + t.Fatalf("дата по МСК: %q", got) + } +}