We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit e2b38820 authored by cyattilakiss's avatar cyattilakiss Committed by GitHub

Merge pull request #444 from Adyen/develop

Release 4.1.0
parents dc96f655 d0930801
......@@ -76,9 +76,8 @@ class Success extends \Magento\Framework\View\Element\Template
'boleto_pdf_url' => $this->getBoletoPdfUrl()
]
);
return parent::_toHtml();
}
return '';
return parent::_toHtml();
}
/**
......@@ -105,6 +104,42 @@ class Success extends \Magento\Framework\View\Element\Template
return null;
}
/**
* Get Banktransfer additional data
*
* @return array|string[]
*/
public function getBankTransferData()
{
$result = [];
if (!empty($this->getOrder()->getPayment()) &&
!empty($this->getOrder()->getPayment()->getAdditionalInformation('bankTransfer.owner'))
) {
$result = $this->getOrder()->getPayment()->getAdditionalInformation();
}
return $result;
}
/**
* Get multibanco additional data
*
* @return array|string[]
*/
public function getMultibancoData()
{
$result = [];
if (!empty($this->getOrder()->getPayment()) &&
!empty($this->getOrder()->getPayment()->getAdditionalInformation('comprafacil.entity'))
) {
$result = $this->getOrder()->getPayment()->getAdditionalInformation();
}
return $result;
}
/**
* @return \Magento\Sales\Model\Order
*/
......
<?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 Sepa extends \Magento\Payment\Block\Form
{
/**
* @var string
*/
protected $_template = 'Adyen_Payment::form/sepa.phtml';
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* Sepa constructor.
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Adyen\Payment\Helper\Data $adyenHelper,
array $data = []
) {
parent::__construct($context, $data);
$this->_adyenHelper = $adyenHelper;
}
/**
* @return mixed
*/
public function getCountries()
{
return $this->_adyenHelper->getSepaCountries();
}
}
......@@ -31,13 +31,48 @@ class Hpp extends AbstractInfo
protected $_template = 'Adyen_Payment::info/adyen_hpp.phtml';
/**
* Check if Payment method selection is configured on Adyen or Magento
* Get all Banktransfer related data
*
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getBankTransferData()
{
$result = [];
if (!empty($this->getInfo()->getOrder()->getPayment()) &&
!empty($this->getInfo()->getOrder()->getPayment()->getAdditionalInformation('bankTransfer.owner'))
) {
$result = $this->getInfo()->getOrder()->getPayment()->getAdditionalInformation();
}
return $result;
}
/**
* Get all multibanco related data
*
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getMultibancoData()
{
$result = [];
if (!empty($this->getInfo()->getOrder()->getPayment()) &&
!empty($this->getInfo()->getOrder()->getPayment()->getAdditionalInformation('comprafacil.entity'))
) {
$result = $this->getInfo()->getOrder()->getPayment()->getAdditionalInformation();
}
return $result;
}
/**
* @return mixed
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function isPaymentSelectionOnAdyen()
public function getOrder()
{
return $this->_adyenHelper->getAdyenHppConfigDataFlag('payment_selection_on_adyen');
return $this->getInfo()->getOrder();
}
/**
......
<?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 Sepa extends AbstractInfo
{
/**
* @var string
*/
protected $_template = 'Adyen_Payment::info/adyen_sepa.phtml';
}
This diff is collapsed.
<?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\Redirect;
class Validate3d extends \Magento\Payment\Block\Form
{
/**
* @var \Magento\Sales\Model\OrderFactory
*/
protected $_orderFactory;
/**
* @var \Magento\Checkout\Model\Session
*/
protected $_checkoutSession;
/**
* @var \Magento\Checkout\Model\Order
*/
protected $_order;
/**
* @var \Magento\Framework\App\RequestInterface
*/
protected $_request;
/**
* Validate3d constructor.
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param array $data
* @param \Magento\Sales\Model\OrderFactory $orderFactory
* @param \Magento\Checkout\Model\Session $checkoutSession
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
array $data = [],
\Magento\Sales\Model\OrderFactory $orderFactory,
\Magento\Checkout\Model\Session $checkoutSession
) {
$this->_orderFactory = $orderFactory;
$this->_checkoutSession = $checkoutSession;
$this->_request = $context->getRequest();
parent::__construct($context, $data);
$this->_getOrder();
}
/**
* Get order object
*
* @return \Magento\Sales\Model\Order
*/
protected function _getOrder()
{
if (!$this->_order) {
$incrementId = $this->_getCheckout()->getLastRealOrderId();
$this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId);
}
return $this->_order;
}
/**
* Get frontend checkout session object
*
* @return \Magento\Checkout\Model\Session
*/
protected function _getCheckout()
{
return $this->_checkoutSession;
}
/**
* @return mixed
*/
public function getIssuerUrl()
{
return $this->_order->getPayment()->getAdditionalInformation('issuerUrl');
}
/**
* @return mixed
*/
public function getPaReq()
{
return $this->_order->getPayment()->getAdditionalInformation('paRequest');
}
/**
* @return mixed
*/
public function getMd()
{
return $this->_order->getPayment()->getAdditionalInformation('md');
}
/**
* @return string
*/
public function getTermUrl()
{
return $this->getUrl(
'adyen/process/validate3d',
['_secure' => $this->_getRequest()->isSecure()]
);
}
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected function _getRequest()
{
return $this->_request;
}
}
......@@ -24,7 +24,7 @@
namespace Adyen\Payment\Controller\Process;
use Symfony\Component\Config\Definition\Exception\Exception;
use Magento\Framework\App\Request\Http as HttpRequest;
use Magento\Framework\App\Request\Http as Http;
/**
* Class Json
......@@ -73,7 +73,7 @@ class Json extends \Magento\Framework\App\Action\Action
// Fix for Magento2.3 adding isAjax to the request params
if(interface_exists("\Magento\Framework\App\CsrfAwareActionInterface")) {
$request = $this->getRequest();
if ($request instanceof HttpRequest && $request->isPost()) {
if ($request instanceof Http && $request->isPost()) {
$request->setParam('isAjax', true);
}
}
......
This diff is collapsed.
......@@ -57,6 +57,11 @@ class Result extends \Magento\Framework\App\Action\Action
*/
protected $_adyenLogger;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $storeManager;
/**
* Result constructor.
*
......@@ -66,6 +71,7 @@ class Result extends \Magento\Framework\App\Action\Action
* @param \Magento\Sales\Model\Order\Status\HistoryFactory $orderHistoryFactory
* @param \Magento\Checkout\Model\Session $session
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
......@@ -73,13 +79,15 @@ class Result extends \Magento\Framework\App\Action\Action
\Magento\Sales\Model\OrderFactory $orderFactory,
\Magento\Sales\Model\Order\Status\HistoryFactory $orderHistoryFactory,
\Magento\Checkout\Model\Session $session,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Magento\Store\Model\StoreManagerInterface $storeManager
) {
$this->_adyenHelper = $adyenHelper;
$this->_orderFactory = $orderFactory;
$this->_orderHistoryFactory = $orderHistoryFactory;
$this->_session = $session;
$this->_adyenLogger = $adyenLogger;
$this->storeManager = $storeManager;
parent::__construct($context);
}
......@@ -152,11 +160,18 @@ class Result extends \Magento\Framework\App\Action\Action
);
}
// authenticate result url
$authStatus = $this->_authenticate($response);
if (!$authStatus) {
throw new \Magento\Framework\Exception\LocalizedException(__('ResultUrl authentification failure'));
}
// If the merchant signature is present, authenticate the result url
if (!empty($response['merchantSig'])) {
// authenticate result url
$authStatus = $this->_authenticate($response);
if (!$authStatus) {
throw new \Magento\Framework\Exception\LocalizedException(__('ResultUrl authentification failure'));
}
// Otherwise validate the pazload and get back the response that can be used to finish the order
} else {
// send the payload verification payment\details request to validate the response
$response = $this->validatePayloadAndReturnResponse($response);
}
$incrementId = $response['merchantReference'];
......@@ -202,7 +217,12 @@ class Result extends \Magento\Framework\App\Action\Action
$this->_adyenLogger->addAdyenResult('Updating the order');
$authResult = $response['authResult'];
if (!empty($response['authResult'])) {
$authResult = $response['authResult'];
} elseif (!empty($response['resultCode'])) {
$authResult = $response['resultCode'];
}
$paymentMethod = isset($response['paymentMethod']) ? trim($response['paymentMethod']) : '';
$pspReference = isset($response['pspReference']) ? trim($response['pspReference']) : '';
......@@ -215,15 +235,18 @@ class Result extends \Magento\Framework\App\Action\Action
$paymentMethod
);
// needed because then we need to save $order objects
$order->setAdyenResulturlEventCode($authResult);
switch ($authResult) {
switch (strtoupper($authResult)) {
case Notification::AUTHORISED:
$result = true;
$this->_adyenLogger->addAdyenResult('Do nothing wait for the notification');
break;
case Notification::RECEIVED:
$result = true;
$this->_adyenLogger->addAdyenResult('Do nothing wait for the notification');
break;
case Notification::PENDING:
// do nothing wait for the notification
$result = true;
......@@ -279,31 +302,33 @@ class Result extends \Magento\Framework\App\Action\Action
protected function _authenticate($response)
{
$merchantSigNotification = $response['merchantSig'];
$merchantSigNotification = $response['merchantSig'];
// do it like this because $_GET is converting dot to underscore
$queryString = $_SERVER['QUERY_STRING'];
$result = [];
$pairs = explode("&", $queryString);
// do it like this because $_GET is converting dot to underscore
$queryString = $_SERVER['QUERY_STRING'];
$result = [];
$pairs = explode("&", $queryString);
foreach ($pairs as $pair) {
$nv = explode("=", $pair);
$name = urldecode($nv[0]);
$value = urldecode($nv[1]);
$result[$name] = $value;
}
foreach ($pairs as $pair) {
$nv = explode("=", $pair);
$name = urldecode($nv[0]);
$value = urldecode($nv[1]);
$result[$name] = $value;
}
// do not include the merchantSig in the merchantSig calculation
unset($result['merchantSig']);
// do not include the merchantSig in the merchantSig calculation
unset($result['merchantSig']);
// Sign request using secret key
$hmacKey = $this->_adyenHelper->getHmac();
$merchantSig = \Adyen\Util\Util::calculateSha256Signature($hmacKey, $result);
// Sign request using secret key
$hmacKey = $this->_adyenHelper->getHmac();
$merchantSig = \Adyen\Util\Util::calculateSha256Signature($hmacKey, $result);
if (strcmp($merchantSig, $merchantSigNotification) === 0) {
return true;
}
return false;
if (strcmp($merchantSig, $merchantSigNotification) === 0) {
return true;
}
return false;
}
/**
......@@ -330,4 +355,31 @@ class Result extends \Magento\Framework\App\Action\Action
}
return $this->_order;
}
}
/**
* Validates the payload from checkout /payments hpp and returns the api response
*
* @param $response
* @return mixed
* @throws \Adyen\AdyenException
*/
protected function validatePayloadAndReturnResponse($response)
{
$client = $this->_adyenHelper->initializeAdyenClient($this->storeManager->getStore()->getId());
$service = $this->_adyenHelper->createAdyenCheckoutService($client);
$request = array(
"details" => array(
"payload" => $response["payload"]
)
);
try {
$response = $service->paymentsDetails($request);
} catch(\Adyen\AdyenException $e) {
$response['error'] = $e->getMessage();
}
return $response;
}
}
\ No newline at end of file
This diff is collapsed.
<?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\Gateway\Command;
use Magento\Payment\Gateway\Command;
use Magento\Payment\Gateway\CommandInterface;
class HppCommand implements CommandInterface
{
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* HppCommand constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(\Adyen\Payment\Helper\Data $adyenHelper)
{
$this->_adyenHelper = $adyenHelper;
}
/**
* @param array $commandSubject
* @return $this
*/
public function execute(array $commandSubject)
{
$payment =\Magento\Payment\Gateway\Helper\SubjectReader::readPayment($commandSubject);
$stateObject = \Magento\Payment\Gateway\Helper\SubjectReader::readStateObject($commandSubject);
// do not send email
$payment = $payment->getPayment();
$order = $payment->getOrder();
$order->setCanSendNewEmailFlag(false);
// update customer based on additionalFields
if ($payment->getAdditionalInformation("gender")) {
$order->setCustomerGender(\Adyen\Payment\Model\Gender::getMagentoGenderFromAdyenGender(
$payment->getAdditionalInformation("gender")
));
}
if ($payment->getAdditionalInformation("dob")) {
$order->setCustomerDob($payment->getAdditionalInformation("dob"));
}
if ($payment->getAdditionalInformation("telephone")) {
$order->getBillingAddress()->setTelephone($payment->getAdditionalInformation("telephone"));
}
// update status and state
$stateObject->setState(\Magento\Sales\Model\Order::STATE_NEW);
$stateObject->setStatus($this->_adyenHelper->getAdyenAbstractConfigData('order_status'));
$stateObject->setIsNotified(false);
return $this;
}
}
......@@ -40,7 +40,9 @@ class AddressDataBuilder implements BuilderInterface
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(\Adyen\Payment\Helper\Data $adyenHelper)
public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper
)
{
$this->adyenHelper = $adyenHelper;
}
......@@ -56,12 +58,14 @@ class AddressDataBuilder implements BuilderInterface
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$order = $paymentDataObject->getOrder();
$billingAddress = $order->getBillingAddress();
$result = [];
$billingAddress = $order->getBillingAddress();
if ($billingAddress) {
$requestBilling = ["street" => "N/A",
$requestBilling = [
"street" => "N/A",
"postalCode" => '',
"city" => "N/A",
"houseNumberOrName" => '',
......@@ -69,9 +73,12 @@ class AddressDataBuilder implements BuilderInterface
"country" => "ZZ"
];
if ($billingAddress->getStreetLine1()) {
$requestBilling["street"] = $billingAddress->getStreetLine1();
}
$address = $this->adyenHelper->getStreetFromString($billingAddress->getStreetLine1());
if ($address) {
$requestBilling["street"] = $address["name"];
$requestBilling["houseNumberOrName"] = $address["house_number"];
}
if ($billingAddress->getPostcode()) {
$requestBilling["postalCode"] = $billingAddress->getPostcode();
......@@ -93,16 +100,31 @@ class AddressDataBuilder implements BuilderInterface
}
$shippingAddress = $order->getShippingAddress();
if ($shippingAddress) {
// filter housenumber from streetLine1
$requestDelivery = ["street" => $shippingAddress->getStreetLine1(),
"postalCode" => $shippingAddress->getPostcode(),
"city" => $shippingAddress->getCity(),
"houseNumberOrName" => '',
"stateOrProvince" => $shippingAddress->getRegionCode(),
"country" => $shippingAddress->getCountryId()
];
$address = $this->adyenHelper->getStreetFromString($shippingAddress->getStreetLine1());
if ($address) {
$requestDelivery["street"] = $address["name"];
$requestDelivery["houseNumberOrName"] = $address["house_number"];
}
if ($shippingAddress->getPostcode()) {
$requestDelivery["postalCode"] = $shippingAddress->getPostcode();
}
if ($shippingAddress->getCity()) {
$requestDelivery["city"] = $shippingAddress->getCity();
}
if ($shippingAddress->getRegionCode()) {
$requestDelivery["stateOrProvince"] = $shippingAddress->getRegionCode();
}
if ($shippingAddress->getCountryId()) {
$requestDelivery["country"] = $shippingAddress->getCountryId();
}
$result['deliveryAddress'] = $requestDelivery;
}
......
......@@ -60,13 +60,15 @@ class ApplePayAuthorizationDataBuilder implements BuilderInterface
$payment = $paymentDataObject->getPayment();
$token = $payment->getAdditionalInformation('token');
$request['paymentMethod']['type'] = 'applepay';
// get payment data
if ($token) {
$parsedToken = json_decode($token);
$paymentData = $parsedToken->token->paymentData;
try {
$paymentData = base64_encode(json_encode($paymentData));
$request['additionalData']['payment.token'] = $paymentData;
$request['paymentMethod']['applepay.token'] = $paymentData;
} catch (\Exception $exception) {
$this->_adyenLogger->addAdyenDebug("exception: " . $exception->getMessage());
}
......
<?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\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
class BoletoAuthorizationDataBuilder implements BuilderInterface
{
/**
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
/**
* CaptureDataBuilder constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper
) {
$this->adyenHelper = $adyenHelper;
}
/**
* @param array $buildSubject
* @return mixed
*/
public function build(array $buildSubject)
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
$order = $paymentDataObject->getOrder();
$storeId = $order->getStoreId();
$request = [];
$request['socialSecurityNumber'] = $payment->getAdditionalInformation("social_security_number");
$boletoTypes = $this->adyenHelper->getAdyenBoletoConfigData('boletotypes');
$boletoTypes = explode(',', $boletoTypes);
if (count($boletoTypes) == 1) {
$request['selectedBrand'] = $boletoTypes[0];
} else {
$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;
return $request;
}
}
This diff is collapsed.
......@@ -23,14 +23,31 @@
namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
use Adyen\Payment\Observer\AdyenHppDataAssignObserver;
/**
* Class CustomerDataBuilder
*/
class CustomerDataBuilder implements BuilderInterface
{
/**
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
/**
/**
* CustomerDataBuilder constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper
)
{
$this->adyenHelper = $adyenHelper;
}
/**
* Add shopper data into request
*
* @param array $buildSubject
......@@ -43,6 +60,7 @@ class CustomerDataBuilder implements BuilderInterface
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$order = $paymentDataObject->getOrder();
$payment = $paymentDataObject->getPayment();
$customerId = $order->getCustomerId();
if ($customerId > 0) {
......@@ -52,14 +70,46 @@ class CustomerDataBuilder implements BuilderInterface
$billingAddress = $order->getBillingAddress();
if (!empty($billingAddress)) {
$customerEmail = $billingAddress->getEmail();
if ($customerEmail) {
$result['shopperEmail'] = $customerEmail;
if ($this->adyenHelper->isPaymentMethodOpenInvoiceMethod(
$payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE)
) && !$this->adyenHelper->isPaymentMethodAfterpayTouchMethod(
$payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE)
)) {
if ($customerEmail = $billingAddress->getEmail()) {
$result['paymentMethod']['personalDetails']['shopperEmail'] = $customerEmail;
}
if ($customerTelephone = trim($billingAddress->getTelephone())) {
$result['paymentMethod']['personalDetails']['telephoneNumber'] = $customerTelephone;
}
if ($firstName = $billingAddress->getFirstname()) {
$result['paymentMethod']['personalDetails']['firstName'] = $firstName;
}
if ($lastName = $billingAddress->getLastname()) {
$result['paymentMethod']['personalDetails']['lastName'] = $lastName;
}
} else {
if ($customerEmail = $billingAddress->getEmail()) {
$result['shopperEmail'] = $customerEmail;
}
if ($customerTelephone = trim($billingAddress->getTelephone())) {
$result['telephoneNumber'] = $customerTelephone;
}
if ($firstName = $billingAddress->getFirstname()) {
$result['shopperName']['firstName'] = $firstName;
}
if ($lastName = $billingAddress->getLastname()) {
$result['shopperName']['lastName'] = $lastName;
}
}
$customerTelephone = trim($billingAddress->getTelephone());
if ($customerTelephone) {
$result['telephoneNumber'] = $customerTelephone;
if ($countryId = $billingAddress->getCountryId()) {
$result['countryCode'] = $countryId;
}
}
......
<?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\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
class SepaAuthorizationDataBuilder implements BuilderInterface
{
/**
* @param array $buildSubject
* @return mixed
*/
public function build(array $buildSubject)
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
$request = [];
// add bankDetails into request
$request['paymentMethod']['type'] = "sepadirectdebit";
$request['paymentMethod']['sepa.ibanNumber'] = $payment->getAdditionalInformation("iban");
$request['paymentMethod']['sepa.ownerName'] = $payment->getAdditionalInformation("account_name");
$request['paymentMethod']['countryCode'] = $payment->getAdditionalInformation("country");
return $request;
}
}
......@@ -33,6 +33,7 @@ class CheckoutPaymentsDetailsHandler implements HandlerInterface
*/
protected $adyenHelper;
public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper
) {
......@@ -40,6 +41,8 @@ class CheckoutPaymentsDetailsHandler implements HandlerInterface
}
/**
* This is being used for all checkout methods (adyen hpp payment method)
*
* @param array $handlingSubject
* @param array $response
*/
......@@ -69,7 +72,6 @@ class CheckoutPaymentsDetailsHandler implements HandlerInterface
!$this->adyenHelper->isCreditCardVaultEnabled()
) {
$order = $payment->getOrder();
$this->adyenHelper->createAdyenBillingAgreement($order, $response['additionalData']);
}
......
......@@ -97,12 +97,12 @@ class GeneralResponseValidator extends AbstractValidator
$payment->setAdditionalInformation('3dActive', true);
$payment->setAdditionalInformation('pspReference', $response['pspReference']);
$issuerUrl = $response['issuerUrl'];
$redirectUrl = $response['issuerUrl'];
$paReq = $response['paRequest'];
$md = $response['md'];
if (!empty($paReq) && !empty($md) && !empty($issuerUrl)) {
$payment->setAdditionalInformation('issuerUrl', $response['issuerUrl']);
if (!empty($paReq) && !empty($md) && !empty($redirectUrl)) {
$payment->setAdditionalInformation('redirectUrl', $redirectUrl);
$payment->setAdditionalInformation('paRequest', $response['paRequest']);
$payment->setAdditionalInformation('md', $response['md']);
} else {
......
<?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\Gateway\Validator;
use Magento\Payment\Gateway\Validator\AbstractValidator;
use Magento\Payment\Gateway\Validator\ResultInterfaceFactory;
/**
* Class SepaValidator
* @package Adyen\Payment\Gateway\Validator
*/
class SepaValidator extends AbstractValidator
{
/**
* @param array $validationSubject
* @return \Magento\Payment\Gateway\Validator\ResultInterface
*/
public function validate(array $validationSubject)
{
$isValid = true;
$fails = [];
$payment = $validationSubject['payment'];
$iban = $payment->getAdditionalInformation('iban');
if (empty($iban) || !$this->validateIban($iban)) {
$isValid = false;
$fails[] = __('Invalid Iban number.');
}
return $this->createResult($isValid, $fails);
}
/**
* @param $iban
* @return bool
*/
public function validateIban($iban)
{
$iban = strtolower(str_replace(' ', '', $iban));
$countries = ['al'=>28,'ad'=>24,'at'=>20,'az'=>28,'bh'=>22,'be'=>16,'ba'=>20,'br'=>29,'bg'=>22,'cr'=>21,
'hr'=>21,'cy'=>28,'cz'=>24,'dk'=>18,'do'=>28,'ee'=>20,'fo'=>18,'fi'=>18,'fr'=>27,'ge'=>22,
'de'=>22,'gi'=>23,'gr'=>27,'gl'=>18,'gt'=>28,'hu'=>28,'is'=>26,'ie'=>22,'il'=>23,'it'=>27,
'jo'=>30,'kz'=>20,'kw'=>30,'lv'=>21,'lb'=>28,'li'=>21,'lt'=>20,'lu'=>20,'mk'=>19,'mt'=>31,
'mr'=>27,'mu'=>30,'mc'=>27,'md'=>24, 'me'=>22,'nl'=>18,'no'=>15,'pk'=>24,'ps'=>29,'pl'=>28,
'pt'=>25,'qa'=>29,'ro'=>24, 'sm'=>27,'sa'=>24,'rs'=>22,'sk'=>24,'si'=>19,'es'=>24,'se'=>24,
'ch'=>21,'tn'=>24,'tr'=>26,'ae'=>23,'gb'=>22,'vg'=>24];
$chars = ['a'=>10,'b'=>11,'c'=>12,'d'=>13,'e'=>14,'f'=>15,'g'=>16,'h'=>17,'i'=>18,'j'=>19,'k'=>20,'l'=>21,
'm'=>22,'n'=>23,'o'=>24,'p'=>25,'q'=>26,'r'=>27,'s'=>28,'t'=>29,'u'=>30,'v'=>31,'w'=>32,'x'=>33,
'y'=>34,'z'=>35];
if (isset($countries[substr($iban, 0, 2)]) &&
strlen($iban) == $countries[substr($iban, 0, 2)]) {
$movedChar = substr($iban, 4).substr($iban, 0, 4);
$movedCharArray = str_split($movedChar);
$newString = "";
foreach ($movedCharArray as $key => $value) {
if (!is_numeric($movedCharArray[$key])) {
$movedCharArray[$key] = $chars[$movedCharArray[$key]];
}
$newString .= $movedCharArray[$key];
}
if (function_exists("bcmod")) {
return bcmod($newString, '97') == 1;
}
/**
* if server does not support bcmoc then do this manually:
* http://au2.php.net/manual/en/function.bcmod.php#38474
*/
$x = $newString;
$y = "97";
$take = 5;
$mod = "";
do {
$a = (int)$mod . substr($x, 0, $take);
$x = substr($x, $take);
$mod = $a % $y;
} while (strlen($x));
return (int)$mod == 1;
} else {
return false;
}
}
}
......@@ -35,8 +35,8 @@ class Data extends AbstractHelper
const LIVE = 'live';
const CHECKOUT_CONTEXT_URL_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';
const CHECKOUT_CONTEXT_URL_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/';
const CHECKOUT_COMPONENT_JS_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/2.0.0/adyen.js';
const CHECKOUT_COMPONENT_JS_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/2.0.0/adyen.js';
const CHECKOUT_COMPONENT_JS_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/2.1.0/adyen.js';
const CHECKOUT_COMPONENT_JS_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/2.1.0/adyen.js';
/**
* @var \Magento\Framework\Encryption\EncryptorInterface
......@@ -202,7 +202,7 @@ class Data extends AbstractHelper
}
/**
* eturn recurring types for configuration setting
* return recurring types for configuration setting
* @return array
*/
public function getCaptureModes()
......@@ -350,6 +350,20 @@ class Data extends AbstractHelper
return (['name' => trim($streetName), 'house_number' => $streetNr]);
}
/**
* Street format
* @param string $streetLine
* @return array
*/
public function getStreetFromString($streetLine)
{
$street = self::formatStreet(array($streetLine));
$streetName = $street['0'];
unset($street['0']);
$streetNr = implode(' ', $street);
return (['name' => trim($streetName), 'house_number' => $streetNr]);
}
/**
* Fix this one string street + number
* @example street + number
......@@ -769,65 +783,6 @@ class Data extends AbstractHelper
}
}
/**
* @return array
*/
public function getSepaCountries()
{
$sepaCountriesAllowed = [
"AT",
"BE",
"BG",
"CH",
"CY",
"CZ",
"DE",
"DK",
"EE",
"ES",
"FI",
"FR",
"GB",
"GF",
"GI",
"GP",
"GR",
"HR",
"HU",
"IE",
"IS",
"IT",
"LI",
"LT",
"LU",
"LV",
"MC",
"MQ",
"MT",
"NL",
"NO",
"PL",
"PT",
"RE",
"RO",
"SE",
"SI",
"SK"
];
$countryList = $this->_country->toOptionArray();
$sepaCountries = [];
foreach ($countryList as $key => $country) {
$value = $country['value'];
if (in_array($value, $sepaCountriesAllowed)) {
$sepaCountries[$value] = $country['label'];
}
}
return $sepaCountries;
}
/**
* Get adyen magento module's name sent to Adyen
*
......@@ -851,10 +806,6 @@ class Data extends AbstractHelper
public function getBoletoTypes()
{
return [
[
'value' => 'boletobancario_hsbc',
'label' => __('boletobancario_hsbc'),
],
[
'value' => 'boletobancario_itau',
'label' => __('boletobancario_itau'),
......@@ -864,13 +815,9 @@ class Data extends AbstractHelper
'label' => __('boletobancario_santander'),
],
[
'value' => 'boletobancario_bradesco',
'label' => __('boletobancario_bradesco'),
],
[
'value' => 'boletobancario_bancodobrasil',
'label' => __('boletobancario_bancodobrasil'),
],
'value' => 'primeiropay_boleto',
'label' => __('primeiropay_boleto'),
]
];
}
......@@ -983,17 +930,29 @@ class Data extends AbstractHelper
*/
public function isPaymentMethodOpenInvoiceMethod($paymentMethod)
{
if (strpos($paymentMethod, 'afterpay') !== false) {
return true;
} elseif (strpos($paymentMethod, 'klarna') !== false) {
return true;
} elseif (strpos($paymentMethod, 'ratepay') !== false) {
if (strpos($paymentMethod, 'afterpay') !== false ||
strpos($paymentMethod, 'klarna') !== false ||
strpos($paymentMethod, 'ratepay') !== false
) {
return true;
}
return false;
}
/**
* @param $paymentMethod
* @return bool
*/
public function isPaymentMethodAfterpayTouchMethod($paymentMethod)
{
if (strpos($paymentMethod, 'afterpaytouch') !== false) {
return true;
}
return false;
}
/**
* @param $paymentMethod
* @return bool
......@@ -1039,6 +998,40 @@ class Data extends AbstractHelper
/**
* @return mixed
*/
/**
* @param $paymentMethod
* @return bool
*/
public function isPaymentMethodBcmcMobileQRMethod($paymentMethod)
{
if (strpos($paymentMethod, 'bcmc_mobile_QR') !== false) {
return true;
}
return false;
}
/**
* The payment method for wechat should be only wechatweb until we support the others too.
*
* @param $paymentMethod
* @return bool
*/
public function isPaymentMethodWechatpayExceptWeb($paymentMethod)
{
if (strpos($paymentMethod, 'wechatpay') !== false) {
if (strpos($paymentMethod, 'wechatpayWeb') !== false) {
return false;
}
return true;
}
return false;
}
public function getRatePayId()
{
return $this->getAdyenHppConfigData("ratepay_id");
......@@ -1060,6 +1053,18 @@ class Data extends AbstractHelper
return false;
}
/**
* @param $paymentMethod
* @return bool
*/
public function isPaymentMethodBoletoMethod($paymentMethod)
{
if (strpos($paymentMethod, 'boleto') !== false) {
return true;
}
return false;
}
/**
* @return bool
*/
......@@ -1223,7 +1228,7 @@ class Data extends AbstractHelper
$itemVatPercentage,
$numberOfItems,
$payment,
"shipping"
"shippingCost"
);
}
......@@ -1663,4 +1668,37 @@ class Data extends AbstractHelper
return in_array(strtolower($country), $countryList);
}
/**
* @param $client
* @return \Adyen\Service\Checkout
*/
public function createAdyenCheckoutService($client)
{
return new \Adyen\Service\Checkout($client);
}
/**
* @param $client
* @return \Adyen\Service\Recurring
* @throws \Adyen\AdyenException
*/
public function createAdyenRecurringService($client)
{
return new \Adyen\Service\Recurring($client);
}
/**
* @param string $date
* @param string $format
* @return mixed
*/
public function formatDate($date = null, $format = 'Y-m-d H:i:s')
{
if (strlen($date) < 0) {
$date = date('d-m-Y H:i:s');
}
$timeStamp = new \DateTime($date);
return $timeStamp->format($format);
}
}
This diff is collapsed.
......@@ -103,6 +103,10 @@ class PaymentRequest extends DataObject
$paResponse = $payment->getAdditionalInformation('paResponse');
$paymentData = $payment->getAdditionalInformation('paymentData');
$payment->unsAdditionalInformation('paymentData');
$payment->unsAdditionalInformation('paRequest');
$payment->unsAdditionalInformation('md');
$request = [
"paymentData" => $paymentData,
"details" => [
......@@ -113,7 +117,7 @@ class PaymentRequest extends DataObject
try {
$client = $this->_adyenHelper->initializeAdyenClient($storeId);
$service = new \Adyen\Service\Checkout($client);
$service = $this->_adyenHelper->createAdyenCheckoutService($client);
$result = $service->paymentsDetails($request);
} catch (\Adyen\AdyenException $e) {
throw new \Magento\Framework\Exception\LocalizedException(__('3D secure failed'));
......@@ -187,8 +191,8 @@ class PaymentRequest extends DataObject
];
// call lib
$client = $this->createClient($storeId);
$service = new \Adyen\Service\Recurring($client);
$client = $this->_adyenHelper->initializeAdyenClient($storeId);
$service = $this->_adyenHelper->createAdyenRecurringService($client);
$result = $service->listRecurringDetails($request);
return $result;
......@@ -214,8 +218,8 @@ class PaymentRequest extends DataObject
];
// call lib
$client = $this->createClient($storeId);
$service = new \Adyen\Service\Recurring($client);
$client = $this->_adyenHelper->initializeAdyenClient($storeId);
$service = $this->_adyenHelper->createAdyenRecurringService($client);
try {
$result = $service->disable($request);
......
<?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 PaymentRoutine implements \Magento\Framework\Option\ArrayInterface
{
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @param \Magento\Sales\Model\Order\Config $orderConfig
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper
) {
$this->_adyenHelper = $adyenHelper;
}
/**
* @return array
*/
public function toOptionArray()
{
$recurringTypes = $this->_adyenHelper->getPaymentRoutines();
foreach ($recurringTypes as $code => $label) {
$options[] = ['value' => $code, 'label' => $label];
}
return $options;
}
}
......@@ -1344,9 +1344,7 @@ class Cron
* if you are using authcap the payment method is manual.
* There will be a capture send to indicate if payment is successful
*/
if (($_paymentCode == "adyen_sepa" || $this->_paymentMethod == "sepadirectdebit") &&
$sepaFlow == "authcap"
) {
if ($this->_paymentMethod == "sepadirectdebit" && $sepaFlow == "authcap") {
$this->_adyenLogger->addAdyenNotificationCronjob(
'Manual Capture is applied for sepa because it is in authcap flow'
);
......@@ -1354,9 +1352,7 @@ class Cron
}
// payment method ideal, cash adyen_boleto has direct capture
if (($_paymentCode == "adyen_sepa" ||
$this->_paymentMethod == "sepadirectdebit") && $sepaFlow != "authcap"
) {
if ($this->_paymentMethod == "sepadirectdebit" && $sepaFlow != "authcap") {
$this->_adyenLogger->addAdyenNotificationCronjob(
'This payment method does not allow manual capture.(2) paymentCode:' .
$_paymentCode . ' paymentMethod:' . $this->_paymentMethod . ' sepaFLow:' . $sepaFlow
......
......@@ -31,6 +31,7 @@ class Notification extends \Magento\Framework\Model\AbstractModel implements Not
const AUTHORISATION = 'AUTHORISATION';
const PENDING = 'PENDING';
const AUTHORISED = 'AUTHORISED';
const RECEIVED = 'RECEIVED';
const CANCELLED = 'CANCELLED';
const REFUSED = 'REFUSED';
const ERROR = 'ERROR';
......
......@@ -111,9 +111,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
'vaultCode' => self::CC_VAULT_CODE,
'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl(
'adyen/process/validate3d/',
['_secure' => $this->_getRequest()->isSecure()]
)
'adyen/process/redirect/', ['_secure' => $this->_getRequest()->isSecure()])
]
]
];
......
......@@ -143,15 +143,6 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
// gender types
$config['payment'] ['adyenHpp']['genderTypes'] = \Adyen\Payment\Model\Gender::getGenderTypes();
$paymentMethodSelectionOnAdyen =
$this->adyenHelper->getAdyenHppConfigDataFlag('payment_selection_on_adyen');
$config['payment'] ['adyenHpp']['isPaymentMethodSelectionOnAdyen'] = $paymentMethodSelectionOnAdyen;
$config['payment'] ['adyenHpp']['showGender'] = $this->adyenHelper->getAdyenHppConfigDataFlag('show_gender');
$config['payment'] ['adyenHpp']['showDob'] = $this->adyenHelper->getAdyenHppConfigDataFlag('show_dob');
$config['payment'] ['adyenHpp']['showTelephone'] = $this->adyenHelper->getAdyenHppConfigDataFlag(
'show_telephone'
);
$config['payment'] ['adyenHpp']['ratePayId'] = $this->adyenHelper->getRatePayId();
$config['payment'] ['adyenHpp']['deviceIdentToken'] = md5($this->session->getQuoteId() . date('c'));
$config['payment'] ['adyenHpp']['nordicCountries'] = ['SE', 'NO', 'DK', 'FI'];
......
......@@ -114,9 +114,7 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
self::CODE => [
'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl(
'adyen/process/validate3d/',
['_secure' => $this->_getRequest()->isSecure()]
)
'adyen/process/redirect/', ['_secure' => $this->_getRequest()->isSecure()])
]
]
];
......
<?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\Ui;
use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Payment\Helper\Data as PaymentHelper;
class AdyenSepaConfigProvider implements ConfigProviderInterface
{
const CODE = 'adyen_sepa';
/**
* @var PaymentHelper
*/
protected $_paymentHelper;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* Request object
*
* @var \Magento\Framework\App\RequestInterface
*/
protected $_request;
/**
* @var \Magento\Framework\UrlInterface
*/
protected $_urlBuilder;
/**
* AdyenSepaConfigProvider constructor.
*
* @param PaymentHelper $paymentHelper
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\App\RequestInterface $request
* @param \Magento\Framework\UrlInterface $urlBuilder
*/
public function __construct(
PaymentHelper $paymentHelper,
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\App\RequestInterface $request,
\Magento\Framework\UrlInterface $urlBuilder
) {
$this->_paymentHelper = $paymentHelper;
$this->_adyenHelper = $adyenHelper;
$this->_request = $request;
$this->_urlBuilder = $urlBuilder;
}
/**
* @return array
*/
public function getConfig()
{
// set to active
$config = [
'payment' => [
self::CODE => [
'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl(
'checkout/onepage/success/',
['_secure' => $this->_getRequest()->isSecure()]
)
]
]
];
$config['payment']['adyenSepa']['countries'] = $this->_adyenHelper->getSepaCountries();
return $config;
}
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected function _getRequest()
{
return $this->_request;
}
}
......@@ -38,6 +38,11 @@ class AdyenHppDataAssignObserver extends AbstractDataAssignObserver
const TELEPHONE = 'telephone';
const DF_VALUE = 'df_value';
const SSN = 'ssn';
const OWNER_NAME = 'ownerName';
const BANK_ACCOUNT_OWNER_NAME = 'bankAccountOwnerName';
const IBAN_NUMBER = 'ibanNumber';
const BANK_ACCOUNT_NUMBER = 'bankAccountNumber';
const BANK_LOCATIONID = 'bankLocationId';
/**
......@@ -50,7 +55,12 @@ class AdyenHppDataAssignObserver extends AbstractDataAssignObserver
self::DOB,
self::TELEPHONE,
self::DF_VALUE,
self::SSN
self::SSN,
self::OWNER_NAME,
self::BANK_ACCOUNT_OWNER_NAME,
self::IBAN_NUMBER,
self::BANK_ACCOUNT_NUMBER,
self::BANK_LOCATIONID
];
/**
......
<?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\Observer;
use Magento\Framework\Event\Observer;
use Magento\Payment\Observer\AbstractDataAssignObserver;
use Magento\Quote\Api\Data\PaymentInterface;
/**
* Class DataAssignObserver
*/
class AdyenSepaDataAssignObserver extends AbstractDataAssignObserver
{
const ACCOUNT_NAME = 'account_name';
const IBAN = 'iban';
const COUNTRY = 'country';
const ACCEPTSEPA = 'accept_sepa';
/**
* @var array
*/
protected $additionalInformationList = [
self::ACCOUNT_NAME,
self::IBAN,
self::COUNTRY,
self::ACCEPTSEPA
];
/**
* @param Observer $observer
* @return void
*/
public function execute(Observer $observer)
{
$data = $this->readDataArgument($observer);
$additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA);
if (!is_array($additionalData)) {
return;
}
$paymentInfo = $this->readPaymentModelArgument($observer);
$paymentInfo->setCcType('sepa');
foreach ($this->additionalInformationList as $additionalInformationKey) {
if (isset($additionalData[$additionalInformationKey])) {
$paymentInfo->setAdditionalInformation(
$additionalInformationKey,
$additionalData[$additionalInformationKey]
);
}
}
}
}
......@@ -2,7 +2,7 @@
"name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module",
"version": "4.0.3",
"version": "4.1.0",
"license": [
"OSL-3.0",
"AFL-3.0"
......@@ -14,7 +14,7 @@
}
],
"require": {
"adyen/php-api-library": ">=1.5.3",
"adyen/php-api-library": ">=2.0.0",
"magento/framework": ">=101.0.0",
"magento/module-vault": "101.*"
},
......
......@@ -42,7 +42,6 @@
<include path="Adyen_Payment::system/adyen_cc.xml"/>
<include path="Adyen_Payment::system/adyen_oneclick.xml"/>
<include path="Adyen_Payment::system/adyen_hpp.xml"/>
<include path="Adyen_Payment::system/adyen_sepa.xml"/>
<include path="Adyen_Payment::system/adyen_pos_cloud.xml"/>
<include path="Adyen_Payment::system/adyen_pay_by_mail.xml"/>
<include path="Adyen_Payment::system/adyen_boleto.xml"/>
......
......@@ -24,7 +24,7 @@
-->
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="adyen_hpp" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[Hosted Payment Page (HPP) integration]]></label>
<label><![CDATA[Alternative payment methods]]></label>
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model>
<fieldset_css>adyen-method-adyen-cc</fieldset_css>
<comment>Process alternative payments methods</comment>
......@@ -38,47 +38,9 @@
<frontend_class>validate-number</frontend_class>
<config_path>payment/adyen_hpp/sort_order</config_path>
</field>
<field id="skin_code" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Skin Code</label>
<tooltip>Copy and paste the skin code of the skin you want to use from Test Customer Area => Skins.</tooltip>
<config_path>payment/adyen_hpp/skin_code</config_path>
</field>
<field id="hmac_test" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<label>HMAC Key for Test</label>
<tooltip>Copy and paste the HMAC key of the skin you want to use from Test Customer Area => Skins. => click on [skin code] => Edit => HMAC for Test platform.</tooltip>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<config_path>payment/adyen_hpp/hmac_test</config_path>
</field>
<field id="hmac_live" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
<label>HMAC Key for Live</label>
<tooltip>Copy and paste the HMAC key of the skin you want to use from Test Customer Area => Skins. => click on [skin code] => Edit => HMAC for Live platform.</tooltip>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<config_path>payment/adyen_hpp/hmac_live</config_path>
</field>
<group id="adyen_hpp_openinvoice_settings" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="100">
<label>Klarna\RatePay\Afterpay Settings</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="show_gender" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show Gender</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_hpp/show_gender</config_path>
</field>
<field id="show_dob" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show Date of Birth</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_hpp/show_dob</config_path>
</field>
<field id="show_telephone" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show Telephone</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_hpp/show_telephone</config_path>
</field>
<field id="ignore_second_address_field" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Ignore the second address line field</label>
<tooltip>If you do not want to send the second line address field to Klarna set this setting to 'Yes'</tooltip>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_hpp/ignore_second_address_field</config_path>
</field>
<field id="ratepay_id" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<label>RatePAY Device Ident SId</label>
<tooltip>Unique RatePAY Id provided by RatePAY integration consultant</tooltip>
......@@ -92,25 +54,6 @@
<label>Title</label>
<config_path>payment/adyen_hpp/title</config_path>
</field>
<field id="delivery_days" translate="label" type="text" sortOrder="68" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Days to Delivery</label>
<tooltip>How many days to be added to the current date for delivery. ONLY whole numbers allowed.</tooltip>
<frontend_class>validate-number</frontend_class>
<config_path>payment/adyen_hpp/delivery_days</config_path>
</field>
<field id="payment_selection_on_adyen" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment method selection on Adyen Hosted Payment Page (HPP)</label>
<tooltip>If you set this to 'Yes', payment methods in the checkout won't be displayed and you will be redirected to the Adyen HPP to make the selection.</tooltip>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_hpp/payment_selection_on_adyen</config_path>
</field>
<field id="payment_routine" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Payment Flow Selection</label>
<tooltip>Adyen provides you with 2 types of payment routines. The Single-Page flow is dynamic and contains card validation and animations powered by JavaScript. The Multi-Page flow is static, but performs better on older browsers.</tooltip>
<source_model>Adyen\Payment\Model\Config\Source\PaymentRoutine</source_model>
<depends><field id="payment_selection_on_adyen">1</field></depends>
<config_path>payment/adyen_hpp/payment_routine</config_path>
</field>
<field id="shopper_locale" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Language locale (optional)</label>
<tooltip>This will override the default shopper locale of the Magento store (e.g. nl_NL). Leave empty to let Magento decide.</tooltip>
......
......@@ -49,18 +49,18 @@
</field>
<field id="skin_code" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Skin Code</label>
<tooltip>The skin code you want to use leave this empty if you want to use the same as Adyen HPP settings</tooltip>
<tooltip>The skin code you want to use</tooltip>
<config_path>payment/adyen_pay_by_mail/skin_code</config_path>
</field>
<field id="hmac_test" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
<label>HMAC Key for Test</label>
<tooltip>Should match with the HMAC test key in the Adyen Customer Area. Fill this in if you are using a different skin then defined in Adyen HPP</tooltip>
<tooltip>Should match with the HMAC test key in the Adyen Customer Area.</tooltip>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<config_path>payment/adyen_pay_by_mail/hmac_test</config_path>
</field>
<field id="hmac_live" translate="label" type="obscure" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1">
<label>HMAC Key for Live</label>
<tooltip>Should match with the HMAC live key in the Adyen Customer Area. Fill this in if you are using a different skin then defined in Adyen HPP</tooltip>
<tooltip>Should match with the HMAC live key in the Adyen Customer Area.</tooltip>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<config_path>payment/adyen_pay_by_mail/hmac_live</config_path>
</field>
......
<?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_sepa" translate="label" type="text" sortOrder="250" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[SEPA integration]]></label>
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model>
<fieldset_css>adyen-method-adyen-cc</fieldset_css>
<comment>Process SEPA 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_sepa/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_sepa/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_sepa/sort_order</config_path>
</field>
<group id="adyen_sepa_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_sepa/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_sepa/specificcountry</config_path>
</field>
</group>
</group>
</include>
\ No newline at end of file
......@@ -83,7 +83,6 @@
<payment_action>authorize</payment_action>
<useccv>1</useccv>
<enable_moto>0</enable_moto>
<payment_action>authorize</payment_action>
<is_gateway>1</is_gateway>
<can_use_checkout>1</can_use_checkout>
<can_authorize>1</can_authorize>
......@@ -101,14 +100,11 @@
<active>0</active>
<model>AdyenPaymentHppFacade</model>
<order_status>pending</order_status>
<title>Adyen HPP</title>
<payment_selection_on_adyen>0</payment_selection_on_adyen>
<payment_routine>single</payment_routine>
<delivery_days>5</delivery_days>
<title>Alternative payment methods</title>
<allowspecific>0</allowspecific>
<ratepay_id>oj9GsQ</ratepay_id>
<sort_order>3</sort_order>
<payment_action>order</payment_action>
<payment_action>authorize</payment_action>
<can_initialize>1</can_initialize>
<is_gateway>1</is_gateway>
<can_use_checkout>1</can_use_checkout>
......@@ -121,25 +117,6 @@
<can_cancel>1</can_cancel>
<group>adyen</group>
</adyen_hpp>
<adyen_sepa>
<active>0</active>
<model>AdyenPaymentSepaFacade</model>
<title>Sepa Direct Debit</title>
<allowspecific>0</allowspecific>
<sort_order>4</sort_order>
<payment_action>authorize</payment_action>
<is_gateway>1</is_gateway>
<can_use_checkout>1</can_use_checkout>
<can_authorize>1</can_authorize>
<can_capture>1</can_capture>
<can_capture_partial>1</can_capture_partial>
<can_use_internal>1</can_use_internal>
<can_refund_partial_per_invoice>1</can_refund_partial_per_invoice>
<can_refund>1</can_refund>
<can_void>1</can_void>
<can_cancel>1</can_cancel>
<group>adyen</group>
</adyen_sepa>
<adyen_pos_cloud>
<active>0</active>
<model>AdyenPaymentPosCloudFacade</model>
......
This diff is collapsed.
......@@ -32,9 +32,6 @@
<event name="payment_method_assign_data_adyen_hpp">
<observer name="adyen_hpp_gateway_data_assign" instance="Adyen\Payment\Observer\AdyenHppDataAssignObserver" />
</event>
<event name="payment_method_assign_data_adyen_sepa">
<observer name="adyen_sepa_gateway_data_assign" instance="Adyen\Payment\Observer\AdyenSepaDataAssignObserver" />
</event>
<event name="payment_method_assign_data_adyen_boleto">
<observer name="adyen_boleto_gateway_data_assign" instance="Adyen\Payment\Observer\AdyenBoletoDataAssignObserver" />
</event>
......
......@@ -27,28 +27,13 @@
<type name="Magento\Checkout\Model\CompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="adyen_generic_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenGenericConfigProvider
</item>
<item name="adyen_cc_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenCcConfigProvider
</item>
<item name="adyen_oneclick_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider
</item>
<item name="adyen_hpp_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenHppConfigProvider
</item>
<item name="adyen_sepa_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenSepaConfigProvider
</item>
<item name="adyen_boleto_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider
</item>
<item name="adyen_pos_cloud_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider
</item>
<item name="adyen_apple_pay_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider
</item>
<item name="adyen_generic_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenGenericConfigProvider</item>
<item name="adyen_cc_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenCcConfigProvider</item>
<item name="adyen_oneclick_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider</item>
<item name="adyen_hpp_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenHppConfigProvider</item>
<item name="adyen_boleto_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider</item>
<item name="adyen_pos_cloud_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider</item>
<item name="adyen_apple_pay_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider</item>
</argument>
</arguments>
</type>
......
......@@ -24,7 +24,7 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Adyen_Payment" setup_version="4.0.3">
<module name="Adyen_Payment" setup_version="4.1.0">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
......
<?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
/**
* @var \Magento\Payment\Block\Adminhtml\Transparent\Form $block
*/
$code = $block->escapeHtml($block->getMethodCode());
$currentCountry = $block->getInfoData('country');
?>
<fieldset class="admin__fieldset payment-method" id="payment_form_<?php /* @noEscape */ echo $code; ?>"
style="display:none">
<div class="field admin__field _required">
<label class="admin__field-label" for="<?php /* @noEscape */ echo $code; ?>_account_name">
<span><?php echo $block->escapeHtml(__('Bank account holder name')); ?></span>
</label>
<div class="admin__field-control">
<input type="text"
id="<?php /* @noEscape */ echo $code; ?>_account_name"
name="payment[account_name]"
title="<?php echo $block->escapeHtml(__('Bank account holder name')); ?>" class="admin__control-text"
value="<?php /* @noEscape */ echo $block->getInfoData('holder_name'); ?>"/>
</div>
</div>
<div class="field admin__field _required">
<label class="admin__field-label" for="<?php /* @noEscape */ echo $code; ?>_iban">
<span><?php echo $block->escapeHtml(__('IBAN')); ?></span>
</label>
<div class="admin__field-control">
<input type="text"
id="<?php /* @noEscape */ echo $code; ?>_account_name"
name="payment[iban]"
title="<?php echo $block->escapeHtml(__('IBAN')); ?>" class="admin__control-text"
value="<?php /* @noEscape */ echo $block->getInfoData('iban'); ?>"/>
</div>
</div>
<div class="field-type admin__field _required">
<label class="admin__field-label" for="<?php /* @noEscape */ echo $code; ?>_cc_type">
<span><?php echo $block->escapeHtml(__('country')); ?></span>
</label>
<div class="admin__field-control">
<select id="<?php /* @noEscape */ echo $code; ?>_cc_type" name="payment[country]"
class="required-entry admin__control-select">
<option value=""></option>
<?php foreach ($block->getCountries() as $countryCode => $countryName): ?>
<option value="<?php echo $block->escapeHtml($countryCode); ?>" <?php if ($countryCode == $currentCountry): ?>selected="selected"<?php endif ?>>
<?php echo $block->escapeHtml($countryName); ?>
</option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="field-type admin__field _required">
<div class="admin__field-control">
<input id="<?php /* @noEscape */ echo $code; ?>_accept_sepa"
name="payment[accept_sepa]"
type="checkbox"
title="<?php echo $block->escapeHtml(__('I agree that the above amount will be debited from my bank account.')); ?>"
class=""
value="<?php /* @noEscape */ echo $block->getInfoData('accept_sepa'); ?>"/>
<label class="admin__field-label" for="<?php /* @noEscape */ echo $code; ?>_accept_sepa">
<span><?php echo $block->escapeHtml(__('I agree that the above amount will be debited from my bank account.')); ?></span>
</label>
</div>
</div>
</fieldset>
......@@ -39,9 +39,9 @@ $_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 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 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;?>
......
......@@ -39,9 +39,9 @@ $_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 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 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;?>
......
......@@ -35,27 +35,120 @@
$_info = $this->getInfo();
$_isDemoMode = $block->isDemoMode();
?>
<?php if ($_pspReference = $_info->getAdditionalInformation('pspReference')):?>
<?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 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 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 endif; ?>
<?php if ($_brandCode = $_info->getAdditionalInformation('brand_code')):?>
<?php if ($_brandCode = $_info->getAdditionalInformation('brand_code')): ?>
<div><?php echo __('Payment Method: %1', $_brandCode); ?>
</div>
<?php endif;?>
<?php endif; ?>
<?php if (!empty($block->getBankTransferData())) : ?>
<?php
$banktranferData = $block->getBankTransferData();
$order = $block->getOrder();
?>
<div>
<table class="edit-order-table" style="text-align:left; margin-top:5px; margin-bottom:0;">
<tbody>
<?php if (!empty($order->getGrandTotal())) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('Amount')); ?></th>
<td><?php echo $order->formatPrice($order->getGrandTotal()); ?></td>
</tr>
<?php endif; ?>
<?php if (!empty($banktranferData['bankTransfer.reference'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('With reference')); ?></th>
<td><?php echo $banktranferData['bankTransfer.reference'] ?></td>
</tr>
<?php endif; ?>
<?php if (!empty($banktranferData['bankTransfer.owner'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('Beneficiary Name')); ?></th>
<td><?php echo $banktranferData['bankTransfer.owner'] ?></td>
</tr>
<?php endif; ?>
<?php if (!empty($banktranferData['bankTransfer.bankName'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('Bank')); ?></th>
<td><?php echo $banktranferData['bankTransfer.bankName'] ?></td>
</tr>
<?php endif; ?>
<?php if (!empty($banktranferData['bankTransfer.accountCode'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('Bankaccount')); ?></th>
<td><?php echo $banktranferData['bankTransfer.accountCode'] ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php elseif (!empty($block->getMultibancoData())) : ?>
<?php
$multibancoData = $block->getMultibancoData();
?>
<div>
<table class="edit-order-table" style="text-align:left; margin-top:5px; margin-bottom:0;">
<tbody>
<?php if (!empty($multibancoData['comprafacil.entity'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('Entity')); ?></th>
<td><?php echo $multibancoData['comprafacil.entity'] ?></td>
</tr>
<?php endif; ?>
<?php if (!empty($multibancoData['comprafacil.reference'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('Reference')); ?></th>
<td><?php echo $multibancoData['comprafacil.reference'] ?></td>
</tr>
<?php endif; ?>
<?php if (!empty($multibancoData['comprafacil.amount'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('Amount')); ?></th>
<td><?php echo $multibancoData['comprafacil.amount'] ?></td>
</tr>
<?php endif; ?>
<?php if (!empty($multibancoData['comprafacil.deadline'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('Deadline')); ?></th>
<td><?php echo $multibancoData['comprafacil.deadline'] ?><?php echo $block->escapeHtml(__('Days')); ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('adyen_total_fraud_score') != ""): ?>
<?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($block->getSplitPayments()): ?>
<?php if ($block->getSplitPayments()): ?>
<table class="edit-order-table">
<tr>
<th>PspReference</th>
......@@ -74,20 +167,20 @@ $_isDemoMode = $block->isDemoMode();
</table>
<?php endif; ?>
<?php if ($_specificInfo = $block->getSpecificInformation()):?>
<?php if ($_specificInfo = $block->getSpecificInformation()): ?>
<table class="data-table admin__table-secondary">
<?php foreach ($_specificInfo as $_label => $_value):?>
<?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>
<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 endif; ?>
<?php if ($ratepayDescriptor = $_info->getAdditionalInformation('adyen_ratepay_descriptor')):?>
<?php if ($ratepayDescriptor = $_info->getAdditionalInformation('adyen_ratepay_descriptor')): ?>
<div><?php echo __('Invoice Descriptor: %1', $ratepayDescriptor); ?>
</div>
<?php endif;?>
<?php endif; ?>
<?php echo $block->getChildHtml()?>
<?php echo $block->getChildHtml() ?>
......@@ -43,9 +43,9 @@ $_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 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 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;?>
......
......@@ -38,9 +38,9 @@ $_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 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 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;?>
......
This diff is collapsed.
......@@ -24,6 +24,6 @@
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<container name="root">
<block class="Adyen\Payment\Block\Redirect\Redirect" name="adyen-hpp-redirect-form" template="redirect/hpp/form.phtml" cacheable="false"/>
<block class="Adyen\Payment\Block\Redirect\Redirect" name="adyen-redirect-form" template="redirect/redirect.phtml" cacheable="false"/>
</container>
</layout>
\ No newline at end of file
This diff is collapsed.
......@@ -25,7 +25,7 @@
<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"/>
<block class="Adyen\Payment\Block\Checkout\Success" name="onepage.success.adyen_payment" template="checkout/success.phtml" cacheable="false"/>
</referenceContainer>
</body>
</page>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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