<?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>Request</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>Details of payment document</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="Payer" type="PayerNoName">
                <xs:annotation>
                    <xs:documentation>Details of the Payer</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="Payee" type="Payee">
                <xs:annotation>
                    <xs:documentation>Details of the Payee</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element minOccurs="0" name="DepartmentalInfo" type="DepartmentalInfo">
                <xs:annotation>
                    <xs:documentation>Tax info: feilds 101, 104–110 of Payment Order</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="docExtId" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>Document ID in the accounting system (in the offline client)</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="AccDoc">
        <xs:attribute name="purpose" use="required">
            <xs:annotation>
                <xs:documentation>Purpose of payment</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>Issue date of document</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="docNum" use="required">
            <xs:annotation>
                <xs:documentation>Document number</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>Sum of payment</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>Sum of Value-added tax</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:decimal">
                    <xs:pattern value="[0-9]{1,16}(\.[0-9]{0,2}|)"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="vatRate" use="required">
            <xs:annotation>
                <xs:documentation>Percentage of Value-added tax</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="vat" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>Specifies the method of VAT calculation according to the VAT calculation guide:
                    Vat1 — calculation using percentage (1)
                    Vat2 — calculation using percentage (2) 
                    VatAdd — calculation using percentage (+) 
                    VatZero — without VAT 
                    VatManualRate — VAT input 
                    VatManualAll — manual input 
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="transKind" use="required" fixed="01">
            <xs:annotation>
                <xs:documentation>Type of transaction</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="paytKind" use="required">
            <xs:annotation>
                <xs:documentation>"Type of payment:
                    «электронно» - “online”
                    If not specified: “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>"Type of payment code: 
                    “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>Priority of payment: number from 1 to 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>Code of currency transaction type</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="nodocs" type="BoolType" use="optional">
            <xs:annotation>
                <xs:documentation>No documents required (0 or 1)</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="incomeCode" use="optional">
            <xs:annotation>
                <xs:documentation>Code purpose of payment. Available values: 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>Name of the Payee</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>Details of the Payee's bank</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="Filial" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>Branch of the bank</xs:documentation>
                </xs:annotation>
                <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>Account number</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>Code of the reason for registration (up to 9 digits)</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="inn" use="optional">
            <xs:annotation>
                <xs:documentation>Taxpayer Identification Number (up to 12 digits)</xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="InnType"/>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="uip" use="optional">
            <xs:annotation>
                <xs:documentation>Unique ID of Payment</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>Indicator of Status of taxpayer (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>Code of budget classification (104)</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="okato" type="OkatoType" use="required">
            <xs:annotation>
                <xs:documentation>Code of Russian Classification on Objects of Administrative Division (105)</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="paytReason" use="required">
            <xs:annotation>
                <xs:documentation>Indicator of Reason of payment (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>Tax period / customs authority code (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>Number of tax document (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>Date of tax document (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>Type of tax payment (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 with dash delimiters. Set of 32 characters [0-9], [a-f] or [A-F] and
                hyphens
            </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>Binary value: 0 or 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>Account number or сorrespondent account number of the bank, 20 digits</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>Bank Identifier Code, 9 digits</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>Code of budget classification, 20 digits</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>Currency transaction type code, 5 digits</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>Taxpayer Identification Number/Code of foreign organization of legal entity or individual of the Russian Federation, for the Code of foreign organization 5 characters are allowed, for Taxpayer Identification Number 10 or 12 digits</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>Code of the reason for registration, 9 digits, The 6th position can be a Latin letter</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>Code of Russian Classification on Objects of Administrative Division, 1 to 11 digits (sometimes filled with zero)</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>Ruble payment order</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="requestId" type="UuidSeparated" use="required">
            <xs:annotation>
                <xs:documentation>Unique Request ID</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="version" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>Version number of the exchange format</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="sender" type="xs:string">
            <xs:annotation>
                <xs:documentation>Sender system</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="receiver" type="xs:string">
            <xs:annotation>
                <xs:documentation>Receiver system
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="PayerNoName">
        <xs:sequence>
            <xs:element name="Name">
                <xs:annotation>
                    <xs:documentation>Name of the Payer</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>Details of the Payer's bank</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="Filial" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>Branch of the bank</xs:documentation>
                </xs:annotation>
                <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>Account number</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>Name of the bank</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>Name of the bank’s settlement</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>Type of the bank’s settlement</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>Bank Identifier Code</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="correspAcc" use="optional">
            <xs:annotation>
                <xs:documentation>Correspondent account number of the bank</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>Taxpayer Identification Number, Code of the reason for registration</xs:documentation>
        </xs:annotation>
        <xs:attribute name="inn" use="optional">
            <xs:annotation>
                <xs:documentation>Taxpayer Identification Number (up to 12 digits)</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>Code of the reason for registration (up to 9 digits)</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>