<Orders>
    <UpdateOrder>
        <Function>2</Function>
        <ErrorLevel>2</ErrorLevel>
        <CheckNumber>{{ ticket_number }}</CheckNumber>
        {%- if sub_ticket_number %}
        <SubCheckNumber>{{ sub_ticket_number }}</SubCheckNumber>
        {%- endif %}
        <ReferenceNumber>{{ request_number }}</ReferenceNumber>
        <Check>
            <CheckHeader>
               {%- if terminal_number %}
               <TerminalNumber>{{ terminal_number }}</TerminalNumber>
               {%- endif %}
            </CheckHeader>
        </Check>
        <CreditCardAuth>
            <CardNumber>{{ account_number }}</CardNumber>
            <ExpirationDate>{{ expiration_date }}</ExpirationDate>
            <ReferenceNumber>{{ reference_number }}</ReferenceNumber>
            <ApprovalCode>{{ approval_code }}</ApprovalCode>
            <Amount>{{ amount }}</Amount>
            {%- if converted_gift_card_balance %}
            <GCRemainingBalance>{{ converted_gift_card_balance }}</GCRemainingBalance>
            {%- endif %}
            {%- if third_party_payment %}
            <DebitProcessing>Y</DebitProcessing>
            {%- endif %}
            <Gratuity>{{ tip_amount }}</Gratuity>
            <SlipCopies>0</SlipCopies>
            <Debit>N</Debit>
            {%- if cardholder_name %}
            <CardholderName>{{ cardholder_name|e }}</CardholderName>
            {%- endif %}
        </CreditCardAuth>
        {%- if loyalty_card_number %}
        <CreditCardAuth>
            <CardNumber>{{ loyalty_card_number }}</CardNumber>
            <ExpirationDate>XXXX</ExpirationDate>
            <LoyaltyCard>Y</LoyaltyCard>
            <Amount>0.00</Amount>
        </CreditCardAuth>
        {%- endif %}
    </UpdateOrder>
</Orders>
