<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Threepartment\Debitpayment\Block\Info;

/**
 * Block for Bank Transfer payment generic info
 *
 * @api
 * @since 100.0.2
 */
class Debitpayment extends \Magento\Payment\Block\Info
{
    /**
     * @var string
     */
    protected $_template = 'Threepartment_Debitpayment::info/debitpayment.phtml';

    /**
     * @return string
     */
    public function toPdf()
    {
        $this->setTemplate('Threepartment_Debitpayment::info/pdf/debitpayment.phtml');
        return $this->toHtml();
    }
    public function getDetails(){
        $info = $this->getInfo()->getAdditionalInformation();
        if(is_array($info)){
            if(isset($info['method']) && $info['method']=='debitpayment'){
                return array(
                    'bank_account_owner'=>$info['additional_data']['bank_account_owner'],
                    'iban'=>$info['additional_data']['iban'],
                    'bic'=>$info['additional_data']['bic'],
                    'bank_company'=>$info['additional_data']['bank_company']
                );
            }
        }
        return;

    }
}

