<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema elementFormDefault="qualified"
    targetNamespace="http://docs.onestart.iu.edu/dav/pdp/xml/payment1"
    xmlns="http://docs.onestart.iu.edu/dav/pdp/xml/payment1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <!-- $Id: payment1.xsd,v 1.12 2004/11/10 22:11:06 jsissom Exp $ -->
    <!-- simple data types -->
    <xsd:simpleType name="chartType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="2"/>
            <xsd:maxLength value="2"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="orgType">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="[A-Z]{1,4}"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="subUnitType">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="[A-Z]{1,4}"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="idTypeType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="E"/>
            <xsd:enumeration value="V"/>
            <xsd:enumeration value="F"/>
            <xsd:enumeration value="S"/>
            <xsd:enumeration value="P"/>
            <xsd:enumeration value="X"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="versionType">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="1.0"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="indicatorType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="Y"/>
            <xsd:enumeration value="N"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="sourceDocNbrType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="9"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="invoiceNbrType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="25"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="poNbrType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="9"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="reqNbrType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="8"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="orgDocNbrType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="10"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="finDocTypeCodeType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="4"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="payeeIdType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="0"/>
            <xsd:maxLength value="25"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="payeeNameType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="40"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="customerIuIdentifierType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="0"/>
            <xsd:maxLength value="30"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="addressLineType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="0"/>
            <xsd:maxLength value="55"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="addressLine1Type">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="55"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="payeeOwnershipCodeType">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="[A-Z][A-Z]"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="cityType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="0"/>
            <xsd:maxLength value="30"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="countryType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="0"/>
            <xsd:maxLength value="30"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="stateType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="0"/>
            <xsd:maxLength value="30"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="zipCodeType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="0"/>
            <xsd:maxLength value="20"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="accountType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="7"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="subAcctType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="5"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="objectType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="4"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="subObjectType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="3"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="orgRefType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="0"/>
            <xsd:maxLength value="8"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="projectType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="1"/>
            <xsd:maxLength value="10"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="paymentTextType">
        <xsd:restriction base="xsd:string">
            <xsd:minLength value="0"/>
            <xsd:maxLength value="90"/>
        </xsd:restriction>
    </xsd:simpleType>
    <!-- definition of simple type elements -->
    <xsd:element name="chart" type="chartType"/>
    <xsd:element name="organization" type="orgType"/>
    <xsd:element name="sub_unit" type="subUnitType"/>
    <xsd:element name="creation_date" type="xsd:dateTime"/>
    <xsd:element name="source_doc_nbr" type="sourceDocNbrType"/>
    <xsd:element name="invoice_nbr" type="invoiceNbrType"/>
    <xsd:element name="po_nbr" type="poNbrType"/>
    <xsd:element name="req_nbr" type="reqNbrType"/>
    <xsd:element name="org_doc_nbr" type="orgDocNbrType"/>
    <xsd:element name="fdoc_typ_cd" type="finDocTypeCodeType"/>
    <xsd:element name="payee_name" type="payeeNameType"/>
    <xsd:element name="payee_own_cd" type="payeeOwnershipCodeType"/>
    <xsd:element name="customer_IU_identifier" type="customerIuIdentifierType"/>
    <xsd:element name="address1" type="addressLine1Type"/>
    <xsd:element name="address2" type="addressLineType"/>
    <xsd:element name="address3" type="addressLineType"/>
    <xsd:element name="address4" type="addressLineType"/>
    <xsd:element name="city" type="cityType"/>
    <xsd:element name="state" type="stateType"/>
    <xsd:element name="zip" type="zipCodeType"/>
    <xsd:element name="country" type="countryType"/>
    <xsd:element name="campus_address_ind" type="indicatorType"/>
    <xsd:element name="payment_date" type="xsd:date"/>
    <xsd:element name="invoice_date" type="xsd:date"/>
    <xsd:element name="attachment_ind" type="indicatorType"/>
    <xsd:element name="special_handling_ind" type="indicatorType"/>
    <xsd:element name="taxable_ind" type="indicatorType"/>
    <xsd:element name="orig_invoice_amt" type="xsd:decimal"/>
    <xsd:element name="net_payment_amt" type="xsd:decimal"/>
    <xsd:element name="invoice_tot_discount_amt" type="xsd:decimal"/>
    <xsd:element name="invoice_tot_ship_amt" type="xsd:decimal"/>
    <xsd:element name="invoice_tot_other_debits" type="xsd:decimal"/>
    <xsd:element name="invoice_tot_other_credits" type="xsd:decimal"/>
    <xsd:element name="nra_ind" type="indicatorType"/>
    <xsd:element name="immediate_ind" type="indicatorType"/>
    <xsd:element name="combine_group_ind" type="indicatorType"/>
    <xsd:element name="coa_cd" type="chartType"/>
    <xsd:element name="account_nbr" type="accountType"/>
    <xsd:element name="sub_account_nbr" type="subAcctType"/>
    <xsd:element name="object_cd" type="objectType"/>
    <xsd:element name="sub_object_cd" type="subObjectType"/>
    <xsd:element name="org_ref_id" type="orgRefType"/>
    <xsd:element name="project_cd" type="projectType"/>
    <xsd:element name="amount" type="xsd:decimal"/>
    <xsd:element name="payment_text" type="paymentTextType"/>
    <xsd:element name="detail_count" type="xsd:integer"/>
    <xsd:element name="detail_tot_amt" type="xsd:decimal"/>
    <!-- definition of attributes -->
    <xsd:attribute name="id_type" type="idTypeType"/>
    <xsd:attribute name="version" type="xsd:string"/>
    <!-- definition of complex type elements -->
    <xsd:element name="pdp_file">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="header"/>
                <xsd:element maxOccurs="unbounded" minOccurs="1" ref="group"/>
                <xsd:element ref="trailer"/>
            </xsd:sequence>
            <xsd:attribute name="version" type="versionType" use="required"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="accounting">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="coa_cd"/>
                <xsd:element ref="account_nbr"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="sub_account_nbr"/>
                <xsd:element ref="object_cd"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="sub_object_cd"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="org_ref_id"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="project_cd"/>
                <xsd:element ref="amount"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="header">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="chart"/>
                <xsd:element ref="organization"/>
                <xsd:element ref="sub_unit"/>
                <xsd:element ref="creation_date"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="trailer">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="detail_count"/>
                <xsd:element ref="detail_tot_amt"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="group">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="payee_name"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="payee_id"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="payee_own_cd"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="customer_IU_identifier"/>
                <xsd:element ref="address1"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="address2"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="address3"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="address4"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="city"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="state"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="zip"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="country"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="campus_address_ind"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="payment_date"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="attachment_ind"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="immediate_ind"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="special_handling_ind"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="taxable_ind"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="nra_ind"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="combine_group_ind"/>
                <!-- An IU check stub holds 27 note lines.  There is a line printed for each detail
                      so the number of detail items on a check needs to be subtracted from the 
                      total allowed note lines.  This can't be enforced in the schema so it is possible
                      to provide too many note lines in some cases.  This rule will be enforced in
                      code. 
                      
                      Because of this, the maximum number of detail segments is 27 (assuming they 
                      have no notes).
                      
                      If your check stub holds more or less than 27 note lines, you need to change this,
                      the maximum number of detail segments in this file and the setting MAX_NOTE_LINES
                      in the application settings file.
                      -->
                <xsd:element maxOccurs="27" minOccurs="1" ref="detail"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="detail">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="source_doc_nbr"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="invoice_nbr"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="po_nbr"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="req_nbr"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="org_doc_nbr"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="fdoc_typ_cd"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="invoice_date"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="orig_invoice_amt"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="net_payment_amt"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="invoice_tot_discount_amt"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="invoice_tot_ship_amt"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="invoice_tot_other_debits"/>
                <xsd:element maxOccurs="1" minOccurs="0" ref="invoice_tot_other_credits"/>
                <xsd:element maxOccurs="unbounded" minOccurs="1" ref="accounting"/>
                <!-- An IU check stub holds 27 note lines.  There is a line printed for each detail
                      so the number of detail items on a check needs to be subtracted from the 
                      total allowed note lines.  This can't be enforced in the schema so it is possible
                      to provide too many note lines in some cases.  This rule will be enforced in
                      code. 
                      
                      Because of this, the maximum note lines a detail can have is 26 (assuming there
                      is only one detail in the payment group).
                      
                      If your check stub holds more or less than 27 note lines, you need to change this,
                      the maximum number of detail segments in this file and the setting MAX_NOTE_LINES
                      in the application settings file.
                      -->
                <xsd:element maxOccurs="26" minOccurs="0" ref="payment_text"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="payee_id">
        <xsd:complexType>
            <xsd:simpleContent>
                <xsd:extension base="payeeIdType">
                    <xsd:attribute name="id_type" type="idTypeType" use="required"/>
                </xsd:extension>
            </xsd:simpleContent>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

