{**
 * 2021 Crédit Agricole
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License 3.0 (AFL-3.0).
 * It is also available through the world-wide-web at this URL: https://opensource.org/licenses/AFL-3.0
 *
 * @author    PrestaShop / PrestaShop partner
 * @copyright 2020-2021 Crédit Agricole
 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 *
 *}

<div class="panel js-worldlineop-advanced-settings-form">
  <form class="form-horizontal"
        action="#"
        name="worldlineop_advanced_settings_form"
        id="worldlineop-advanced-settings-form"
        method="post"
        enctype="multipart/form-data">
    <div class="row">
      <div class="worldlineop-advanced-settings col-xs-12">
        <div class="form-group form-group-h2">
          <h2 class="col-lg-3">{l s='Payment Settings' mod='cawlop'}</h2>
          <div class="col-lg-9"></div>
        </div>
        <!-- Transaction Type -->
        <div class="form-group js-worldlineop-transaction-type-block">
          <label class="control-label col-lg-3">
            <span class="label-tooltip"
                  data-toggle="tooltip"
                  data-html="true"
                  data-original-title="{l s='Immediate: Authorize & Capture' mod='cawlop'}<br>{l s='Authorized: Authorize only with pending Capture' mod='cawlop'}">
              {l s='Transaction type' mod='cawlop'}
            </span>
          </label>
          <div class="col-lg-9">
            <div class="radio">
              <label>
                <input type="radio"
                       name="worldlineopAdvancedSettings[paymentSettings][transactionType]"
                       id="worldlineop-type-immediate"
                       value="{$data.extra.const.TRANSACTION_TYPE_IMMEDIATE|escape:'html':'UTF-8'}"
                       {if $data.advancedSettings.paymentSettings.transactionType === $data.extra.const.TRANSACTION_TYPE_IMMEDIATE}checked="checked"{/if}>
                {l s='Immediate' mod='cawlop'}
              </label>
            </div>
            <div class="radio js-worldlineop-transaction-type-switch">
              <label>
                <input type="radio"
                       name="worldlineopAdvancedSettings[paymentSettings][transactionType]"
                       id="worldlineop-type-auth"
                       value="{$data.extra.const.TRANSACTION_TYPE_AUTH|escape:'html':'UTF-8'}"
                       {if $data.advancedSettings.paymentSettings.transactionType != $data.extra.const.TRANSACTION_TYPE_IMMEDIATE}checked="checked"{/if}>
                {l s='Authorized' mod='cawlop'}
              </label>
            </div>
          </div>
        </div>
        <!-- /Transaction Type -->
        <div class="js-worldlineop-capture-delay-block">
          <!-- Capture Delay -->
          <div class="form-group">
            <label class="control-label col-lg-3 ">
          <span>
            {l s='Delay before payment capture' mod='cawlop'}
          </span>
            </label>
            <div class="col-lg-9">
              <select name="worldlineopAdvancedSettings[paymentSettings][captureDelay]" class="fixed-width-md">
                {for $day=$data.extra.const.CAPTURE_DELAY_MIN to $data.extra.const.CAPTURE_DELAY_MAX}
                  <option value="{$day|intval}"
                          {if $data.advancedSettings.paymentSettings.captureDelay == $day}selected{/if}>
                    {if $day === 0}
                      {l s='Manual capture' mod='cawlop'}
                    {elseif $day === 1}
                      {$day|intval} {l s='day' mod='cawlop'}
                    {else}
                      {$day|intval} {l s='days' mod='cawlop'}
                    {/if}
                  </option>
                {/for}
              </select>
            </div>
            <div class="col-lg-9 col-lg-offset-3">
              <div class="help-block">
                {l s='Number of days before triggering automatic payment capture' mod='cawlop'}
                <span></span>
              </div>
            </div>
          </div>
          <!-- /Capture Delay -->
          <!-- Capture cronjob -->
          <div class="form-group">
            <label class="control-label col-lg-3">
              <span>
                {l s='Capture cronjob' mod='cawlop'}
              </span>
            </label>
            <div class="col-lg-9">
              <p class="form-control-static">{l s='Cron command example to run capture process 4 times a day:' mod='cawlop'}</p>
              <p><code>{$data.extra.path.controllers.captureCron|escape:'htmlall':'UTF-8'}</code></p>
            </div>
          </div>
          <!-- /Capture cronjob -->
        </div>
        <!-- Logs -->
        <div class="form-group">
          <label class="control-label col-lg-3 ">
            {l s='Enable advanced logging' mod='cawlop'}
          </label>
          <div class="col-lg-9">
            <span class="switch prestashop-switch fixed-width-sm">
              <input type="radio"
                     value="1"
                     name="worldlineopAdvancedSettings[logsEnabled]"
                     id="worldlineopAdvancedSettings_logsEnabled_on"
                     {if $data.advancedSettings.logsEnabled === true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_logsEnabled_on">{l s='Yes' mod='cawlop'}</label>
              <input type="radio"
                     value="0"
                     name="worldlineopAdvancedSettings[logsEnabled]"
                     id="worldlineopAdvancedSettings_logsEnabled_off"
                     {if $data.advancedSettings.logsEnabled != true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_logsEnabled_off">{l s='No' mod='cawlop'}</label>
              <a class="slide-button btn"></a>
            </span>
          </div>
          <div class="col-lg-9 col-lg-offset-3">
            <div class="help-block">
              {l s='The minimum log level will be set to Debug.' mod='cawlop'}
              {l s='Older files can be accessed on your server, in the "logs" directory of this module.' mod='cawlop'}
              <br/>
              <a href="{$link->getAdminLink('AdminCawlopLogs', true, [], ['action' => 'downloadLogFile'])|escape:'html':'UTF-8'}">
                {l s='Click here to download the latest file' mod='cawlop'}
              </a>
              <span></span>
            </div>
          </div>
        </div>
        <!-- /Logs -->

        <!-- Payment Flow Modifications -->
        <div class="form-group form-group-h2 js-worldlineop-payment-flow-modifications-block">
          <h2 class="col-lg-3">{l s='Payment Flow Modifications' mod='cawlop'}</h2>
          <div class="col-lg-9 js-worldlineop-payment-flow-modifications-switch">
            <span class="switch prestashop-switch fixed-width-sm">
              <input type="radio"
                     value="1"
                     name="worldlineopAdvancedSettings[paymentFlowSettingsDisplayed]"
                     id="worldlineopAdvancedSettings_paymentFlowSettingsDisplayed_on"
                     {if $data.advancedSettings.paymentFlowSettingsDisplayed === true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_paymentFlowSettingsDisplayed_on">{l s='Yes' mod='cawlop'}</label>
              <input type="radio"
                     value="0"
                     name="worldlineopAdvancedSettings[paymentFlowSettingsDisplayed]"
                     id="worldlineopAdvancedSettings_paymentFlowSettingsDisplayed_off"
                     {if $data.advancedSettings.paymentFlowSettingsDisplayed != true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_paymentFlowSettingsDisplayed_off">{l s='No' mod='cawlop'}</label>
              <a class="slide-button btn"></a>
            </span>
          </div>
        </div>
        <!-- /Payment Flow Modifications -->

        <div class="js-worldlineop-payment-flow-modifications-settings-block">
          <div class="alert alert-info">
            {l s='We recommend you to use the default settings unless absolutely necessary' mod='cawlop'}
          </div>
          <!-- Payment accepted status mapping -->
          <div class="form-group">
            <label class="control-label col-lg-3" for="worldlineopAdvancedSettings[paymentSettings][successOrderStateId]">
            <span>
              {l s='Payment accepted status mapping' mod='cawlop'}
            </span>
            </label>
            <div class="col-lg-9">
              <select name="worldlineopAdvancedSettings[paymentSettings][successOrderStateId]" class="fixed-width-xxl">
                {foreach $data.extra.statuses as $status}
                  <option value="{$status.id_order_state|intval}"
                          {if $status.id_order_state == $data.advancedSettings.paymentSettings.successOrderStateId}selected{/if}>
                    {$status.name|escape:'html':'UTF-8'}
                    {if $status.id_order_state == $data.extra.defaultStatuses.PS_OS_PAYMENT}{l s='(default)' mod='cawlop'}{/if}
                  </option>
                {/foreach}
              </select>
            </div>
          </div>
          <!-- /Payment accepted status mapping -->
          <!-- Payment error status mapping -->
          <div class="form-group">
            <label class="control-label col-lg-3" for="worldlineopAdvancedSettings[paymentSettings][successOrderStateId]">
            <span>
              {l s='Payment error status mapping' mod='cawlop'}
            </span>
            </label>
            <div class="col-lg-9">
              <select name="worldlineopAdvancedSettings[paymentSettings][errorOrderStateId]" class="fixed-width-xxl">
                {foreach $data.extra.statuses as $status}
                  <option value="{$status.id_order_state|intval}"
                          {if $status.id_order_state == $data.advancedSettings.paymentSettings.errorOrderStateId}selected{/if}>
                    {$status.name|escape:'html':'UTF-8'}
                    {if $status.id_order_state == $data.extra.defaultStatuses.PS_OS_ERROR}{l s='(default)' mod='cawlop'}{/if}
                  </option>
                {/foreach}
              </select>
            </div>
          </div>
          <!-- /Payment error status mapping -->
          <!-- Payment pending status mapping -->
          <div class="form-group">
            <label class="control-label col-lg-3" for="worldlineopAdvancedSettings[paymentSettings][successOrderStateId]">
            <span>
              {l s='Pending payment status mapping' mod='cawlop'}
            </span>
            </label>
            <div class="col-lg-9">
              <select name="worldlineopAdvancedSettings[paymentSettings][pendingOrderStateId]" class="fixed-width-xxl">
                {foreach $data.extra.statuses as $status}
                  <option value="{$status.id_order_state|intval}"
                          {if $status.id_order_state == $data.advancedSettings.paymentSettings.pendingOrderStateId}selected{/if}>
                    {$status.name|escape:'html':'UTF-8'}
                    {if $status.id_order_state == $data.extra.defaultStatuses.WOP_PENDING_ORDER_STATUS_ID}{l s='(default)' mod='cawlop'}{/if}
                  </option>
                {/foreach}
              </select>
            </div>
          </div>
          <!-- /Payment pending status mapping -->
          <!-- Safety Delay -->
          <div class="form-group">
            <label class="control-label col-lg-3" for="worldlineopAdvancedSettings[paymentSettings][safetyDelay]">
          <span>
            {l s='Order validation safety delay' mod='cawlop'}
          </span>
            </label>
            <div class="col-lg-9">
              <select name="worldlineopAdvancedSettings[paymentSettings][safetyDelay]" class="fixed-width-md">
                {for $seconds=$data.extra.const.SAFETY_DELAY_MIN to $data.extra.const.SAFETY_DELAY_MAX}
                  <option value="{$seconds|intval}"
                          {if $data.advancedSettings.paymentSettings.safetyDelay == $seconds}selected{/if}>
                    {$seconds|intval} {l s='seconds' mod='cawlop'}
                  </option>
                {/for}
              </select>
            </div>
            <div class="col-lg-9 col-lg-offset-3">
              <div class="help-block">
                {l s='If you use the split order feature, activate this option to gracefully handle the duplication of the order by retaining any incoming webhook for the determined period' mod='cawlop'}
              </div>
            </div>
          </div>
          <!-- /Safety Delay -->
          <!-- Retention Delay -->
          <div class="form-group">
            <label class="control-label col-lg-3" for="worldlineopAdvancedSettings[paymentSettings][retentionHours]">
            <span>
              {l s='Release inventory from Pending payment orders after' mod='cawlop'}
            </span>
            </label>
            <div class="col-lg-9">
              <select name="worldlineopAdvancedSettings[paymentSettings][retentionHours]" class="fixed-width-md">
                {for $hours=$data.extra.const.RETENTION_DELAY_MIN to $data.extra.const.RETENTION_DELAY_MAX}
                  {if $hours % 3 === 0}
                    <option value="{$hours|intval}"
                            {if $data.advancedSettings.paymentSettings.retentionHours == $hours}selected{/if}>
                      {$hours|intval} {l s='hours' mod='cawlop'}
                    </option>
                  {/if}
                {/for}
              </select>
            </div>
          </div>
          <!-- /Retention Delay -->
          <!-- Pending cronjob -->
          <div class="form-group">
            <label class="control-label col-lg-3">
            <span>
              {l s='Pending cronjob' mod='cawlop'}
            </span>
            </label>
            <div class="col-lg-9">
              <p class="form-control-static">{l s='Cron command example to run process every hour:' mod='cawlop'}</p>
              <p><code>{$data.extra.path.controllers.pendingCron|escape:'htmlall':'UTF-8'}</code></p>
            </div>
          </div>
          <!-- /Pending cronjob -->
          <!-- Switch Endpoint -->
          <div class="form-group form-group-h2 js-worldlineop-switch-endpoint-block">
            <label class="control-label col-lg-3 ">{l s='Switch endpoint' mod='cawlop'}</label>
            <div class="col-lg-9 js-worldlineop-switch-endpoint-switch">
            <span class="switch prestashop-switch fixed-width-sm">
              <input type="radio"
                     value="1"
                     name="worldlineopAdvancedSettings[switchEndpoint]"
                     id="worldlineopAdvancedSettings_switchEndpoint_on"
                     {if $data.advancedSettings.switchEndpoint === true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_switchEndpoint_on">{l s='Yes' mod='cawlop'}</label>
              <input type="radio"
                     value="0"
                     name="worldlineopAdvancedSettings[switchEndpoint]"
                     id="worldlineopAdvancedSettings_switchEndpoint_off"
                     {if $data.advancedSettings.switchEndpoint != true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_switchEndpoint_off">{l s='No' mod='cawlop'}</label>
              <a class="slide-button btn"></a>
            </span>
            </div>
          </div>
          <!-- /Switch Endpoint -->

          <div class="js-worldlineop-switch-endpoint-settings-block">
            <!-- Test Endpoint -->
            <div class="form-group">
              <label class="control-label col-lg-3">
                <span>{l s='Test Endpoint' mod='cawlop'}</span>
              </label>
              <div class="col-lg-9">
                <div class="fixed-width-xxl">
                  <input value="{$data.advancedSettings.testEndpoint|escape:'htmlall':'UTF-8'}"
                         type="text"
                         name="worldlineopAdvancedSettings[testEndpoint]"
                         class="input fixed-width-xxl">
                </div>
              </div>
            </div>
            <!-- /Test Endpoint -->
            <!-- Prod Endpoint -->
            <div class="form-group">
              <label class="control-label col-lg-3">
                <span>{l s='Prod Endpoint' mod='cawlop'}</span>
              </label>
              <div class="col-lg-9">
                <div class="fixed-width-xxl">
                  <input value="{$data.advancedSettings.prodEndpoint|escape:'htmlall':'UTF-8'}"
                         type="text"
                         name="worldlineopAdvancedSettings[prodEndpoint]"
                         class="input fixed-width-xxl">
                </div>
              </div>
            </div>
            <!-- /Prod Endpoint -->
          </div>
        </div>
        <div class="form-group form-group-h2">
          <h2 class="col-lg-3">{l s='Checkout Flow Modifications' mod='cawlop'}</h2>
          <div class="col-lg-9"></div>
        </div>
        <!-- Group cards -->
        <div class="form-group">
          <label class="control-label col-lg-3 ">
            {l s='Group payment options by card' mod='cawlop'}
          </label>
          <div class="col-lg-9">
            <span class="switch prestashop-switch fixed-width-sm">
              <input type="radio"
                     value="1"
                     name="worldlineopAdvancedSettings[groupCardPaymentOptions]"
                     id="worldlineopAdvancedSettings_groupCardPaymentOptions_on"
                     {if $data.advancedSettings.groupCardPaymentOptions === true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_groupCardPaymentOptions_on">{l s='Yes' mod='cawlop'}</label>
              <input type="radio"
                     value="0"
                     name="worldlineopAdvancedSettings[groupCardPaymentOptions]"
                     id="worldlineopAdvancedSettings_groupCardPaymentOptions_off"
                     {if $data.advancedSettings.groupCardPaymentOptions != true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_groupCardPaymentOptions_off">{l s='No' mod='cawlop'}</label>
              <a class="slide-button btn"></a>
            </span>
          </div>
          <div class="col-lg-9 col-lg-offset-3">
            <div class="help-block">
              {l s='Only for the generic payment option. If you choose to group payment options by card, the customer will have one unique choice for cards instead of x choices.' mod='cawlop'}
              <span></span>
            </div>
          </div>
        </div>
        <!-- Omit item details -->
        <div class="form-group">
          <label class="control-label col-lg-3 ">
            <span class="label-tooltip"
                  data-toggle="tooltip"
                  data-html="true"
                  data-original-title="{l s='When enabled, customers\' order item details—such as product names, prices, and quantities—are omitted from payment requests. This may be useful to enhance order privacy or address compatibility issues with third-party plugins affecting order details. However, be aware that excluding item details may hinder certain risk assessments done by financial institutions, and payment methods that require them (e.g., Klarna) may not be presented to your customers.' mod='cawlop'}">
            {l s='Omit order item details' mod='cawlop'}
          </label>
          <div class="col-lg-9">
            <span class="switch prestashop-switch fixed-width-sm">
              <input type="radio"
                     value="1"
                     name="worldlineopAdvancedSettings[omitOrderItemDetails]"
                     id="worldlineopAdvancedSettings_omitOrderItemDetails_on"
                     {if $data.advancedSettings.omitOrderItemDetails === true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_omitOrderItemDetails_on">{l s='Yes' mod='cawlop'}</label>
              <input type="radio"
                     value="0"
                     name="worldlineopAdvancedSettings[omitOrderItemDetails]"
                     id="worldlineopAdvancedSettings_omitOrderItemDetails_off"
                     {if $data.advancedSettings.omitOrderItemDetails != true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_omitOrderItemDetails_off">{l s='No' mod='cawlop'}</label>
              <a class="slide-button btn"></a>
            </span>
          </div>
          <div class="col-lg-9 col-lg-offset-3">
            <div class="help-block">
              {l s='When enabled, order item details will not be included in payment requests. Only the total order amount will be transmitted.' mod='cawlop'}
              <span></span>
            </div>
          </div>
        </div>
        <!-- Display payment confirmation page -->
        <div class="form-group">
          <label class="control-label col-lg-3 ">
            <span class="label-tooltip"
                  data-toggle="tooltip"
                  data-html="true"
                  data-original-title="{l s='If enabled, customers will see a dedicated confirmation screen after payment is processed, confirming the payment and providing key details.' mod='cawlop'}">
            {l s='Display payment confirmation page' mod='cawlop'}
          </label>
          <div class="col-lg-9">
            <span class="switch prestashop-switch fixed-width-sm">
              <input type="radio"
                     value="1"
                     name="worldlineopAdvancedSettings[displayPaymentConfirmationPage]"
                     id="worldlineopAdvancedSettings_displayPaymentConfirmationPage_on"
                     {if $data.advancedSettings.displayPaymentConfirmationPage === true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_displayPaymentConfirmationPage_on">{l s='Yes' mod='cawlop'}</label>
              <input type="radio"
                     value="0"
                     name="worldlineopAdvancedSettings[displayPaymentConfirmationPage]"
                     id="worldlineopAdvancedSettings_displayPaymentConfirmationPage_off"
                     {if $data.advancedSettings.displayPaymentConfirmationPage != true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_displayPaymentConfirmationPage_off">{l s='No' mod='cawlop'}</label>
              <a class="slide-button btn"></a>
            </span>
          </div>
          <div class="col-lg-9 col-lg-offset-3">
            <div class="help-block">
              {l s='By enabling this option, your customers will see the CAWL payment confirmation page' mod='cawlop'}
              <span></span>
            </div>
          </div>
        </div>
        <!-- /Display payment confirmation page -->
        <!-- /Group cards -->
        <div class="form-group form-group-h2">
          <div class="col-lg-3"></div>
          <h4 class="col-lg-9">{l s='UE specific settings' mod='cawlop'}</h4>
        </div>
        <!-- Force 3DsV2 -->
        <div class="form-group js-worldlineop-switch-force-3ds-block">
          <label class="control-label col-lg-3 ">
            {l s='Force 3DsV2' mod='cawlop'}
          </label>
          <div class="col-lg-9 js-worldlineop-switch-force-3ds-switch">
              <span class="switch prestashop-switch fixed-width-sm">
                <input type="radio"
                       value="1"
                       name="worldlineopAdvancedSettings[force3DsV2]"
                       id="worldlineopAdvancedSettings_force3DsV2_on"
                       {if $data.advancedSettings.force3DsV2 === true}checked="checked"{/if}>
                <label for="worldlineopAdvancedSettings_force3DsV2_on">{l s='Yes' mod='cawlop'}</label>
                <input type="radio"
                       value="0"
                       name="worldlineopAdvancedSettings[force3DsV2]"
                       id="worldlineopAdvancedSettings_force3DsV2_off"
                       {if $data.advancedSettings.force3DsV2 != true}checked="checked"{/if}>
                <label for="worldlineopAdvancedSettings_force3DsV2_off">{l s='No' mod='cawlop'}</label>
                <a class="slide-button btn"></a>
              </span>
          </div>
          <div class="col-lg-9 col-lg-offset-3">
            <div class="help-block">
              {l s='It is mandatory to enforce 3DsV2 in Europe, but can be turned off for other geographies' mod='cawlop'}
            </div>
          </div>
        </div>
        <!-- /Force 3DsV2 -->
        <div class="js-worldlineop-force-3ds-disabled-block">
          <!-- Enforce 3DS -->
          <div class="form-group js-worldlineop-enforce-challenge-block">
            <label class="control-label col-lg-3 ">
              {l s='Request challenge on all cards transactions' mod='cawlop'}
            </label>
            <div class="col-lg-9 js-worldlineop-enforce-challenge-switch">
              <span class="switch prestashop-switch fixed-width-sm">
                <input type="radio"
                       value="1"
                       name="worldlineopAdvancedSettings[enforce3DS]"
                       id="worldlineopAdvancedSettings_enforce3DS_on"
                       {if $data.advancedSettings.enforce3DS === true}checked="checked"{/if}>
                <label for="worldlineopAdvancedSettings_enforce3DS_on">{l s='Yes' mod='cawlop'}</label>
                <input type="radio"
                       value="0"
                       name="worldlineopAdvancedSettings[enforce3DS]"
                       id="worldlineopAdvancedSettings_enforce3DS_off"
                       {if $data.advancedSettings.enforce3DS != true}checked="checked"{/if}>
                <label for="worldlineopAdvancedSettings_enforce3DS_off">{l s='No' mod='cawlop'}</label>
                <a class="slide-button btn"></a>
              </span>
            </div>
            <div class="col-lg-9 col-lg-offset-3">
              <div class="help-block">
              </div>
            </div>
          </div>
          <!-- /Mandatory 3DS -->
          <!-- 3DS Exemption -->
          <div class="form-group js-worldlineop-3ds-exemption-block">
            <label class="control-label col-lg-3 ">
              <span class="label-tooltip"
                    data-toggle="tooltip"
                    data-html="true"
                    data-original-title="{l s='By enabling the 3DS Exemption, you allow the card issuer and your acquirer to evaluate the risk level of transactions up to the Exemption Limit you specify in EUR. If the criteria are met, your customers will be exempt from Strong Customer Authentication (SCA).' mod='cawlop'}<br>{l s='If your acquirer rejects the exemption and requires SCA, this is referred to as a soft decline. In such cases, we will attempt to prompt the customer for SCA and reinitiate the transaction if the customer successfully authenticates.' mod='cawlop'}">
                {l s='Exempt transactions from 3DS' mod='cawlop'}
              </span>
            </label>
            <div class="col-lg-9">
              <span class="switch prestashop-switch fixed-width-sm">
                <input type="radio"
                       value="1"
                       name="worldlineopAdvancedSettings[threeDSExempted]"
                       id="worldlineopAdvancedSettings_threeDSExempted_on"
                       {if $data.advancedSettings.threeDSExempted === true}checked="checked"{/if}>
                <label for="worldlineopAdvancedSettings_threeDSExempted_on">{l s='Yes' mod='cawlop'}</label>
                <input type="radio"
                       value="0"
                       name="worldlineopAdvancedSettings[threeDSExempted]"
                       id="worldlineopAdvancedSettings_threeDSExempted_off"
                       {if $data.advancedSettings.threeDSExempted != true}checked="checked"{/if}>
                <label for="worldlineopAdvancedSettings_threeDSExempted_off">{l s='No' mod='cawlop'}</label>
                <a class="slide-button btn"></a>
              </span>
            </div>
            <div class="col-lg-9 col-lg-offset-3 wl-margin-bottom-15">
              <div class="help-block">
                {l s='When enabled, an exemption from 3DS will be requested for transactions with an order amount below the configured limit.' mod='cawlop'}
                <span></span>
              </div>
            </div>
            <div class="exemption-type js-worldlineop-3ds-exemption-params">
              <div class="alert alert-warning">
                <p class="text-info">
                  {l s='Please be aware that if fraud occurs on a transaction that has been granted an exemption, the liability falls on the merchant!' mod='cawlop'}
                </p>
              </div>
                <div class="alert alert-warning wl-hidden-element js-worldlineop-tra-warning">
                    <p class="text-info">
                        {l s='Please ensure that Transaction Risk Analysis (TRA) is enabled with your acquirer before enabling this option. If not, all card transactions may be blocked.' mod='cawlop'}
                    </p>
                </div>
                {assign var=exType value=$data.advancedSettings.threeDSExemptedType|default:'no-challenge-request'}
              <label class="control-label col-lg-3 "
                     for="wlToggleButton">
                <span class="label-tooltip"
                      data-toggle="tooltip"
                      data-html="true"
                      data-original-title="{l s='The No-Challenge Preference requests the card issuer not to apply Strong Customer Authentication (SCA). The issuer will approve or deny this request, and the transaction will proceed accordingly.' mod='cawlop'}
<br>{l s='The Low-Value exemption applies to transactions below the defined threshold (30 EUR), allowing these low-value payments to bypass SCA and speed up checkout.' mod='cawlop'}
<br>{l s='The Transaction Risk Analysis (TRA) exemption enables a dynamic risk assessment; the issuer and your acquirer will evaluate risk factors, allowing transactions up to 100 EUR to qualify for exemption if deemed low risk.' mod='cawlop'}
<br>{l s='Note that TRA typically requires a formal agreement with your acquirer; enable TRA only after such an agreement is in place. Otherwise, all card transactions may be blocked.' mod='cawlop'}
<br>{l s='Choose carefully to balance customer experience and security.' mod='cawlop'}">
                  {l s='Exemption type' mod='cawlop'}
                  </span>
              </label>
              <div class="col-lg-9">
                <button type="button"
                        class="btn btn-default wl-dropdown-toggle"
                        tabindex="-1"
                        name="wlToggleButton"
                        data-toggle="dropdown">
                                    <span class="js-worldlineop-select-3ds-exemption-type-button-text"
                                          value="{$exType|escape:'htmlall':'UTF-8'}">
                                        {if $exType == 'no-challenge-request'}
                                            {l s='Preference: No challenge request' mod='cawlop'}
                                        {elseif $exType == 'low-value'}
                                            {l s='Exemption: low-value' mod='cawlop'}
                                        {elseif $exType == 'transaction-risk-analysis'}
                                            {l s='Exemption: Transaction risk analysis (acquirer)' mod='cawlop'}
                                        {else}
                                            {$exType|escape:'htmlall':'UTF-8'}
                                        {/if}
                                    </span>
                  <i class="icon-caret-down"></i>
                </button>
                <input type="hidden" name="worldlineopAdvancedSettings[threeDSExemptedType]"
                       value="{$exType|escape:'htmlall':'UTF-8'}"
                       id="wl-selectedExemptedType">
                <ul class="dropdown-menu exemption-types-list js-worldlineop-select-3ds-exemption-type-list">
                    <li value="no-challenge-request">
                        {l s='Preference: No challenge request' mod='cawlop'}
                    </li>
                  <li value="low-value">
                    {l s='Exemption: low-value' mod='cawlop'}
                  </li>
                  <li value="transaction-risk-analysis">
                    {l s='Exemption: Transaction risk analysis (acquirer)' mod='cawlop'}
                  </li>
                </ul>
              </div>
              <div class="col-lg-9 col-lg-offset-3">
                <div class="help-block">
                  {l s='Please select the exemption type.' mod='cawlop'}
                  <span></span>
                </div>
              </div>
              <input type="hidden" id="databaseStoredExemptedValue" value="{$data.advancedSettings.threeDSExemptedValue|default:0|escape:'htmlall':'UTF-8'}"/>
              <input type="hidden" id="databaseStoredExemptedType" value="{$data.advancedSettings.threeDSExemptedType|escape:'htmlall':'UTF-8'}"/>
              <label class="control-label col-lg-3 "
                     for="worldlineopAdvancedSettings[threeDSExemptedValue]">
                <span class="label-tooltip"
                      data-toggle="tooltip"
                      data-html="true"
                      data-original-title="{l s='The exemption limit is specified in EUR. Therefore, if the checkout currency is not in EUR, the conversion will depend on the exchange rate to EUR. It is essential to have EUR configured in your environment, and to ensure accurate conversions, please keep your exchange rates updated.' mod='cawlop'}
                        <br>{l s='If EUR is not configured, the 3DS exemption will not be applied, and the transaction will not have the exemption requested.' mod='cawlop'}
                        <br><br>{l s='Additional Note: PSD2 designates the EUR as the base currency for determining exemption limits for other currencies in the EEA. However, each region can decide to adapt these limits, and regions outside the EEA may also support exemption requests. Due to these complexities, we cannot guarantee that the exemption request will be considered by the issuer or your acquirer.' mod='cawlop'}">
                  {l s='Exemption limit' mod='cawlop'}
                </span>
              </label>
              <div class="col-lg-9">
                <input value="{$data.advancedSettings.threeDSExemptedValue|default:0|escape:'htmlall':'UTF-8'}"
                       class="wl-exempt-type-input js-worldlineop-select-3ds-exemption-limit-input"
                       type="number" name="worldlineopAdvancedSettings[threeDSExemptedValue]"
                       min="0"
                       required
                />
              </div>
              <div class="col-lg-9 col-lg-offset-3">
                <div id="js-worldlineop-select-3ds-exemption-limit-30" class="help-block">
                  {l s='Please enter the amount limit (0 to 30 EUR).' mod='cawlop'}
                  <span></span>
                </div>
                <div id="js-worldlineop-select-3ds-exemption-limit-100" class="help-block wl-hidden-element">
                  {l s='Please enter the amount limit (0 to 100 EUR).' mod='cawlop'}
                  <span></span>
                </div>
                <div id="js-worldlineop-select-3ds-exemption-limit-invalid-amount" class="help-block wl-hidden-element">
                </div>
              </div>
            </div>
          </div>
          <!-- /3DS Exemption -->
        </div>
        <div class="form-group form-group-h2">
          <div class="col-lg-3"></div>
          <h4 class="col-lg-9">{l s='Non-UE specific settings' mod='cawlop'}</h4>
        </div>
        <!-- Surcharging -->
        <div class="form-group">
          <label class="control-label col-lg-3 ">
            {l s='Enable surcharging' mod='cawlop'}
          </label>
          <div class="col-lg-9">
            <span class="switch prestashop-switch fixed-width-sm">
              <input type="radio"
                     value="1"
                     name="worldlineopAdvancedSettings[surchargingEnabled]"
                     id="worldlineopAdvancedSettings_surchargingEnabled_on"
                     {if $data.advancedSettings.surchargingEnabled === true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_surchargingEnabled_on">{l s='Yes' mod='cawlop'}</label>
              <input type="radio"
                     value="0"
                     name="worldlineopAdvancedSettings[surchargingEnabled]"
                     id="worldlineopAdvancedSettings_surchargingEnabled_off"
                     {if $data.advancedSettings.surchargingEnabled != true}checked="checked"{/if}>
              <label for="worldlineopAdvancedSettings_surchargingEnabled_off">{l s='No' mod='cawlop'}</label>
              <a class="slide-button btn"></a>
            </span>
          </div>
          <div class="col-lg-9 col-lg-offset-3">
            <div class="help-block">
              {l s='When surcharging is enabled, extra fees related to credit card organizations will be supported by your customers' mod='cawlop'}
              <span></span>
            </div>
          </div>
        </div>
        <!-- /Group cards -->

        <input type="hidden" name="action" value="saveAdvancedSettingsForm"/>
      </div>
    </div>
    <div class="panel-footer">
      <button type="submit" class="btn btn-default pull-right js-worldlineop-submit-advanced-settings-form" name="submitSaveAdvancedSettingsForm">
        <i class="process-icon-save"></i> {l s='Save' mod='cawlop'}
      </button>
    </div>
  </form>
</div>
