<?php
/**
 *                       ######
 *                       ######
 * ############    ####( ######  #####. ######  ############   ############
 * #############  #####( ######  #####. ######  #############  #############
 *        ######  #####( ######  #####. ######  #####  ######  #####  ######
 * ###### ######  #####( ######  #####. ######  #####  #####   #####  ######
 * ###### ######  #####( ######  #####. ######  #####          #####  ######
 * #############  #############  #############  #############  #####  ######
 *  ############   ############  #############   ############  #####  ######
 *                                      ######
 *                               #############
 *                               ############
 *
 * Adyen Payment module (https://www.adyen.com/)
 *
 * Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
 * See LICENSE.txt for license details.
 *
 * Author: Adyen <magento@adyen.com>
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * @see \Magento\Payment\Block\Info
 */
?>
<div>
    <?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?>
</div>
<?php
$_info = $this->getInfo();
$_isDemoMode = $block->isDemoMode();
?>
<?php if ($_pspReference = $_info->getAdditionalInformation('pspReference')):?>
    <div>
        <?php if($_isDemoMode): ?>
            <?php echo __('Adyen PSP Reference: <a href="https://ca-test.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%1&txType=Payment" target="__blank">%1</a>', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?>
        <?php else: ?>
            <?php echo __('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%1&txType=Payment" target="__blank">%1</a>', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?>
        <?php endif; ?>
    </div>
<?php endif;?>

<?php if($block->getCcTypeName() != ""):?>
    <div>
        <?php echo __('Credit Card Type: %1', $block->getCcTypeName()) ?><br/>
    </div>
<?php endif; ?>
<?php if($_info->getCcLast4() != ""):?>
    <?php echo __('Credit Card Number: xxxx-%1', $this->getInfo()->getCcLast4()) ?><br/>
<?php endif;?>

<?php if($_info->getAdditionalInformation('number_of_installments') != ""): ?>
    <?php echo __('Number of installments: %1', $_info->getAdditionalInformation('number_of_installments')) ?><br/>
<?php endif; ?>


<?php if($_info->getAdditionalInformation('adyen_avs_result') != ""): ?>
    <?php echo __('Avs result: %1', $_info->getAdditionalInformation('adyen_avs_result')) ?><br/>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('adyen_cvc_result') != ""): ?>
    <?php echo __('Cvc result: %1', $_info->getAdditionalInformation('adyen_cvc_result')) ?><br/>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('adyen_total_fraud_score') != ""): ?>
    <?php echo __('Total fraud score: %1', $_info->getAdditionalInformation('adyen_total_fraud_score')) ?><br/>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('adyen_refusal_reason_raw') != ""): ?>
    <?php echo __('Raw acquirer response: %1', $_info->getAdditionalInformation('adyen_refusal_reason_raw')) ?><br/>
<?php endif; ?>

<?php if($_info->getAdditionalInformation('adyen_auth_code') != ""): ?>
    <?php echo __('Authorisation code: %1', $_info->getAdditionalInformation('adyen_auth_code')) ?><br/>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('adyen_acquirer_reference') != ""): ?>
    <?php echo __('Acquirer reference: %1', $_info->getAdditionalInformation('adyen_acquirer_reference')) ?><br/>
<?php endif; ?>

<?php if ($_specificInfo = $block->getSpecificInformation()):?>
<table class="data-table admin__table-secondary">
<?php foreach ($_specificInfo as $_label => $_value):?>
    <tr>
        <th><?php echo $block->escapeHtml($_label)?>:</th>
        <td><?php echo nl2br(implode("\n", $block->getValueAsArray($_value, true)))?></td>
    </tr>
<?php endforeach; ?>
</table>
<?php endif;?>

<?php echo $block->getChildHtml()?>
