{% set sImageUrl = oViewConf.getModuleUrl('d3unzer', 'out/img/') %}
{% set oHeidelPaySettings = oHeidelpayViewConfig.getSettings() %}
{% set oHeidelPayment = oHeidelPaySettings.getPayment(paymentmethod) %}
{% set returnParameter = { 'configoptintext': 'configoptintext', 'accountbrand': 'accountbrand', 'transactionid': 'transactionid', 'd3transactionlogid': 'd3transactionlogid' } %}
{% set responseParameter = oHeidelpayViewConfig.getAction(oHeidelPayment, 'IN', returnParameter) %}
{% set sBrandIdent = responseParameter.accountbrand %}
{% set sFullImageUrl = sImageUrl ~ 'logo_ratenkauf_ec.jpg' %}

{% block heidelpay_easycredit %}
    <div class="well well-sm">
        <dl>
            <dt>
                <input type="radio"
                        {% if blD3HeidelpayHasSameAdresses and blD3HeidelpayAllowEasyCredit %}
                            id="payment_{{ sPaymentID }}"
                            name="paymentid"
                            value="{{ sPaymentID }}"
                            {% if oView.getCheckedPaymentId() == paymentmethod.oxpayments__oxid.value %}checked{% endif %}
                        {% else %}
                            disabled
                        {% endif %}
                >
                <label for="payment_{{ sPaymentID }}">
                    <b>{{ paymentmethod.oxpayments__oxdesc.value }}</b>
                    {% include "@d3unzer/generic/payment_img.html.twig" with {sImageUrl: sFullImageUrl, sBrandIdent: sBrandIdent} %}
                </label>
                {% if false == blD3HeidelpayAllowEasyCredit %}
                    <dfn id="d3HeidelayEasycreditNotice"
                         class="alert alert-danger desc">{{ translate({ ident: "D3UNZER_PAYMENT_EASYCREDIT_NOTICE", args: iD3HeidelpayEasycreditLimits }) }}</dfn>
                {% endif %}
                {% if false == blD3HeidelpayHasSameAdresses %}
                    <dfn class="alert alert-danger d3HeidelaySameAddressNotice">{{ translate({ ident: "D3UNZER_PAYMENT_NOTSAMEADDRESS_NOTICE" }) }}</dfn>
                {% endif %}
            </dt>
            <dd class="payment-option {% if oView.getCheckedPaymentId() == paymentmethod.oxpayments__oxid.value %}activePayment{% endif %}">
                {% set oPaymentPrice = paymentmethod.getPrice() %}
                {% if oPaymentPrice.getPrice() %}
                    {% if oViewConf.isFunctionalityEnabled('blShowVATForPayCharge') %}
                        ({{ format_price(oPaymentPrice.getNettoPrice(), { currency: currency }) }}
                        {% if oPaymentPrice.getVatValue() > 0 %}
                            {{ translate({ ident: "PLUS_VAT" }) }} {{ format_price(oPaymentPrice.getVatValue(), { currency: currency }) }}
                        {% endif %})
                    {% else %}
                        ({{ format_price(oPaymentPrice.getBruttoPrice(), { currency: currency }) }})
                    {% endif %}
                {% endif %}
                {% if blD3HeidelpayAllowEasyCredit and blD3HeidelpayHasSameAdresses %}
                    <div class="row">
                        <div class="col-xs-12 col-lg-9 offset-lg-3">
                            {% if blD3HeidelpayEasycreditNotChecked %}
                                <div class="alert alert-danger desc">
                                    {{ translate({ ident: "D3UNZER_PAYMENT_EASYCREDIT_CHECKBOX_NOT_CHECKED" }) }}
                                </div>
                            {% endif %}
                            <div class="alert alert-info desc">
                                <input type="hidden" name="d3heidelpayEasycreditTransactionLogid[{{ sPaymentID }}]"
                                       value="0"/>
                                <label>
                                    <input type="checkbox" name="d3heidelpayEasycreditTransactionLogid[{{ sPaymentID }}]"
                                           value="{{ responseParameter.d3transactionlogid }}"/>
                                    {{ responseParameter.configoptintext }}
                                </label>
                            </div>
                        </div>
                    </div>
                {% endif %}

                {% block checkout_payment_longdesc %}
                    {% if paymentmethod.oxpayments__oxlongdesc.value %}
                        <div class="row">
                            <div class="col-xs-12 col-lg-9 offset-lg-3">
                                <div class="alert alert-info desc">
                                    {{ paymentmethod.oxpayments__oxlongdesc.getRawValue() }}
                                </div>
                            </div>
                        </div>
                    {% endif %}
                {% endblock %}
            </dd>
        </dl>
    </div>
{% endblock %}
