<?xml version="1.0" encoding="UTF-8" ?>
<odoo>

    <template id="payment_inherit" inherit_id="website_sale.payment" name="Payment Exceptions">
        <!-- Show confirmation page if there are no sale order exceptions  -->
        <xpath expr="//div[@id='wrap']//div[hasclass('oe_cart')]" position="attributes">
            <attribute name="t-if">not order._check_sale_order_exceptions()</attribute>
        </xpath>

        <!-- Display sale order exceptions if any are found -->
        <xpath expr="//div[@id='wrap']//div[hasclass('oe_cart')]" position="after">
            <t t-if="order._check_sale_order_exceptions()">
                <t t-set="exceptions" t-value="order._check_sale_order_exceptions()" />
                <div class="col-12 col-xl order-xl-1">
                    <div class="card bg-danger text-white">
                        <div class="card-body">
                            <t t-foreach="exceptions" t-as="exception">
                                <h4>
                                    <i class="fa fa-warning mr-1" />
                                    <strong><span t-esc="exception['title']"/></strong>
                                </h4>
                                <p><span t-esc="exception['description']"/></p>
                            </t>
                        </div>
                    </div>
                    <div class="row">
                        <div class="ml-auto mr-3 mt-2">
                            <a href="/shop/cart" class="float-right btn btn-primary">
                                <span>Back to Cart
                                    <span class="fa fa-shopping-cart"/>
                                </span>
                            </a>
                        </div>
                    </div>
                </div>
            </t>
        </xpath>
    </template>

</odoo>
