<?php
/**
 * Systempay V2-Payment Module version 1.7.1 for Magento 1.4-1.9. Support contact : supportvad@lyra-network.com.
 *
 * NOTICE OF LICENSE
 *
 * This source file is licensed under the Open Software License version 3.0
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @category  payment
 * @package   systempay
 * @author    Lyra Network (http://www.lyra-network.com/)
 * @copyright 2014-2017 Lyra Network and contributors
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
?>

<p><b>
    <?php echo $this->getMethod()->getTitle(); ?>

    <?php
    $info = $this->getInfo();
    $option = @unserialize($info->getAdditionalData()); // get choosen payment option if any

    if (stripos($info->getMethod(), 'systempay_multi') === 0) {
        if (!isset($option) || empty($option)) {
            // temporary patch for module versions < 1.3 that use additional_information field
            $option = $info->getAdditionalInformation(Lyra_Systempay_Helper_Payment::MULTI_OPTION);
        }
        if (is_array($option) && !empty($option)) {
            echo '<br />';
            echo $option['label'] . ' (' . $option['count'] . 'X)';
        }
    } elseif ($info->getMethod() === 'systempay_oney') {
        if (is_array($option) && !empty($option)) {
            echo '<br />';
            echo $option['label'];
        }
    }
    ?>
</b></p>

<?php
if ($info->getCcTransId()) {
    echo nl2br($this->getResultDescription());
    echo '<br />';

    echo Mage::helper('systempay')->__('Transaction ID') . ' : ' . $info->getCcTransId();
    echo '<br />';

    if ($info->getCcType() == 'MULTI') {
        echo $this->getTransactionInfoHtml();
    } else {
        echo Mage::helper('systempay')->__('Payment Mean') . ' : ' . $info->getCcType();
        echo '<br />';

        if ($info->getCcNumberEnc()) {
            echo Mage::helper('systempay')->__('Credit Card Number') . ' : ' . $info->getCcNumberEnc();
            echo '<br />';

            $expiry = '';
            if ($info->getCcExpMonth() && $info->getCcExpYear()) {
                $expiry = str_pad($info->getCcExpMonth(), 2, '0', STR_PAD_LEFT) . ' / ' . $info->getCcExpYear();
            }

            echo Mage::helper('systempay')->__('Expiration Date') . ' : ' . $expiry;
            echo '<br />';
        }

        echo Mage::helper('systempay')->__('3-DS Authentication') . ' : ';
        if ($info->getCcSecureVerify()) {
            echo  Mage::helper('systempay')->__('YES');
            echo '<br />';
            echo Mage::helper('systempay')->__('3-DS Certificate') . ' : ' . $info->getCcSecureVerify();
        } else {
            echo  Mage::helper('systempay')->__('NO');
        }
    }

    $riskControl = $info->getAdditionalInformation(Lyra_Systempay_Helper_Payment::RISK_CONTROL);
    if (is_array($riskControl) && !empty($riskControl)) {
        echo '<br />';
        echo Mage::helper('systempay')->__('Fraud Control Result') . ' : ';

        $colors = array(
                'OK' => '#4F8A10',
                'WARNING' => '#9F6000',
                'ERROR' => '#D8000C'
        );

        foreach ($riskControl as $key => $value) {
            echo '<br />&nbsp;&nbsp;- ' . $this->translate($key, 'risk_control') . ' : ';
            echo '<span style="color: ' . $colors[$value].';">' . $value . '</span>';
        }
    }

    $riskAssessment = $info->getAdditionalInformation(Lyra_Systempay_Helper_Payment::RISK_ASSESSMENT);
    if (is_array($riskAssessment) && !empty($riskAssessment)) {
        echo '<br />';
        echo Mage::helper('systempay')->__('Advanced Risk Assessment Result') . ' : ';

        foreach ($riskAssessment as $value) {
            echo '<br />&nbsp;&nbsp;- ' . $this->translate($value, 'risk_assessments');
        }
    }

    echo '<br />';
}
