Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Since the final HTML Receipt must be converted later to the printer format, we are using only a subset of HTML to make this conversion task easier. See Html Print Format /wiki/spaces/TP/pages/1409187843

Adding Logic to the Template

...

Code Block
languagexml
<html>
<head></head>
<body>
    <header>
        <img class="center" src="https://hndpt.co/34r676D" />
        {% if ($MERCHANT_NAME) %}
        <div id="merchant_name">
            <p class="large bold center">{$MERCHANT_NAME}</p>
        </div>
        {% endif %}
        {% if ($MERCHANT_LOCATION) %}
        <div id="merchant_location">
            <p class="center">{$MERCHANT_LOCATION}</p>
        </div>
        {% endif %}
        <div id="datetime" class="separator solid" style="margin-top: 10px; height: 2px; margin-bottom: 10px;"></div>
        {% if ($DATETIME) %}
        <div>
            <label class="left">{$DATETIME|date}</label>
            <span class="right">{$DATETIME|time}</span>
        </div>
        {% endif %}
    </header>
    <main>
        {% if ($RESPONSE_I18N) %}
        <div id="response">
            <p class="large bold center">
                {$RESPONSE_I18N}{% if ($ERROR_MESSAGE_I18N != null && ($ERROR_MESSAGE_I18N|trim != $RESPONSE_I18N|trim)) %}:
                {% endif %}</p>
        </div>
        {% if ($ERROR_MESSAGE_I18N != null && ($ERROR_MESSAGE_I18N|trim != $RESPONSE_I18N|trim)) %}
        <div id="error_response_message">
            <p class="large bold center">{$ERROR_MESSAGE_I18N}</p>
        </div>
        {% endif %}
        {% elseIf ($RESPONSE) %}
        <div id="response">
            <p class="large bold center">
                {$RESPONSE}{% if ($ERROR_MESSAGE != null && ($ERROR_MESSAGE|trim != $RESPONSE|trim)) %}: {% endif %}</p>
        </div>
        {% if ($ERROR_MESSAGE != null && ($ERROR_MESSAGE|trim != $RESPONSE|trim)) %}
        <div id="error_response_message">
            <p class="large bold center">{$ERROR_MESSAGE}</p>
        </div>
        {% endif %}
        {% endif %}
        {% if ($TXN_TYPE) %}
        <div id="txn_type">
            <p class="large bold center">{$TXN_TYPE_I18N}</p>
        </div>
        {% endif %}
        {% if ($TOTAL_AMOUNT) %}
        {% if ($AMOUNT) %}
        <div id="amount">
            <label class="left">{$AMOUNT_LABEL}: </label>
            <span class="large right">{$AMOUNT|currency($CURRENCY)}</span>
        </div>
        {% endif %}
        {% if ($TIP_AMOUNT) %}
        <div id="tip_amount">
            <label class="left">{$TIP_AMOUNT_LABEL}: </label>
            <span class="large right">{$TIP_AMOUNT|currency($CURRENCY)}</span>
        </div>
        {% endif %}
        <div id="total_amount">
            <label class="xlarge left bold">{$TOTAL_AMOUNT_LABEL}: </label>
            <span class="xlarge bold right">{$TOTAL_AMOUNT|currency($CURRENCY)}</span>
        </div>
        {% elseIf ($AMOUNT) %}
        <div id="amount">
            <label class="left">{$AMOUNT_LABEL}: </label>
            <span class="large right">{$AMOUNT|currency($CURRENCY)}</span>
        </div>
        {% endif %}
        {% if ($ACCOUNT_TYPE) %}
        <div id="account_type">
            <label class="left bold">{$ACCOUNT_TYPE_I18N}</label>
            <span class="right">{$ACCOUNT_TYPE}</span>
        </div>
        {% endif %}
        {% if ($DUE_AMOUNT) %}
        <div id="due_amount">
            <label class="left bold">{$DUE_AMOUNT_I18N}</label>
            <span class="right">{$DUE_AMOUNT|currency($CURRENCY)}</span>
        </div>
        {% endif %}
        <div class="separator dotted" style="margin-top: 10px; height: 2px; margin-bottom: 10px;"></div>
        {% if ($MID) %}
        <div id="mid">
            <label class="left bold">{$MID_I18N}</label>
            <span class="right">{$MID}</span>
        </div>
        {% endif %}
        {% if ($TID) %}
        <div id="tid">
            <label class="left bold">{$TID_I18N}</label>
            <span class="right">{$TID}</span>
        </div>
        {% endif %}
        {% if ($CARD_NUMBER) %}
        <div id="card_number">
            <label class="left bold">{$APP_LABEL}</label>
            <span class="right">{$CARD_NUMBER}</span>
        </div>
        {% endif %}
        {% if ($ENTRY) %}
        <div id="entry">
            <label class="left bold">{$ENTRY_I18N}</label>
            <span class="right">{$ENTRY}</span>
        </div>
        {% endif %}
        {% if ($CVM != null) && ($TXN_TYPE != "SALE VOID") && ($TXN_TYPE != "REFUND VOID") %}
        <div id="cvm">
            <label class="left bold">{$CVM_I18N}</label>
            <span class="right">{$CVM}</span>
        </div>
        {% endif %}
        {% if ($AUTH_CODE) %}
        <div id="auth_code">
            <label class="left bold">{$AUTH_CODE_I18N}</label>
            <span class="right">{$AUTH_CODE}</span>
        </div>
        {% endif %}
        <div class="separator dotted" style="margin-top: 10px; height: 2px; margin-bottom: 10px;"></div>
        {% if ($REFERENCE) %}
        <div>
            <p class="left bold">GUID</p>
        </div>
        <div id="guid">
            <p class="small left">{$REFERENCE}</p>
        </div>
        {% endif %}
        <div class="separator dotted" style="margin-top: 10px; height: 2px; margin-bottom: 10px;"></div>{% if ($RRN) %}
        <div>
  {% if ($RECEIPT_TYPE_DESCRIPTION) %}         <div<p idclass="receipt_type_descriptionleft bold">{$RRN_I18N}</p>
        </div>
        <div id="rrn">
            <p class="centersmall left">{$RECEIPT_TYPE_DESCRIPTION$RRN}</p>
        </div>
        {% endif %}
        <div class="separator soliddotted" style="margin-top: 10px; height: 2px; margin-bottom: 10px;"></div>
        {% if ($SWIPE != 1$RECEIPT_TYPE_DESCRIPTION) %}
        {% if ($TVR != null || $AID != null || $IAD != null || $TSI != null || $ARC != null || $RRN != null) %}<div id="receipt_type_description">
            <p class="center">{$RECEIPT_TYPE_DESCRIPTION}</p>
        </div>
        {% <div>endif %}
         <div  <p class="centerseparator bold">{$EMV_DETAILS_I18N}</p>
        <solid" style="margin-top: 10px; height: 2px; margin-bottom: 10px;"></div>
        {% endif if ($SWIPE != 1) %}
        {% if ($AID) %}
        <div id="aid">
            <label class="small left bold">{$AID_I18N}</label>$TVR != null || $AID != null || $IAD != null || $TSI != null || $ARC != null) %}
        <div>
            <span<p class="leftcenter bold">{$AID$EMV_DETAILS_I18N}</span>p>
        </div>
        {% endif %}
        {% if ($TVR$AID) %}
        <div id="tvraid">
            <label class="small left bold">{$TVR$AID_I18N}</label>
            <span class="left">{$TVR$AID}</span>
        </div>
        {% endif %}
        {% if ($IAD$TVR) %}
        <div id="iadtvr">
            <label class="small left bold">{$IAD$TVR_I18N}</label>
            <span class="left">{$IAD$TVR}</span>
        </div>
        {% endif %}
        {% if ($TSI$IAD) %}
        <div id="tsiiad">
            <label class="small left bold">{$TSI$IAD_I18N}</label>
            <span class="left">{$TSI$IAD}</span>
        </div>
        {% endif %}
        {% if ($ARC$TSI) %}
        <div id="arctsi">
            <label class="small left bold">{$ARC$TSI_I18N}</label>
            <span class="left">{$ARC$TSI}</span>
        </div>
        {% endif %}
        {% if ($RRN$ARC) %}
        <div id="rrnarc">
            <label class="small left bold">{$RRN$ARC_I18N}</label>
            <span class="left">{$RRN$ARC}</span>
        </div>
        {% endif %}
        {% if ($TVR != null || $AID != null || $IAD != null || $TSI != null || $ARC != null || $RRN != null) %}
        <div class="separator solid" style="margin-top: 10px; height: 2px; margin-bottom: 10px;"></div>
        {% endif %}
        {% endif %}
    </main>
    <footer>
        {% if ($SUCCESS_RESPONSE != 1 && $RESPONSE != $ERROR_MESSAGE) %}
        <div id="error_message">
            <p class="large center">{$ERROR_MESSAGE}</p>
        </div>
        <div class="separator solid" style="margin-top: 10px; height: 2px; margin-bottom: 10px;"></div>
        {% endif %}
        <div class="separator" style="margin-top: 20px; margin-bottom: 20px;"></div>
        {% if ($SIGNATURE ) %}
        <div id="signature">
            <img class="center" src="{$SIGNATURE}" />
        </div>
        <div class="separator solid" style="margin-top: 10px; height: 2px; margin-bottom: 10px;"></div>
        {% endif %}
    </footer>
</body>
</html>

...