Commit 9d8740c5 authored by rikterbeek's avatar rikterbeek

reomved unused index controller and added phpDocs

parent b3a741d5
......@@ -30,7 +30,7 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field
{
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
// TODO: make dynamic
// make this dynamic
//$configVer = $this->moduleList->getOne($moduleName)['setup_version'];
return (string) "0.1.0";
}
......
......@@ -41,6 +41,7 @@ class Cc extends \Magento\Payment\Block\Form
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Payment\Model\Config $paymentConfig
* @param \Psr\Log\LoggerInterface $logger
* @param array $data
*/
public function __construct(
......
......@@ -31,12 +31,4 @@ class Hpp extends \Magento\Payment\Block\Info
*/
protected $_template = 'Adyen_Payment::info/adyen_hpp.phtml';
/**
* @return string
*/
// public function toPdf()
// {
// $this->setTemplate('Magento_OfflinePayments::info/pdf/checkmo.phtml');
// return $this->toHtml();
// }
}
......@@ -34,13 +34,16 @@ class Redirect extends \Magento\Payment\Block\Form
*/
protected $_checkoutSession;
/**
* @var \Magento\Checkout\Model\Order
*/
protected $_order;
/**
* Constructor
*
* @param \\Magento\Framework\View\Element\Template\Context $context
* @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,
......
......@@ -34,13 +34,16 @@ class Validate3d extends \Magento\Payment\Block\Form
*/
protected $_checkoutSession;
/**
* @var \Magento\Checkout\Model\Order
*/
protected $_order;
/**
* Constructor
*
* @param \\Magento\Framework\View\Element\Template\Context $context
* @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,
......
<?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\Controller\Index;
class Index extends \Magento\Framework\App\Action\Action
{
public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager)
{
$this->_objectManager = $objectManager;
}
public function execute()
{
echo 'test';die();
$this->_view->loadLayout();
$this->_view->getLayout()->initMessages();
$this->_view->renderLayout();
}
}
\ No newline at end of file
......@@ -32,7 +32,6 @@ use Symfony\Component\Config\Definition\Exception\Exception;
class Cron extends \Magento\Framework\App\Action\Action
{
/**
* @var \Magento\Framework\ObjectManagerInterface
*/
......@@ -43,7 +42,6 @@ class Cron extends \Magento\Framework\App\Action\Action
*/
protected $_resultFactory;
/**
* @param \Magento\Framework\App\Action\Context $context
*/
......
......@@ -45,8 +45,10 @@ class Json extends \Magento\Framework\App\Action\Action
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
......
......@@ -31,25 +31,15 @@ class Redirect extends \Magento\Framework\App\Action\Action
*/
protected $_quote = false;
/**
* @var \Magento\Checkout\Model\Session
*/
protected $_checkoutSession;
protected $checkoutFactory;
/**
* @var \Magento\Customer\Model\Session
* @var \Magento\Sales\Model\Order
*/
protected $_customerSession;
protected $_order;
/**
......@@ -60,14 +50,11 @@ class Redirect extends \Magento\Framework\App\Action\Action
/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Customer\Model\Session $customerSession
*/
public function __construct(
\Magento\Framework\App\Action\Context $context
// \Magento\Customer\Model\Session $customerSession
) {
parent::__construct($context);
// $this->_customerSession = $customerSession;
}
......@@ -83,69 +70,9 @@ class Redirect extends \Magento\Framework\App\Action\Action
public function execute()
{
// $session->clearQuote();
$this->_view->loadLayout();
$this->_view->getLayout()->initMessages();
$this->_view->renderLayout();
// \Magento\Quote\Model\QuoteManagement $quoteManagement
//$this->_checkout->place($this->_initToken());
// $order = $this->quoteManagement->submit($this->_quote);
// $orderId = $this->_getCheckout()->getLastOrderId();
//
// $order = $this->_getOrder();
//
// $payment = $order->getPayment()->getMethodInstance();
//
// echo $payment->getCode();die();
//
//
//echo $order->getId();
// die();
//
// $quote->collectTotals();
//
//// print_r($quote->getPayment());die();
//
// //$this->_quote->collectTotals();
//// $order = $this->quoteManagement->submit($this->_quote);
////\Magento\Quote\Model\QuoteManagement $quoteManagement
//
//// $this->_getQuoteManagement()->submit($quote);
//
//
////echo 'test';
//// print_r($this->_getQuote()->getBillingAddress()->getFirstname());die();
//
//// echo $quote->getBillingAddress()->getFirstname();
////// echo $quote->getShippingAddress()->getFirstname();
//// die();
//
// $this->_getQuoteManagement()->placeOrder($quote->getId());
//
// // $this->cartManagement->placeOrder($this->_getCheckout()->getQuote()->getId());
//
//
//// $this->getOrder();
//
//// echo $quote->getId();
//// echo 'hier;';die();
//// $this->_quote->collectTotals();
////
////echo 'hier';die();
// $url = "http://www.google.com";
// $this->getResponse()->setRedirect($url);
// return;
// $this->_view->loadLayout();
// $this->_view->getLayout()->initMessages();
// $this->_view->renderLayout();
}
/**
......
......@@ -28,11 +28,19 @@ use Magento\Customer\Api\CustomerRepositoryInterface;
class Result extends \Magento\Framework\App\Action\Action
{
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @var \Magento\Sales\Model\OrderFactory
*/
protected $_orderFactory;
/**
* @var \Magento\Sales\Model\Order
*/
protected $_order;
/**
......@@ -40,13 +48,17 @@ class Result extends \Magento\Framework\App\Action\Action
*/
protected $_orderHistoryFactory;
/**
* @var \Magento\Checkout\Model\Session
*/
protected $_session;
/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Customer\Model\Session $customerSession
* @param CustomerRepositoryInterface $customerRepository
* @param AccountManagementInterface $accountManagement
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Sales\Model\OrderFactory $orderFactory
* @param \Magento\Sales\Model\Order\Status\HistoryFactory $orderHistoryFactory
* @param \Magento\Checkout\Model\Session $session
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
......
......@@ -30,15 +30,25 @@ class Validate3d extends \Magento\Framework\App\Action\Action
*/
protected $_orderFactory;
/**
* @var \Magento\Sales\Model\Order
*/
protected $_order;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
protected $_adyenLogger;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Customer\Model\Session $customerSession
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
......@@ -52,7 +62,6 @@ class Validate3d extends \Magento\Framework\App\Action\Action
public function execute()
{
$this->_adyenLogger->critical("IN Execute validate3d:");
// check if 3d is active
$order = $this->_getOrder();
......@@ -62,9 +71,12 @@ class Validate3d extends \Magento\Framework\App\Action\Action
// check if 3D secure is active. If not just go to success page
if($active) {
$this->_adyenLogger->info("3D secure is active");
// check if it is already processed
if ($this->getRequest()->isPost()) {
$this->_adyenLogger->info("Process 3D secure payment");
$requestMD = $this->getRequest()->getPost('MD');
$requestPaRes = $this->getRequest()->getPost('PaRes');
......@@ -89,6 +101,7 @@ class Validate3d extends \Magento\Framework\App\Action\Action
}
}
} else {
$this->_adyenLogger->info("Customer was redirected to bank for 3D-secure validation.");
$order->addStatusHistoryComment(__('Customer was redirected to bank for 3D-secure validation.'))->save();
$this->_view->loadLayout();
......
......@@ -38,6 +38,9 @@ class Data extends AbstractHelper
*/
protected $_scopeConfig;
/**
* @var \Magento\Framework\Encryption\EncryptorInterface
*/
protected $_encryptor;
......@@ -56,6 +59,10 @@ class Data extends AbstractHelper
}
/**
* @desc return recurring types for configuration setting
* @return array
*/
public function getRecurringTypes() {
return [
......@@ -65,6 +72,10 @@ class Data extends AbstractHelper
];
}
/**
* @desc return recurring types for configuration setting
* @return array
*/
public function getModes() {
return [
'1' => 'Test Mode',
......@@ -72,6 +83,10 @@ class Data extends AbstractHelper
];
}
/**
* @desc return recurring types for configuration setting
* @return array
*/
public function getCaptureModes() {
return [
'auto' => 'immediate',
......@@ -79,6 +94,10 @@ class Data extends AbstractHelper
];
}
/**
* @desc return recurring types for configuration setting
* @return array
*/
public function getPaymentRoutines() {
return [
'single' => 'Single Page Payment Routine',
......@@ -86,6 +105,7 @@ class Data extends AbstractHelper
];
}
/**
* Return the formatted currency. Adyen accepts the currency in multiple formats.
* @param $amount
......@@ -172,36 +192,76 @@ class Data extends AbstractHelper
}
/**
* @desc gives back global configuration values
* @param $field
* @param null $storeId
* @return mixed
*/
public function getAdyenAbstractConfigData($field, $storeId = null)
{
return $this->getConfigData($field, 'adyen_abstract', $storeId);
}
/**
* @desc gives back global configuration values as boolean
* @param $field
* @param null $storeId
* @return mixed
*/
public function getAdyenAbstractConfigDataFlag($field, $storeId = null)
{
return $this->getConfigData($field, 'adyen_abstract', $storeId, true);
}
/**
* @desc Gives back adyen_cc configuration values
* @param $field
* @param null $storeId
* @return mixed
*/
public function getAdyenCcConfigData($field, $storeId = null)
{
return $this->getConfigData($field, 'adyen_cc', $storeId);
}
/**
* @desc Gives back adyen_cc configuration values as flag
* @param $field
* @param null $storeId
* @return mixed
*/
public function getAdyenCcConfigDataFlag($field, $storeId = null)
{
return $this->getConfigData($field, 'adyen_cc', $storeId, true);
}
/**
* @desc Gives back adyen_hpp configuration values
* @param $field
* @param null $storeId
* @return mixed
*/
public function getAdyenHppConfigData($field, $storeId = null)
{
return $this->getConfigData($field, 'adyen_hpp', $storeId);
}
/**
* @desc Gives back adyen_hpp configuration values as flag
* @param $field
* @param null $storeId
* @return mixed
*/
public function getAdyenHppConfigDataFlag($field, $storeId = null)
{
return $this->getConfigData($field, 'adyen_hpp', $storeId, true);
}
/**
* @desc Retrieve decrypted hmac key
* @return string
*/
public function getHmac()
{
switch ($this->isDemoMode()) {
......@@ -215,16 +275,70 @@ class Data extends AbstractHelper
return $secretWord;
}
/**
* @desc Check if configuration is set to demo mode
* @return mixed
*/
public function isDemoMode()
{
return $this->getAdyenAbstractConfigDataFlag('demo_mode');
}
/**
* @desc Retrieve the decrypted notification password
* @return string
*/
public function getNotificationPassword()
{
return $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('notification_password')));
}
/**
* @desc Retrieve the webserver username
* @return string
*/
public function getWsUsername()
{
if($this->isDemoMode()) {
$wsUsername = trim($this->getAdyenAbstractConfigData('ws_username_test'));
} else {
$wsUsername = trim($this->getAdyenAbstractConfigData('ws_username_live'));
}
return $wsUsername;
}
/**
* @desc Retrieve the webserver password
* @return string
*/
public function getWsPassword()
{
if($this->isDemoMode()) {
$wsPassword = $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('ws_password_test')));
} else {
$wsPassword = $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('ws_password_live')));
}
return $wsPassword;
}
/**
* @desc Retrieve the webserver url defined in the config.xlm only
* @return string
*/
public function getWsUrl()
{
if($this->isDemoMode()) {
$url = $this->getAdyenAbstractConfigData('ws_url_test');
} else {
$url = $this->getAdyenAbstractConfigData('ws_url_live');
}
return $url;
}
/**
* @desc Cancels the order
* @param $order
*/
public function cancelOrder($order)
{
$orderStatus = $this->getAdyenAbstractConfigData('payment_cancelled');
......@@ -245,12 +359,12 @@ class Data extends AbstractHelper
}
/**
* Retrieve information from payment configuration
*
* @param string $field
* @param int|string|null|\Magento\Store\Model\Store $storeId
*
* @return mixed
* @desc Retrieve information from payment configuration
* @param $field
* @param $paymentMethodCode
* @param $storeId
* @param bool|false $flag
* @return bool|mixed
*/
public function getConfigData($field, $paymentMethodCode, $storeId, $flag = false)
{
......
......@@ -51,12 +51,15 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider
*/
protected $paymentHelper;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $adyenHelper;
/**
* @param CcConfig $ccConfig
* @param \Magento\Payment\Model\CcConfig $ccConfig
* @param PaymentHelper $paymentHelper
* @param array $methodCodes
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Magento\Payment\Model\CcConfig $ccConfig,
......
......@@ -25,43 +25,52 @@ namespace Adyen\Payment\Model\Api;
class PaymentRequest extends \Magento\Framework\Object
{
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
protected $_scopeConfig;
protected $_code;
/**
* @var \Psr\Log\LoggerInterface
*/
protected $_logger;
/**
* @var \Magento\Framework\Encryption\EncryptorInterface
*/
protected $_encryptor;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
protected $_adyenLogger;
/**
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param array $data
*/
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
array $data = []
) {
$this->_scopeConfig = $scopeConfig;
$this->_logger = $logger;
$this->_encryptor = $encryptor;
$this->_code = "adyen_cc";
$this->_adyenHelper = $adyenHelper;
}
/**
* Retrieve information from payment configuration
*
* @param string $field
* @param int|string|null|\Magento\Store\Model\Store $storeId
*
* @return mixed
*/
public function getConfigData($field, $paymentMethodCode = "adyen_abstract", $storeId = null)
{
if (null === $storeId) {
$storeId = $this->getStore();
}
// $this->_code to get current methodcode
$path = 'payment/' . $paymentMethodCode . '/' . $field;
return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
$this->_adyenLogger = $adyenLogger;
}
public function fullApiRequest($payment)
......@@ -71,7 +80,7 @@ class PaymentRequest extends \Magento\Framework\Object
$customerEmail = $order->getCustomerEmail();
$shopperIp = $order->getRemoteIp();
$orderCurrencyCode = $order->getOrderCurrencyCode();
$merchantAccount = $this->getConfigData("merchant_account");
$merchantAccount = $this->_adyenHelper->getAdyenAbstractConfigData("merchant_account");
$request = array(
"action" => "Payment.authorise",
......@@ -118,9 +127,8 @@ class PaymentRequest extends \Magento\Framework\Object
}
// TODO get CSE setting
$cseEnabled = true;
if($cseEnabled) {
// If cse is enabled add encrypted card date into request
if($this->_adyenHelper->getAdyenCcConfigDataFlag('cse_enabled')) {
$request['paymentRequest.additionalData.card.encrypted.json'] = $payment->getAdditionalInformation("encrypted_data");
} else {
$requestCreditCardDetails = array("paymentRequest.card.expiryMonth" => $payment->getCcExpMonth(),
......@@ -137,17 +145,13 @@ class PaymentRequest extends \Magento\Framework\Object
protected function _apiRequest($request)
{
// log the request
$this->_adyenLogger->info('The request to adyen: ' . print_r($request, true));
// Use test or live credentials depends on demo mode
if($this->_adyenHelper->isDemoMode()) {
$webserviceUsername = $this->getConfigData("ws_username_test");
$webservicePassword = $this->decryptPassword($this->getConfigData("ws_password_test"));
$url = "https://pal-test.adyen.com/pal/adapter/httppost";
} else {
$webserviceUsername = $this->getConfigData("ws_username_live");
$webservicePassword = $this->decryptPassword($this->getConfigData("ws_password_live"));
$url = "https://pal-live.adyen.com/pal/adapter/httppost";
}
$webserviceUsername = $this->_adyenHelper->getWsUsername();
$webservicePassword = $this->_adyenHelper->getWsPassword();
$url = $this->_adyenHelper->getWsUrl();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
......@@ -169,16 +173,20 @@ class PaymentRequest extends \Magento\Framework\Object
throw new \Magento\Framework\Exception\LocalizedException(__('HTTP Status code' . $results));
}
parse_str($results, $results);
parse_str($results, $resultArr);
curl_close($ch);
return $results;
// log the result
$this->_adyenLogger->info('The response to adyen: ' . print_r($resultArr, true));
return $resultArr;
}
public function authorise3d($payment)
{
$order = $payment->getOrder();
$merchantAccount = $this->getConfigData("merchant_account");
$merchantAccount = $this->_adyenHelper->getAdyenAbstractConfigData("merchant_account");
$shopperIp = $order->getRemoteIp();
$md = $payment->getAdditionalInformation('md');
......
......@@ -31,12 +31,15 @@ class CaptureMode implements \Magento\Framework\Option\ArrayInterface
*/
protected $_orderConfig;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @param \Magento\Sales\Model\Order\Config $orderConfig
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Magento\Sales\Model\Order\Config $orderConfig,
......
......@@ -31,12 +31,14 @@ class DemoMode implements \Magento\Framework\Option\ArrayInterface
*/
protected $_orderConfig;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @param \Magento\Sales\Model\Order\Config $orderConfig
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Magento\Sales\Model\Order\Config $orderConfig,
......
......@@ -31,12 +31,14 @@ class PaymentRoutine implements \Magento\Framework\Option\ArrayInterface
*/
protected $_orderConfig;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @param \Magento\Sales\Model\Order\Config $orderConfig
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Magento\Sales\Model\Order\Config $orderConfig,
......
......@@ -32,12 +32,14 @@ class RecurringType implements \Magento\Framework\Option\ArrayInterface
*/
protected $_orderConfig;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @param \Magento\Sales\Model\Order\Config $orderConfig
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Magento\Sales\Model\Order\Config $orderConfig,
......
......@@ -34,10 +34,19 @@ class Cron
*/
protected $_logger;
/**
* @var Resource\Notification\CollectionFactory
*/
protected $_notificationFactory;
/**
* @var \Magento\Framework\Stdlib\DateTime
*/
protected $_datetime;
/**
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
*/
protected $_localeDate;
/**
......@@ -57,6 +66,9 @@ class Cron
*/
protected $_scopeConfig;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
......@@ -69,8 +81,9 @@ class Cron
*/
protected $_transactionFactory;
// notification attributes
/**
* notification attributes
*/
protected $_pspReference;
protected $_merchantReference;
protected $_eventCode;
......@@ -91,10 +104,16 @@ class Cron
*/
protected $_debugData = array();
/**
* Constructor
* @param \Adyen\Payment\Logger\Logger $logger
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param Resource\Notification\CollectionFactory $notificationFactory
* @param \Magento\Sales\Model\OrderFactory $orderFactory
* @param \Magento\Framework\Stdlib\DateTime $dateTime
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param OrderSender $orderSender
* @param \Magento\Framework\DB\TransactionFactory $transactionFactory
*/
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
......
......@@ -38,6 +38,10 @@ class AdyenAbstract extends \Magento\Payment\Model\Method\AbstractMethod impleme
* @var string
*/
protected $_code = self::METHOD_CODE;
/**
* @var bool
*/
protected $_isGateway = false;
protected $_canAuthorize = false;
protected $_isInitializeNeeded = false;
......
......@@ -49,16 +49,16 @@ class Cc extends \Magento\Payment\Model\Method\Cc
* @var string
*/
protected $_formBlockType = 'Adyen\Payment\Block\Form\Cc';
protected $_infoBlockType = 'Adyen\Payment\Block\Info\Cc';
//
// /**
// * @var string
// */
// protected $_infoBlockType = 'Adyen\Payment\Block\Info\Cc';
/**
* @var \Adyen\Payment\Model\Api\PaymentRequest
*/
protected $_paymentRequest;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
protected $_adyenLogger;
/**
......@@ -66,22 +66,33 @@ class Cc extends \Magento\Payment\Model\Method\Cc
*/
protected $_checkoutSession;
/**
* @var \Magento\Framework\UrlInterface
*/
protected $_urlBuilder;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
* @param \Magento\Payment\Helper\Data $paymentData
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Payment\Model\Method\Logger $logger
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param \Magento\Framework\Model\Resource\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
* @param array $data
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
......@@ -141,7 +152,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc
parent::assignData($data);
$infoInstance = $this->getInfoInstance();
if($this->_adyenHelper->getAdyenAbstractConfigDataFlag('cse_enabled')) {
if($this->_adyenHelper->getAdyenCcConfigDataFlag('cse_enabled')) {
if(isset($data['encrypted_data'])) {
$infoInstance->setAdditionalInformation('encrypted_data', $data['encrypted_data']);
} else {
......@@ -183,7 +194,6 @@ class Cc extends \Magento\Payment\Model\Method\Cc
protected function _processResponse(\Magento\Payment\Model\InfoInterface $payment, $response)
{
$payment->setAdditionalInformation('3dActive', false);
switch ($response['paymentResult_resultCode']) {
......@@ -193,18 +203,19 @@ class Cc extends \Magento\Payment\Model\Method\Cc
$payment->setAdditionalInformation('pspReference', $response['paymentResult_pspReference']);
break;
case "RedirectShopper":
// 3d is active so set the param to true checked in Controller/Validate3d
$payment->setAdditionalInformation('3dActive', true);
$IssuerUrl = $response['paymentResult_issuerUrl'];
$issuerUrl = $response['paymentResult_issuerUrl'];
$PaReq = $response['paymentResult_paRequest'];
$MD = $response['paymentResult_md'];
$payment->setAdditionalInformation('issuerUrl', $response['paymentResult_issuerUrl']);
$payment->setAdditionalInformation('paRequest', $response['paymentResult_paRequest']);
$payment->setAdditionalInformation('md', $response['paymentResult_md']);
$result = $this->getResponse();
$md = $response['paymentResult_md'];
if(!empty($PaReq) && !empty($md) && !empty($issuerUrl)) {
$payment->setAdditionalInformation('issuerUrl', $response['paymentResult_issuerUrl']);
$payment->setAdditionalInformation('paRequest', $response['paymentResult_paRequest']);
$payment->setAdditionalInformation('md', $response['paymentResult_md']);
} else {
throw new \Magento\Framework\Exception\LocalizedException(__('3D secure is not valid'));
}
break;
case "Refused":
// paymentResult_refusalReason
......
......@@ -59,6 +59,9 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
protected $_canAuthorize = true;
protected $_isInitializeNeeded = true;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
......@@ -67,6 +70,9 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
*/
protected $storeManager;
/**
* @var \Magento\Framework\UrlInterface
*/
protected $_urlBuilder;
/**
......@@ -74,17 +80,20 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
*/
protected $resolver;
/**
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\Locale\ResolverInterface $resolver
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
* @param \Magento\Payment\Helper\Data $paymentData
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param Logger $logger
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param \Magento\Payment\Model\Method\Logger $logger
* @param \Magento\Framework\Model\Resource\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
* @param array $data
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
......
......@@ -30,6 +30,7 @@ class Notification extends \Magento\Framework\Model\AbstractModel
implements NotificationInterface
{
const AUTHORISATION = 'AUTHORISATION';
const PENDING = 'PENDING';
const AUTHORISED = 'AUTHORISED';
......
......@@ -25,6 +25,7 @@ namespace Adyen\Payment\Model\Resource;
class Notification extends \Magento\Framework\Model\Resource\Db\AbstractDb
{
public function _construct()
{
$this->_init('adyen_notification', 'entity_id');
......
......@@ -33,6 +33,8 @@
<demo_mode>0</demo_mode>
<debug>1</debug>
<group>adyen</group>
<ws_url_test>https://pal-test.adyen.com/pal/adapter/httppost</ws_url_test>
<ws_url_live>https://pal-live.adyen.com/pal/adapter/httppost</ws_url_live>
</adyen_abstract>
<adyen_cc>
<active>1</active>
......@@ -43,6 +45,7 @@
<cctypes>AE,VI,MC,DI</cctypes>
<useccv>1</useccv>
<cse_enabled>1</cse_enabled>
<payment_action>authorize</payment_action>
<group>adyen</group>
</adyen_cc>
<adyen_hpp>
......@@ -57,7 +60,6 @@
<sort_order>10</sort_order>
<place_order_url>adyen/process/redirect</place_order_url>
<order_place_redirect_url>adyen/process/redirect</order_place_redirect_url>
<payment_action>authorize</payment_action>
<group>adyen</group>
</adyen_hpp>
</payment>
......
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