<Orders>
    <UpdateOrder>
        <CheckNumber>{{ ticket_number }}</CheckNumber>
        {%- if sub_ticket_number %}
        <SubCheckNumber>{{ sub_ticket_number }}</SubCheckNumber>
        {%- endif %}
        <Function>4</Function>
        <ErrorLevel>2</ErrorLevel>
        <GuestCheckCopies>{{guest_check_copies}}</GuestCheckCopies>
        <AutoReprintCheckCopies>0</AutoReprintCheckCopies>
        <ReferenceNumber>{{ reference_number }}</ReferenceNumber>
        <Check>
            <CheckHeader>
               {%- if terminal_number %}
               <TerminalNumber>{{ terminal_number }}</TerminalNumber>
               {%- endif %}
            </CheckHeader>
        </Check>
        <Payment>
            <PaymentHeader>
                <CashierNumber>{{ employee_id }}</CashierNumber>
                {%- if terminal_number %}
                <TerminalNumber>{{ terminal_number }}</TerminalNumber>
                <PaymentTerminal>{{ terminal_number }}</PaymentTerminal>
                {%- endif %}
            </PaymentHeader>
            {%- for payment in payments -%}
            {%- if payment.positouch_type == 'TENDER' %}
            <PaymentDetail>
                <PaymentType>{{ payment.tender_type.id }}</PaymentType>
                <PaymentAmount>{{ cents_to_dollars(payment['payment_amount'] + payment['tip_amount']) }}</PaymentAmount>
                <PaymentTip>{{ payment['tip_amount'] }}</PaymentTip>
                {%- if payment.get('comment') %}
                <PaymentMemo>*{{ '{' + payment['comment'] + '}' }}</PaymentMemo>
                {%- endif %}
            </PaymentDetail>
            {%- endif %}
            {%- endfor %}
        </Payment>
    </UpdateOrder>
</Orders>
