We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit 863c0bb4 authored by Rik ter Beek's avatar Rik ter Beek

#59 add payment method Boleto

parent cddb1830
<?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>
*/
namespace Adyen\Payment\Block\Checkout;
/**
* Billing agreement information on Order success page
*/
class Success extends \Magento\Framework\View\Element\Template
{
/**
* @var \Magento\Sales\Model\Order $order
*/
protected $_order;
/**
* @var \Magento\Checkout\Model\Session
*/
protected $_checkoutSession;
/**
* @var \Magento\Checkout\Model\OrderFactory
*/
protected $_orderFactory;
/**
* Success constructor.
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Magento\Sales\Model\OrderFactory $orderFactory
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Checkout\Model\Session $checkoutSession,
\Magento\Sales\Model\OrderFactory $orderFactory,
array $data = []
) {
$this->_checkoutSession = $checkoutSession;
$this->_orderFactory = $orderFactory;
parent::__construct($context, $data);
}
/**
* Return Boleto PDF url
*
* @return string
*/
protected function _toHtml()
{
if ($this->isBoletoPayment()) {
$this->addData(
[
'boleto_pdf_url' => $this->getBoletoPdfUrl()
]
);
return parent::_toHtml();
}
return '';
}
/**
* Detect if Boleto is used as payment method
* @return bool
*/
public function isBoletoPayment()
{
if ($this->getOrder()->getPayment() &&
$this->getOrder()->getPayment()->getMethod() == \Adyen\Payment\Model\Method\Boleto::METHOD_CODE) {
return true;
}
return false;
}
/**
* @return null|\string[]
*/
public function getBoletoPdfUrl()
{
if ($this->isBoletoPayment()) {
return $this->getOrder()->getPayment()->getAdditionalInformation('url');
}
return null;
}
/**
* @return \Magento\Sales\Model\Order
*/
public function getOrder()
{
if ($this->_order == null) {
$this->_order = $this->_orderFactory->create()->load($this->_checkoutSession->getLastOrderId());
}
return $this->_order;
}
}
\ No newline at end of file
<?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>
*/
namespace Adyen\Payment\Block\Form;
class Boleto extends \Magento\Payment\Block\Form
{
/**
* @var string
*/
protected $_template = 'Adyen_Payment::form/boleto.phtml';
}
\ No newline at end of file
<?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>
*/
namespace Adyen\Payment\Block\Info;
class Boleto extends AbstractInfo
{
/**
* @var string
*/
protected $_template = 'Adyen_Payment::info/adyen_boleto.phtml';
}
...@@ -386,6 +386,28 @@ class Data extends AbstractHelper ...@@ -386,6 +386,28 @@ class Data extends AbstractHelper
return $this->getConfigData($field, 'adyen_pay_by_mail', $storeId, true); return $this->getConfigData($field, 'adyen_pay_by_mail', $storeId, true);
} }
/**
* @desc Gives back adyen_boleto configuration values
* @param $field
* @param null $storeId
* @return mixed
*/
public function getAdyenBoletoConfigData($field, $storeId = null)
{
return $this->getConfigData($field, 'adyen_boleto', $storeId);
}
/**
* @desc Gives back adyen_boleto configuration values as flag
* @param $field
* @param null $storeId
* @return mixed
*/
public function getAdyenBoletoConfigDataFlag($field, $storeId = null)
{
return $this->getConfigData($field, 'adyen_boleto', $storeId, true);
}
/** /**
* @desc Retrieve decrypted hmac key * @desc Retrieve decrypted hmac key
* @return string * @return string
...@@ -585,4 +607,30 @@ class Data extends AbstractHelper ...@@ -585,4 +607,30 @@ class Data extends AbstractHelper
{ {
return (string) $this->_moduleList->getOne("Adyen_Payment")['setup_version']; return (string) $this->_moduleList->getOne("Adyen_Payment")['setup_version'];
} }
public function getBoletoTypes()
{
return [
[
'value' => 'boletobancario_hsbc',
'label' => __('boletobancario_hsbc'),
],
[
'value' => 'boletobancario_itau',
'label' => __('boletobancario_itau'),
],
[
'value' => 'boletobancario_santander',
'label' => __('boletobancario_santander'),
],
[
'value' => 'boletobancario_bradesco',
'label' => __('boletobancario_bradesco'),
],
[
'value' => 'boletobancario_bancodobrasil',
'label' => __('boletobancario_bancodobrasil'),
],
];
}
} }
\ No newline at end of file
<?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>
*/
namespace Adyen\Payment\Model;
use Magento\Checkout\Model\ConfigProviderInterface;
class AdyenBoletoConfigProvider implements ConfigProviderInterface
{
/**
* @var PaymentHelper
*/
protected $_paymentHelper;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @var string[]
*/
protected $_methodCodes = [
\Adyen\Payment\Model\Method\Boleto::METHOD_CODE
];
/**
* @var \Magento\Payment\Model\Method\AbstractMethod[]
*/
protected $_methods = [];
/**
* AdyenBoletoConfigProvider constructor.
*
* @param \Magento\Payment\Helper\Data $paymentHelper
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Magento\Payment\Helper\Data $paymentHelper,
\Adyen\Payment\Helper\Data $adyenHelper
) {
$this->_paymentHelper = $paymentHelper;
$this->_adyenHelper = $adyenHelper;
foreach ($this->_methodCodes as $code) {
$this->_methods[$code] = $this->_paymentHelper->getMethodInstance($code);
}
}
/**
* @return array
*/
public function getConfig()
{
$config = [];
foreach ($this->_methodCodes as $code) {
if ($this->_methods[$code]->isAvailable()) {
$config = [
'payment' => [
'adyenBoleto' => [
'boletoTypes' => $this->_adyenHelper->getBoletoTypes()
]
]
];
}
}
return $config;
}
}
\ No newline at end of file
...@@ -51,7 +51,8 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface ...@@ -51,7 +51,8 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
\Adyen\Payment\Model\Method\Hpp::METHOD_CODE, \Adyen\Payment\Model\Method\Hpp::METHOD_CODE,
\Adyen\Payment\Model\Method\Oneclick::METHOD_CODE, \Adyen\Payment\Model\Method\Oneclick::METHOD_CODE,
\Adyen\Payment\Model\Method\Pos::METHOD_CODE, \Adyen\Payment\Model\Method\Pos::METHOD_CODE,
\Adyen\Payment\Model\Method\Sepa::METHOD_CODE \Adyen\Payment\Model\Method\Sepa::METHOD_CODE,
\Adyen\Payment\Model\Method\Boleto::METHOD_CODE
]; ];
/** /**
......
...@@ -281,6 +281,12 @@ class PaymentRequest extends DataObject ...@@ -281,6 +281,12 @@ class PaymentRequest extends DataObject
$cardDetails['card'] = $requestCreditCardDetails; $cardDetails['card'] = $requestCreditCardDetails;
$request = array_merge($request, $cardDetails); $request = array_merge($request, $cardDetails);
} }
// if installments is set add it into the request
if ($payment->getAdditionalInformation('number_of_installments') &&
$payment->getAdditionalInformation('number_of_installments') > 0) {
$request['installments']['value'] = $payment->getAdditionalInformation('number_of_installments');
}
} elseif ($paymentMethodCode == \Adyen\Payment\Model\Method\Sepa::METHOD_CODE) { } elseif ($paymentMethodCode == \Adyen\Payment\Model\Method\Sepa::METHOD_CODE) {
// set brand to sepa // set brand to sepa
...@@ -294,14 +300,34 @@ class PaymentRequest extends DataObject ...@@ -294,14 +300,34 @@ class PaymentRequest extends DataObject
]; ];
$request['bankAccount'] = $bankAccount; $request['bankAccount'] = $bankAccount;
} } elseif ($paymentMethodCode == \Adyen\Payment\Model\Method\Boleto::METHOD_CODE) {
// if installments is set add it into the request
if ($payment->getAdditionalInformation('number_of_installments') &&
$payment->getAdditionalInformation('number_of_installments') > 0) {
$request['installments']['value'] = $payment->getAdditionalInformation('number_of_installments');
}
$request['socialSecurityNumber'] = $payment->getAdditionalInformation("social_security_number");
$request['selectedBrand'] = $payment->getAdditionalInformation("boleto_type");
$shopperName = [
'firstName' => $payment->getAdditionalInformation("firstname"),
'lastName' => $payment->getAdditionalInformation("lastname"),
];
$request['shopperName'] = $shopperName;
$deliveryDays = (int) $this->_adyenHelper->getAdyenBoletoConfigData("delivery_days", $storeId);
$deliveryDays = (!empty($deliveryDays)) ? $deliveryDays : 5;
$deliveryDate = date(
"Y-m-d\TH:i:s ",
mktime(date("H"),
date("i"),
date("s"),
date("m"),
date("j") + $deliveryDays,
date("Y"))
);
$request['deliveryDate'] = $deliveryDate;
}
$result = $service->authorise($request); $result = $service->authorise($request);
return $result; return $result;
} }
......
<?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>
*/
namespace Adyen\Payment\Model\Config\Source;
/**
* Class BoletoType
* @package Adyen\Payment\Model\Config\Source
*/
class BoletoType implements \Magento\Framework\Option\ArrayInterface
{
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* BoletoType constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper
) {
$this->_adyenHelper = $adyenHelper;
}
/**
* @return array
*/
public function toOptionArray()
{
return $this->_adyenHelper->getBoletoTypes();
}
}
This diff is collapsed.
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
<include path="Adyen_Payment::system/adyen_sepa.xml"/> <include path="Adyen_Payment::system/adyen_sepa.xml"/>
<include path="Adyen_Payment::system/adyen_pos.xml"/> <include path="Adyen_Payment::system/adyen_pos.xml"/>
<include path="Adyen_Payment::system/adyen_pay_by_mail.xml"/> <include path="Adyen_Payment::system/adyen_pay_by_mail.xml"/>
<include path="Adyen_Payment::system/adyen_boleto.xml"/>
</group> </group>
<group id="test" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <group id="test" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Test</label> <label>Test</label>
......
<?xml version="1.0"?>
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
-->
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="adyen_boleto" translate="label" type="text" sortOrder="450" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[Boleto integration]]></label>
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model>
<fieldset_css>adyen-method-adyen-cc</fieldset_css>
<comment>Process Boleto transactions</comment>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_boleto/active</config_path>
</field>
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Title</label>
<config_path>payment/adyen_boleto/title</config_path>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
<config_path>payment/adyen_boleto/sort_order</config_path>
</field>
<field id="cctypes" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Boleto Types</label>
<source_model>Adyen\Payment\Model\Config\Source\BoletoType</source_model>
<config_path>payment/adyen_boleto/boletotypes</config_path>
</field>
<field id="delivery_days" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Days for Delivery</label>
<tooltip>How many days to be added to the current date for delivery. Only numbers allowed.</tooltip>
<frontend_class>validate-number</frontend_class>
<config_path>payment/adyen_boleto/delivery_days</config_path>
</field>
<group id="adyen_boleto_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="210">
<label>Country Specific Settings</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Applicable Countries</label>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
<config_path>payment/adyen_boleto/allowspecific</config_path>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
<config_path>payment/adyen_boleto/specificcountry</config_path>
</field>
</group>
</group>
</include>
\ No newline at end of file
...@@ -107,6 +107,16 @@ ...@@ -107,6 +107,16 @@
<payment_action>authorize</payment_action> <payment_action>authorize</payment_action>
<group>adyen</group> <group>adyen</group>
</adyen_pay_by_mail> </adyen_pay_by_mail>
<adyen_boleto>
<active>0</active>
<model>Adyen\Payment\Model\Method\Boleto</model>
<title>Boleto</title>
<allowspecific>0</allowspecific>
<sort_order>7</sort_order>
<payment_action>authorize</payment_action>
<delivery_days>5</delivery_days>
<group>adyen</group>
</adyen_boleto>
</payment> </payment>
</default> </default>
</config> </config>
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<item name="adyen_oneclick_config_provider" xsi:type="object">Adyen\Payment\Model\AdyenOneclickConfigProvider</item> <item name="adyen_oneclick_config_provider" xsi:type="object">Adyen\Payment\Model\AdyenOneclickConfigProvider</item>
<item name="adyen_hpp_config_provider" xsi:type="object">Adyen\Payment\Model\AdyenHppConfigProvider</item> <item name="adyen_hpp_config_provider" xsi:type="object">Adyen\Payment\Model\AdyenHppConfigProvider</item>
<item name="adyen_sepa_config_provider" xsi:type="object">Adyen\Payment\Model\AdyenSepaConfigProvider</item> <item name="adyen_sepa_config_provider" xsi:type="object">Adyen\Payment\Model\AdyenSepaConfigProvider</item>
<item name="adyen_boleto_config_provider" xsi:type="object">Adyen\Payment\Model\AdyenBoletoConfigProvider</item>
</argument> </argument>
</arguments> </arguments>
</type> </type>
......
<?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
$code = $block->escapeHtml($block->getMethodCode());
?>
<fieldset class="admin__fieldset payment-method" id="payment_form_<?php /* @noEscape */ echo $code; ?>"
style="display:none">
</fieldset>
\ No newline at end of file
<?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
*/
?>
<?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?>
<?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 ($_brandCode = $_info->getAdditionalInformation('brand_code')):?>
<div><?php echo __('Payment Method: %1', $_brandCode); ?>
</div>
<?php endif;?>
<?php if($_info->getAdditionalInformation('social_security_number') != ""): ?>
<div>
<?php echo __('Social Security Number: %1', $_info->getAdditionalInformation('social_security_number')) ?>
</div>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('boleto_type') != ""): ?>
<div>
<?php echo __('Boleto Type: %1', $_info->getAdditionalInformation('boleto_type')) ?>
</div>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('firstname') != ""): ?>
<div>
<?php echo __('Firstname: %1', $_info->getAdditionalInformation('firstname')) ?>
</div>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('lastname') != ""): ?>
<div>
<?php echo __('Firstname: %1', $_info->getAdditionalInformation('lastname')) ?>
</div>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('expirationDate') != ""): ?>
<div>
<?php echo __('Expiration Date: %1', $_info->getAdditionalInformation('expirationDate')) ?>
</div>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('dueDate') != ""): ?>
<div>
<?php echo __('Due Date: %1', $_info->getAdditionalInformation('dueDate')) ?>
</div>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('url') != ""): ?>
<div>
<a target="_blank" href="<?php echo $_info->getAdditionalInformation('url'); ?>"><?php echo __('PDF Url'); ?></a>
</div>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('adyen_total_fraud_score') != ""): ?>
<div>
<?php echo __('Total fraud score: %1', $_info->getAdditionalInformation('adyen_total_fraud_score')) ?>
</div>
<?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()?>
\ No newline at end of file
...@@ -58,6 +58,9 @@ ...@@ -58,6 +58,9 @@
<item name="adyen_sepa" xsi:type="array"> <item name="adyen_sepa" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item> <item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item> </item>
<item name="adyen_boleto" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
</item> </item>
</item> </item>
</item> </item>
......
<?xml version="1.0"?>
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="order.success.additional.info">
<block class="Adyen\Payment\Block\Checkout\Success" name="onepage.success.adyen_payment" template="checkout/success.phtml"/>
</referenceContainer>
</body>
</page>
<?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>
*/
/**
* @var \Adyen\Payment\Block\Checkout\Success $block
*/
?>
<?php if ($block->isBoletoPayment()):?>
<p>
<?php echo $block->escapeHtml(__('Boleto PDF: ')); ?>
<a href="<?php echo $block->escapeUrl($block->getBoletoPdfUrl()); ?>">
<?php echo $block->escapeHtml(__('Click here to download the Boleto PDF')); ?>
</a>
</p>
<?php endif; ?>
<?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
$_info = $this->getInfo();
?>
<dl class="payment-method adyen_cc">
<dt class="title"><?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?></dt>
<dt class="title"><?php echo $_info->getAdditionalInformation('social_security_number'); ?></dt>
<dt class="title"><?php echo $_info->getAdditionalInformation('boleto_type'); ?></dt>
<dt class="title"><?php echo $_info->getAdditionalInformation('firstname'); ?></dt>
<dt class="title"><?php echo $_info->getAdditionalInformation('lastname'); ?></dt>
<dt class="title">><a target="_blank" href="<?php echo $this->getMethod()->getInfoInstance()->getAdditionalInformation('url'); ?>"><?php echo __("Click here to download Boleto PDF."); ?></a></dt>
</dl>
...@@ -51,6 +51,10 @@ define( ...@@ -51,6 +51,10 @@ define(
{ {
type: 'adyen_pos', type: 'adyen_pos',
component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-pos-method' component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-pos-method'
},
{
type: 'adyen_boleto',
component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-boleto-method'
} }
); );
/** Add view logic here if needed */ /** Add view logic here if needed */
......
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
/*browser:true*/
/*global define*/
define(
[
'underscore',
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Payment/js/view/payment/cc-form',
'Adyen_Payment/js/action/place-order',
'mage/translate',
'Magento_Checkout/js/model/payment/additional-validators'
],
function (_, $, quote, Component, placeOrderAction, $t, additionalValidators) {
'use strict';
var billingAddress = quote.billingAddress();
return Component.extend({
self: this,
defaults: {
template: 'Adyen_Payment/payment/boleto-form',
firstname: billingAddress.firstname,
lastname: billingAddress.lastname
},
initObservable: function () {
this._super()
.observe([
'socialSecurityNumber',
'boletoType',
'firstname',
'lastname'
]);
return this;
},
setPlaceOrderHandler: function(handler) {
this.placeOrderHandler = handler;
},
setValidateHandler: function(handler) {
this.validateHandler = handler;
},
getCode: function() {
return 'adyen_boleto';
},
getData: function() {
return {
'method': this.item.method,
'additional_data': {
'social_security_number': this.socialSecurityNumber(),
'boleto_type': this.boletoType(),
'firstname': this.firstname(),
'lastname': this.lastname()
}
};
},
isActive: function() {
return true;
},
/**
* @override
*/
placeOrder: function(data, event) {
var self = this,
placeOrder;
if (event) {
event.preventDefault();
}
if (this.validate() && additionalValidators.validate()) {
this.isPlaceOrderActionAllowed(false);
placeOrder = placeOrderAction(this.getData(), this.redirectAfterPlaceOrder);
$.when(placeOrder).fail(function(response) {
self.isPlaceOrderActionAllowed(true);
});
return true;
}
return false;
},
getControllerName: function() {
return window.checkoutConfig.payment.iframe.controllerName[this.getCode()];
},
getPlaceOrderUrl: function() {
return window.checkoutConfig.payment.iframe.placeOrderUrl[this.getCode()];
},
context: function() {
return this;
},
validate: function () {
var form = 'form[data-role=adyen-boleto-form]';
var validate = $(form).validation() && $(form).validation('isValid');
if(!validate) {
return false;
}
return true;
},
showLogo: function() {
return window.checkoutConfig.payment.adyen.showLogo;
},
getBoletoTypes: function() {
return _.map(window.checkoutConfig.payment.adyenBoleto.boletoTypes, function(value, key) {
return {
'key': value.value,
'value': value.label
}
});
}
});
}
);
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
-->
<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
<div class="payment-method-title field choice">
<input type="radio"
name="payment[method]"
class="radio"
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"/>
<label data-bind="attr: {'for': getCode()}" class="label">
<!-- ko if: showLogo() -->
<div data-bind="attr: { 'class': 'adyen-sprite ' + getCode() }"></div>
<!--/ko-->
<span data-bind="text: getTitle()"></span>
</label>
</div>
<div class="payment-method-content">
<div class="payment-method-billing-address">
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<form class="form" id="adyen-boleto-form" data-role="adyen-boleto-form" action="#" method="post" data-bind="mageInit: {
'transparent':{
'context': context(),
'controller': getControllerName(),
'orderSaveUrl':getPlaceOrderUrl(),
}, 'validation':[]}">
<fieldset data-bind="attr: {class: 'fieldset payment items adyen_boleto ' + getCode(), id: 'payment_form_' + getCode()}">
<!-- ko if: (isShowLegend())-->
<legend class="legend">
<span><!-- ko text: $t('Sepa Information')--><!-- /ko --></span>
</legend><br />
<!-- /ko -->
<div class="field _social_security_number type required">
<label data-bind="attr: {for: getCode() + '_social_security_number'}" class="label">
<span><!-- ko text: $t('Social Security Number')--><!-- /ko --></span>
</label>
<div class="control">
<input type="text"
class="input-text"
name="payment[social_security_number]"
autocomplete="off"
data-bind="attr: {id: getCode() + '_social_security_number', 'data-container': getCode() + '-social-security-number', 'data-validate': JSON.stringify({required:true})},
enable: isActive($parents),
value: socialSecurityNumber"
data-validate="{required:true}">
</input>
</div>
</div>
<div class="field boleto_type type required">
<label data-bind="attr: {for: getCode() + '_boleto_type'}" class="label">
<span><!-- ko text: $t('Boleto Card Type')--><!-- /ko --></span>
</label>
<div class="control">
<select class="select select-boleto-type"
name="payment[boleto_type]"
data-bind="attr: {id: getCode() + '_boleto_type', 'data-container': getCode() + '-boleto-type', 'data-validate': JSON.stringify({required:true})},
enable: isActive($parents),
options: getBoletoTypes(),
optionsValue: 'key',
optionsText: 'value',
optionsCaption: $t('-Please select-'),
value: boletoType"
data-validate="{required:true}">
</select>
</div>
</div>
<div class="field firstname type required">
<label data-bind="attr: {for: getCode() + 'firstname'}" class="label">
<span><!-- ko text: $t('Firstname')--><!-- /ko --></span>
</label>
<div class="control">
<input type="text"
class="input-text"
name="payment[firstname]"
autocomplete="off"
data-bind="attr: {id: getCode() + '_firstname', 'data-container': getCode() + '-firstname', 'data-validate': JSON.stringify({required:true})},
enable: isActive($parents),
value: firstname"
data-validate="{required:true}">
</input>
</div>
</div>
<div class="field _lastname type required">
<label data-bind="attr: {for: getCode() + '_lastname'}" class="label">
<span><!-- ko text: $t('Lastname')--><!-- /ko --></span>
</label>
<div class="control">
<input type="text"
class="input-text"
name="payment[lastname]"
autocomplete="off"
data-bind="attr: {id: getCode() + '_lastname', 'data-container': getCode() + '-lastname', 'data-validate': JSON.stringify({required:true})},
enable: isActive($parents),
value: lastname"
data-validate="{required:true}">
</input>
</div>
</div>
</fieldset>
</form>
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="actions-toolbar">
<div class="primary">
<button class="action primary checkout"
type="submit"
data-bind="
click: placeOrder,
attr: {title: $t('Place Order')},
enable: (getCode() == isChecked()),
css: {disabled: !isPlaceOrderActionAllowed()}
"
disabled>
<span data-bind="text: $t('Place Order')"></span>
</button>
</div>
</div>
</div>
</div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment