1d6ab86a57
- internal/m2m/types.go: enum'ы и simple-типы из XSD НРД (M2MSchemas_260408) - internal/m2m/validators.go: pattern-валидаторы ReferenceID/ISIN/INN/UUID/SecurityCode/IdentityDocSerial/AccountID + перечисления - internal/m2m/messages.go: структуры 6 типов сообщений M2M, choice-типы через указатели, IsM2M=true автоматически в MarshalXML - internal/nsdxml/datetime.go: тип NSDDateTime (формат "YYYY-MM-DDThh:mm:ss(МСК+N)") - internal/nsdxml/codec.go: Marshal/Unmarshal XML в windows-1251 (собственный кодек CP1251, без внешних зависимостей) - internal/m2m/messages_test.go: round-trip тесты на 6 примерах + 2 эталонах из DOC/ Покрытие: m2m 73.9%, nsdxml 92.5%. make ci зелёный. Отклонение от спеки: вместо golang.org/x/text/encoding/charmap собственная таблица CP1251 на ~60 строк, потому что прокси zetit блокирует proxy.golang.org, goproxy.cn и redirect-хосты Go-модулей. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
104 lines
3.9 KiB
Go
104 lines
3.9 KiB
Go
// Package m2m реализует доменную модель сообщений M2M по XSD НРД
|
|
// (M2MSchemas_260408): simple-типы, enum'ы и структуры шести типов
|
|
// сообщений. Все имена типов и полей соответствуют XSD.
|
|
package m2m
|
|
|
|
// StatusCode — код статуса обработки (StatusCodeEnum в XSD).
|
|
type StatusCode string
|
|
|
|
const (
|
|
StatusInfo StatusCode = "INFO"
|
|
StatusError StatusCode = "ERROR"
|
|
)
|
|
|
|
// IIAContractType — тип договора ИИС (IIAContractTypeEnum в XSD).
|
|
// T12 — открытие/обмен ИИС-1 или ИИС-2; T03 — открытие/обмен ИИС-3.
|
|
type IIAContractType string
|
|
|
|
const (
|
|
IIAContractT12 IIAContractType = "T12"
|
|
IIAContractT03 IIAContractType = "T03"
|
|
)
|
|
|
|
// SecurityClassification — вид ценной бумаги (SecurityClassificationEnum).
|
|
type SecurityClassification string
|
|
|
|
const (
|
|
SecurityBond SecurityClassification = "BOND"
|
|
SecurityShar SecurityClassification = "SHAR"
|
|
SecurityMfun SecurityClassification = "MFUN"
|
|
)
|
|
|
|
// SecurityCategory — категория ценной бумаги (SecurityCategoryEnum).
|
|
type SecurityCategory string
|
|
|
|
const (
|
|
CategoryOrdn SecurityCategory = "ORDN"
|
|
CategoryPref SecurityCategory = "PREF"
|
|
CategoryUkwn SecurityCategory = "UKWN"
|
|
)
|
|
|
|
// IdentityDocumentCode — код документа, удостоверяющего личность
|
|
// (IdentityDocumentCodeEnum). Допустимые значения — двузначные строки
|
|
// согласно справочнику НРД.
|
|
type IdentityDocumentCode string
|
|
|
|
const (
|
|
DocCode01 IdentityDocumentCode = "01"
|
|
DocCode02 IdentityDocumentCode = "02"
|
|
DocCode03 IdentityDocumentCode = "03"
|
|
DocCode04 IdentityDocumentCode = "04"
|
|
DocCode05 IdentityDocumentCode = "05"
|
|
DocCode06 IdentityDocumentCode = "06"
|
|
DocCode07 IdentityDocumentCode = "07"
|
|
DocCode09 IdentityDocumentCode = "09"
|
|
DocCode10 IdentityDocumentCode = "10"
|
|
DocCode11 IdentityDocumentCode = "11"
|
|
DocCode12 IdentityDocumentCode = "12"
|
|
DocCode13 IdentityDocumentCode = "13"
|
|
DocCode14 IdentityDocumentCode = "14"
|
|
DocCode21 IdentityDocumentCode = "21"
|
|
DocCode22 IdentityDocumentCode = "22"
|
|
DocCode23 IdentityDocumentCode = "23"
|
|
DocCode26 IdentityDocumentCode = "26"
|
|
DocCode27 IdentityDocumentCode = "27"
|
|
DocCode91 IdentityDocumentCode = "91"
|
|
)
|
|
|
|
// IsolationStatus — статус обособления ценных бумаг
|
|
// (SecurityIsolationEnum). Единственное допустимое значение — SGDN.
|
|
type IsolationStatus string
|
|
|
|
const IsolationSGDN IsolationStatus = "SGDN"
|
|
|
|
// DeponentCode — код депонента (DeponentCodeType): 1..12 символов из
|
|
// множества [A-Z0-9].
|
|
type DeponentCode string
|
|
|
|
// ReferenceID — идентификатор операции (ReferenceIDType): ровно
|
|
// 16 символов, формат M2M + 13 символов [A-Z0-9].
|
|
type ReferenceID string
|
|
|
|
// ISIN — международный идентификатор ценной бумаги (ISINtype): 12
|
|
// символов, формат [A-Z]{2}[A-Z0-9]{9}[0-9].
|
|
type ISIN string
|
|
|
|
// OrganizationINN — ИНН юридического лица (OrganizationINNType): ровно
|
|
// 10 цифр.
|
|
type OrganizationINN string
|
|
|
|
// UUID — глобальный идентификатор сообщения (UUIDType): 36 символов
|
|
// формата UUID.
|
|
type UUID string
|
|
|
|
// AccountID — номер (код) счёта депо (AccountIDType): 1..50 символов.
|
|
type AccountID string
|
|
|
|
// SecurityCode — идентификатор ценной бумаги в кодах НРД
|
|
// (SecurityCodeType): ровно 12 символов из [0-9A-Z_/-].
|
|
type SecurityCode string
|
|
|
|
// IdentityDocSerial — серия или номер документа
|
|
// (IdentityDocSerialType): не короче 1 символа, без пробельных.
|
|
type IdentityDocSerial string
|