PARAMETERS: номер и дата ответа НРД («50878767 от 29.09.2026»)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FsEKyJrYF69Cj9ZXzFLRi
This commit is contained in:
@@ -244,7 +244,7 @@ func findOrderResponses(contrDID string) []orderResponse {
|
|||||||
Pkg: dir, Kind: kind, Done: done, Rejected: done && respTextRejected(body),
|
Pkg: dir, Kind: kind, Done: done, Rejected: done && respTextRejected(body),
|
||||||
Time: mt.In(time.FixedZone("МСК", 3*3600)).Format("02.01.2006 15:04:05"),
|
Time: mt.In(time.FixedZone("МСК", 3*3600)).Format("02.01.2006 15:04:05"),
|
||||||
Text: orderRespSummary(body),
|
Text: orderRespSummary(body),
|
||||||
No: strings.TrimSpace(xmlTag(body, "BizMsgIdr")),
|
No: nsdRespNoDate(body),
|
||||||
}, mt})
|
}, mt})
|
||||||
}
|
}
|
||||||
sort.Slice(tmp, func(i, j int) bool { return tmp[i].mt.Before(tmp[j].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)
|
low := strings.ToLower(body)
|
||||||
return strings.Contains(low, "отказ") || strings.Contains(low, "reject") || strings.Contains(low, "не исполнен")
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -63,3 +63,13 @@ func TestOrderRespNo(t *testing.T) {
|
|||||||
t.Fatalf("без MS010 — пусто: %q", got)
|
t.Fatalf("без MS010 — пусто: %q", got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNSDRespNoDate(t *testing.T) {
|
||||||
|
body := "<BizMsgIdr>50878767</BizMsgIdr><MsgDefIdr>sese.025.001.10</MsgDefIdr><BizSvc>MS010</BizSvc><CreDt>2026-09-29T12:43:28Z</CreDt>"
|
||||||
|
if got := nsdRespNoDate(body); got != "50878767 от 29.09.2026" {
|
||||||
|
t.Fatalf("%q", got)
|
||||||
|
}
|
||||||
|
if got := nsdRespNoDate("<CreDt>2026-09-29T21:30:00Z</CreDt><BizMsgIdr>1</BizMsgIdr>"); got != "1 от 30.09.2026" {
|
||||||
|
t.Fatalf("дата по МСК: %q", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user