<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://bssys.com/upg/request" targetNamespace="http://bssys.com/upg/request" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="Documents">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Request" type="Request" maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation>Запрос УС к ИКШ</xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="PayDocRu">
        <xs:sequence>
            <xs:element name="AccDoc" type="AccDoc">
                <xs:annotation>
                    <xs:documentation>Реквизиты платёжного документа</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="Payer" type="PayerNoName">
                <xs:annotation>
                    <xs:documentation>Реквизиты плательщика</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="Payee" type="Payee">
                <xs:annotation>
                    <xs:documentation>Реквизиты получателя</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element minOccurs="0" name="DepartmentalInfo" type="DepartmentalInfo">
                <xs:annotation>
                    <xs:documentation>Налоговая информация: поля 101, 104 - 110 платёжного поручения</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="docExtId" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>Идентификатор документа в УС (в оффлайн клиенте)</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="AccDoc">
        <xs:attribute name="purpose" use="required">
            <xs:annotation>
                <xs:documentation>Назначение платежа</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="210"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="docDate" type="xs:date" use="required">
            <xs:annotation>
                <xs:documentation>Дата составления документа</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="docNum" use="required">
            <xs:annotation>
                <xs:documentation>Номер документа</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="6"/>
                    <xs:minLength value="1"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="docSum" use="required">
            <xs:annotation>
                <xs:documentation>Сумма платежа</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:decimal">
                    <xs:pattern value="[0-9]{1,12}(\.[0-9]{0,2}|)"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="vatSum" use="required">
            <xs:annotation>
                <xs:documentation>Сумма НДС</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:decimal">
                    <xs:pattern value="[0-9]{1,2}(\.[0-9]{0,2}|)"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="vatRate" use="required">
            <xs:annotation>
                <xs:documentation>% НДС</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:decimal">
                    <xs:pattern value="[0-9]{1,4}(\.[0-9]{0,2}|)"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="vat" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>Указывается способ расчета НДС согласно справочнику расчета НДС в CORREQTS:
                    Vat1 - расчет по % (1)
                    Vat2 - расчет по % (2)
                    VatAdd  - Расчет по % (+)
                    VatZero - "НДС не облаг."
                    VatManualRate - "Ввод НДС"
                    VatManualAll - "Ручной ввод"
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="transKind" use="required" fixed="01">
            <xs:annotation>
                <xs:documentation>Вид операции. Для платежного поручения указывается 01</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="paytKind" use="required">
            <xs:annotation>
                <xs:documentation>"Вид платежа Возможные значения: «электронно»
                    Если не указано, заполняется: «0»
                </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="15"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="paytCode" use="optional">
            <xs:annotation>
                <xs:documentation>Код вида платежа
                    Возможные значения: «0», «1».
                </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:length value="1"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="priority" use="required">
            <xs:annotation>
                <xs:documentation>Очерёдность платежа: число от 1 до 6</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:int">
                    <xs:minInclusive value="1"/>
                    <xs:maxInclusive value="6"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="codeVO" type="OperCodeType">
            <xs:annotation>
                <xs:documentation>Код вида валютной операции</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="nodocs" type="BoolType" use="optional">
            <xs:annotation>
                <xs:documentation>Документы не требуются (0 или 1)</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="incomeCode" use="optional">
            <xs:annotation>
                <xs:documentation>Кодовое назначение платежа. Возможные значения: 1, 2, 3, 4, 5</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="2"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType> 
    <xs:complexType name="Payee">
        <xs:sequence>
            <xs:element name="Name">
                <xs:annotation>
                    <xs:documentation>Наименование получателя</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="160"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="Bank" type="BankNoName">
                <xs:annotation>
                    <xs:documentation>Реквизиты банка получателя</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="Filial" minOccurs="0">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:minLength value="1"/>
                        <xs:maxLength value="15"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="personalAcc" use="optional">
            <xs:annotation>
                <xs:documentation>Номер счёта</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="AccNumType">
                    <xs:length value="20"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="kpp" type="KppType">
            <xs:annotation>
                <xs:documentation>КПП (до 9)</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="inn" use="optional">
            <xs:annotation>
                <xs:documentation>ИНН (до 12)</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="InnType"/>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="uip" use="optional">
            <xs:annotation>
                <xs:documentation>Уникальный Идентификатора Платежа</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="25"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="DepartmentalInfo">
        <xs:attribute name="drawerStatus" use="required">
            <xs:annotation>
                <xs:documentation>Показатель статуса налогоплательщика (101)</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="2"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="cbc" type="CbcType" use="required">
            <xs:annotation>
                <xs:documentation>Код бюджетной классификации (104)</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="okato" type="OkatoType" use="required">
            <xs:annotation>
                <xs:documentation>Код ОКАТО (105)</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="paytReason" use="required">
            <xs:annotation>
                <xs:documentation>Показатель основания платежа (106)</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="2"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="taxPeriod" use="required">
            <xs:annotation>
                <xs:documentation>Налоговый период / код таможенного органа (107)</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="10"/>
                    <xs:pattern value="0|..\.[0-9]{2}\.[0-9]{4}|[0-9]{8}"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="docNo" use="required">
            <xs:annotation>
                <xs:documentation>Номер налогового документа (108)</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="15"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="docDate" use="required">
            <xs:annotation>
                <xs:documentation>Дата налогового документа (109) DD.MM.YYYY</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="10"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="taxPaytKind">
            <xs:annotation>
                <xs:documentation>Тип налогового платежа (110)</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                    <xs:maxLength value="2"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>
    <xs:simpleType name="UuidSeparated">
        <xs:annotation>
            <xs:documentation>UUID с разделителями в виде дефисов. Набор из 32 символов [0-9], [a-f] или [A-F] и
                дефисов
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:pattern
                    value="[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
            />
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="BoolType">
        <xs:annotation>
            <xs:documentation>Двоичное значение: 0 или 1</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:boolean">
            <xs:pattern value="[0-1]{1}"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="AccNumType">
        <xs:annotation>
            <xs:documentation>Номер счёта или корр. счёта, 20 цифр</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:length value="20"/>
            <xs:pattern value="[0-9]{20}"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="BicType">
        <xs:annotation>
            <xs:documentation>БИК, 9 цифр</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:length value="9"/>
            <xs:pattern value="[0-9]{9}"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="CbcType">
        <xs:annotation>
            <xs:documentation>КБК, Код бюджетной классификации, 20 цифр</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:pattern value="0|.{20}"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="OperCodeType">
        <xs:annotation>
            <xs:documentation>Код вида валютной операции, 5 цифр</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:length value="5"/>
            <xs:pattern value="[0-9]{5}"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="InnType">
        <xs:annotation>
            <xs:documentation>ИНН/КИО юридического или физического лица РФ, для КИО допустимо 5 символов, для ИНН 10 или 12 цифр</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:maxLength value="12"/>
            <xs:pattern value="(0|[0-9]{5})|([0-9]{10})|([0-9]{12})"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="KppType">
        <xs:annotation>
            <xs:documentation>КПП, 9 цифр, 6-я позиция м.б. буква лат. буква</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:maxLength value="9"/>
            <xs:pattern value=".*\S.*|"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="OkatoType">
        <xs:annotation>
            <xs:documentation>ОКАТО, от 1 до 11 цифр (иногда заполняется нулём)</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="11"/>
            <xs:pattern value="[0-9]{1,11}"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="Request">
        <xs:sequence>
            <xs:element name="PayDocRu" type="PayDocRu">
                <xs:annotation>
                    <xs:documentation>Платёжное поручение рублёвое</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="requestId" type="UuidSeparated" use="required">
            <xs:annotation>
                <xs:documentation>Уникальный идентификатор запроса</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="version" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>Номер версии формата обмена</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="sender" type="xs:string">
            <xs:annotation>
                <xs:documentation>Система-отправитель</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="receiver" type="xs:string">
            <xs:annotation>
                <xs:documentation>Система-получатель
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="PayerNoName">
        <xs:sequence>
            <xs:element name="Name">
                <xs:annotation>
                    <xs:documentation>Наименование плательщика</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="160"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="Bank" type="BankNoName">
                <xs:annotation>
                    <xs:documentation>Реквизиты банка плательщика</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="Filial" minOccurs="0">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:minLength value="1"/>
                        <xs:maxLength value="15"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
        </xs:sequence>
        <xs:attributeGroup ref="OrgDataAttrNoName"/>
        <xs:attribute name="personalAcc" type="AccNumType" use="required">
            <xs:annotation>
                <xs:documentation>Номер счёта</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="BankNoName">
        <xs:sequence>
            <xs:element name="Name" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                    <xs:documentation>Наименование банка</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="80"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="BankCity" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>Название населённого пункта банка</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="30"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="SettlementType" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>Тип населённого пункта банка</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="10"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="bic" type="BicType" use="required">
            <xs:annotation>
                <xs:documentation>БИК</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="correspAcc" use="optional">
            <xs:annotation>
                <xs:documentation>Номер корр. счёта банка</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="20"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>
    <xs:attributeGroup name="OrgDataAttrNoName">
        <xs:annotation>
            <xs:documentation>ИНН, КПП в виде атрибутов</xs:documentation>
        </xs:annotation>
        <xs:attribute name="inn" use="optional">
            <xs:annotation>
                <xs:documentation>ИНН (до 12)</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="12"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="kpp" use="optional">
            <xs:annotation>
                <xs:documentation>КПП (до 9)</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="9"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:attributeGroup>
</xs:schema>
