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 0a11f5c4 authored by rikterbeek's avatar rikterbeek

Make changes so it is compatible with magento 2.0.0 release

parent 0dc4ef11
File mode changed from 100644 to 100755
...@@ -25,7 +25,6 @@ namespace Adyen\Payment\Block\Form; ...@@ -25,7 +25,6 @@ namespace Adyen\Payment\Block\Form;
class Cc extends \Magento\Payment\Block\Form class Cc extends \Magento\Payment\Block\Form
{ {
private $logger;
/** /**
* @var string * @var string
*/ */
...@@ -41,18 +40,15 @@ class Cc extends \Magento\Payment\Block\Form ...@@ -41,18 +40,15 @@ class Cc extends \Magento\Payment\Block\Form
/** /**
* @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Payment\Model\Config $paymentConfig * @param \Magento\Payment\Model\Config $paymentConfig
* @param \Psr\Log\LoggerInterface $logger
* @param array $data * @param array $data
*/ */
public function __construct( public function __construct(
\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\View\Element\Template\Context $context,
\Magento\Payment\Model\Config $paymentConfig, \Magento\Payment\Model\Config $paymentConfig,
\Psr\Log\LoggerInterface $logger,
array $data = [] array $data = []
) { ) {
parent::__construct($context, $data); parent::__construct($context, $data);
$this->_paymentConfig = $paymentConfig; $this->_paymentConfig = $paymentConfig;
$this->logger = $logger;
} }
/** /**
......
<?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;
use Magento\Framework\View\Element\Template;
class AbstractInfo extends \Magento\Payment\Block\Info
{
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* Constructor
*
* @param Template\Context $context
* @param array $data
*/
public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper,
Template\Context $context,
array $data = []
)
{
parent::__construct($context, $data);
$this->_adyenHelper = $adyenHelper;
}
public function getAdyenPspReference()
{
return $this->getMethod()->getInfoInstance()->getAdyenPspReference();
}
public function isDemoMode()
{
$storeId = $this->getMethod()->getInfoInstance()->getOrder()->getStoreId();
return $this->_adyenHelper->getAdyenAbstractConfigDataFlag('demo_mode', $storeId);
}
}
\ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
namespace Adyen\Payment\Block\Info; namespace Adyen\Payment\Block\Info;
class Cc extends \Magento\Payment\Block\Info class Cc extends AbstractInfo
{ {
/** /**
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
namespace Adyen\Payment\Block\Info; namespace Adyen\Payment\Block\Info;
class Hpp extends \Magento\Payment\Block\Info class Hpp extends AbstractInfo
{ {
/** /**
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -58,12 +58,8 @@ class Cron extends \Magento\Framework\App\Action\Action ...@@ -58,12 +58,8 @@ class Cron extends \Magento\Framework\App\Action\Action
*/ */
public function execute() public function execute()
{ {
$cron = $this->_objectManager->create('Adyen\Payment\Model\Cron'); $cron = $this->_objectManager->create('Adyen\Payment\Model\Cron');
$cron->processNotification(); $cron->processNotification();
die();
} }
} }
\ No newline at end of file
...@@ -118,6 +118,8 @@ class Json extends \Magento\Framework\App\Action\Action ...@@ -118,6 +118,8 @@ class Json extends \Magento\Framework\App\Action\Action
*/ */
protected function _processNotification($response, $notificationMode) protected function _processNotification($response, $notificationMode)
{ {
// TODO: log the response
// validate the notification // validate the notification
if($this->authorised($response)) if($this->authorised($response))
{ {
...@@ -171,6 +173,8 @@ class Json extends \Magento\Framework\App\Action\Action ...@@ -171,6 +173,8 @@ class Json extends \Magento\Framework\App\Action\Action
throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage())); throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()));
} }
} }
} else {
return "401";
} }
} }
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -31,13 +31,6 @@ use Magento\Framework\App\Helper\AbstractHelper; ...@@ -31,13 +31,6 @@ use Magento\Framework\App\Helper\AbstractHelper;
class Data extends AbstractHelper class Data extends AbstractHelper
{ {
/**
* Core store config
*
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
protected $_scopeConfig;
/** /**
* @var \Magento\Framework\Encryption\EncryptorInterface * @var \Magento\Framework\Encryption\EncryptorInterface
*/ */
...@@ -49,12 +42,10 @@ class Data extends AbstractHelper ...@@ -49,12 +42,10 @@ class Data extends AbstractHelper
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\Helper\Context $context, \Magento\Framework\App\Helper\Context $context,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Framework\Encryption\EncryptorInterface $encryptor \Magento\Framework\Encryption\EncryptorInterface $encryptor
) )
{ {
parent::__construct($context); parent::__construct($context);
$this->_scopeConfig = $scopeConfig;
$this->_encryptor = $encryptor; $this->_encryptor = $encryptor;
} }
...@@ -371,9 +362,9 @@ class Data extends AbstractHelper ...@@ -371,9 +362,9 @@ class Data extends AbstractHelper
$path = 'payment/' . $paymentMethodCode . '/' . $field; $path = 'payment/' . $paymentMethodCode . '/' . $field;
if(!$flag) { if(!$flag) {
return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId); return $this->scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
} else { } else {
return $this->_scopeConfig->isSetFlag($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId); return $this->scopeConfig->isSetFlag($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
} }
} }
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -23,7 +23,9 @@ ...@@ -23,7 +23,9 @@
namespace Adyen\Payment\Model\Api; namespace Adyen\Payment\Model\Api;
class PaymentRequest extends \Magento\Framework\Object use Magento\Framework\DataObject;
class PaymentRequest extends DataObject
{ {
/** /**
* @var \Magento\Framework\App\Config\ScopeConfigInterface * @var \Magento\Framework\App\Config\ScopeConfigInterface
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -139,16 +139,19 @@ class Cron ...@@ -139,16 +139,19 @@ class Cron
} }
public function processNotification() public function test()
{ {
echo 'hier';
return;
}
public function processNotification()
{
$this->_order = null; $this->_order = null;
$this->_logger->info("START OF THE CRONJOB"); $this->_logger->info("START OF THE CRONJOB");
//fixme somehow the created_at is saved in my timzone //fixme somehow the created_at is saved in my timzone
$dateStart = new \DateTime(); $dateStart = new \DateTime();
// loop over notifications that are not processed and from 1 minute ago // loop over notifications that are not processed and from 1 minute ago
...@@ -157,22 +160,25 @@ class Cron ...@@ -157,22 +160,25 @@ class Cron
// excecute notifications from 2 minute or earlier because order could not yet been created by mangento // excecute notifications from 2 minute or earlier because order could not yet been created by mangento
$dateEnd = new \DateTime(); $dateEnd = new \DateTime();
$dateEnd->modify('-2 minute'); $dateEnd->modify('-1 minute');
$dateRange = ['from' => $dateStart, 'to' => $dateEnd, 'datetime' => true]; $dateRange = ['from' => $dateStart, 'to' => $dateEnd, 'datetime' => true];
$notifications = $this->_notificationFactory->create(); $notifications = $this->_notificationFactory->create();
$notifications->addFieldToFilter('done', 0); $notifications->addFieldToFilter('done', 0);
$notifications->addFieldToFilter('created_at', $dateRange); $notifications->addFieldToFilter('created_at', $dateRange);
foreach($notifications as $notification) { foreach($notifications as $notification) {
// get order // get order
$incrementId = $notification->getMerchantReference(); $incrementId = $notification->getMerchantReference();
$this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId); $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId);
if (!$this->_order->getId()) { if (!$this->_order->getId()) {
throw new Exception(sprintf('Wrong order ID: "%1".', $incrementId));
// order does not exists remove from queue
$notification->delete();
continue;
} }
// declare all variables that are needed // declare all variables that are needed
...@@ -186,6 +192,7 @@ class Cron ...@@ -186,6 +192,7 @@ class Cron
// set pspReference on payment object // set pspReference on payment object
$this->_order->getPayment()->setAdditionalInformation('pspReference', $this->_pspReference); $this->_order->getPayment()->setAdditionalInformation('pspReference', $this->_pspReference);
$this->_order->getPayment()->setAdyenPspReference($this->_pspReference);
// check if success is true of false // check if success is true of false
...@@ -196,24 +203,13 @@ class Cron ...@@ -196,24 +203,13 @@ class Cron
// if payment is API check, check if API result pspreference is the same as reference // if payment is API check, check if API result pspreference is the same as reference
if($this->_eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION && $this->_getPaymentMethodType() == 'api') { if($this->_eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION && $this->_getPaymentMethodType() == 'api') {
if($this->_pspReference == $this->_order->getPayment()->getAdditionalInformation('pspReference')) { // don't cancel the order becasue order was successfull through api
// don't cancel the order if previous state is authorisation with success=true $this->_debugData['_updateOrder warning'] = 'order is not cancelled because api result was succesfull';
if($previousAdyenEventCode != "AUTHORISATION : TRUE") {
$this->_holdCancelOrder(false);
} else {
//$this->_order->setAdyenEventCode($previousAdyenEventCode); // do not update the adyenEventCode
$this->_order->setData('adyen_notification_event_code', $previousAdyenEventCode);
$this->_debugData['_updateOrder warning'] = 'order is not cancelled because previous notification was a authorisation that succeeded';
}
} else {
$this->_debugData['_updateOrder warning'] = 'order is not cancelled because pspReference does not match with the order';
}
} else { } else {
// don't cancel the order if previous state is authorisation with success=true // don't cancel the order if previous state is authorisation with success=true
if($previousAdyenEventCode != "AUTHORISATION : TRUE") { if($previousAdyenEventCode != "AUTHORISATION : TRUE") {
$this->_holdCancelOrder(false); $this->_holdCancelOrder(false);
} else { } else {
// $this->_order->setAdyenEventCode($previousAdyenEventCode); // do not update the adyenEventCode
$this->_order->setData('adyen_notification_event_code', $previousAdyenEventCode); $this->_order->setData('adyen_notification_event_code', $previousAdyenEventCode);
$this->_debugData['_updateOrder warning'] = 'order is not cancelled because previous notification was a authorisation that succeeded'; $this->_debugData['_updateOrder warning'] = 'order is not cancelled because previous notification was a authorisation that succeeded';
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
namespace Adyen\Payment\Model\Method; namespace Adyen\Payment\Model\Method;
use Magento\Framework\Object; use Magento\Framework\DataObject;
use Magento\Payment\Model\Method\ConfigInterface; use Magento\Payment\Model\Method\ConfigInterface;
use Magento\Payment\Model\Method\Online\GatewayInterface; use Magento\Payment\Model\Method\Online\GatewayInterface;
/** /**
...@@ -52,14 +52,13 @@ class AdyenAbstract extends \Magento\Payment\Model\Method\AbstractMethod impleme ...@@ -52,14 +52,13 @@ class AdyenAbstract extends \Magento\Payment\Model\Method\AbstractMethod impleme
* @param Object $request * @param Object $request
* @param ConfigInterface $config * @param ConfigInterface $config
* *
* @return Object * @return DataObject
* *
* @throws \Exception * @throws \Exception
*/ */
public function postRequest(Object $request, ConfigInterface $config) public function postRequest(DataObject $request, ConfigInterface $config)
{ {
// Not needed only used for global configuration settings // Not needed only used for global configuration settings
} }
} }
\ No newline at end of file
...@@ -91,7 +91,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -91,7 +91,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc
* @param \Magento\Payment\Model\Method\Logger $logger * @param \Magento\Payment\Model\Method\Logger $logger
* @param \Magento\Framework\Module\ModuleListInterface $moduleList * @param \Magento\Framework\Module\ModuleListInterface $moduleList
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
* @param \Magento\Framework\Model\Resource\AbstractResource|null $resource * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
* @param array $data * @param array $data
* @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.ExcessiveParameterList)
...@@ -111,7 +111,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -111,7 +111,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc
\Magento\Payment\Model\Method\Logger $logger, \Magento\Payment\Model\Method\Logger $logger,
\Magento\Framework\Module\ModuleListInterface $moduleList, \Magento\Framework\Module\ModuleListInterface $moduleList,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
\Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = [] array $data = []
) { ) {
...@@ -144,10 +144,11 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -144,10 +144,11 @@ class Cc extends \Magento\Payment\Model\Method\Cc
/** /**
* Assign data to info model instance * Assign data to info model instance
* *
* @param \Magento\Framework\Object|mixed $data * @param \Magento\Framework\DataObject|mixed $data
* @return $this * @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/ */
public function assignData($data) public function assignData(\Magento\Framework\DataObject $data)
{ {
parent::assignData($data); parent::assignData($data);
$infoInstance = $this->getInfoInstance(); $infoInstance = $this->getInfoInstance();
...@@ -184,7 +185,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -184,7 +185,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc
return $this; return $this;
} }
protected function _processRequest(\Magento\Framework\Object $payment, $amount, $request) protected function _processRequest(\Magento\Sales\Model\Order\Payment $payment, $amount, $request)
{ {
switch ($request) { switch ($request) {
case "authorise": case "authorise":
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
namespace Adyen\Payment\Model\Method; namespace Adyen\Payment\Model\Method;
use Magento\Framework\Object; use Magento\Framework\DataObject;
use Magento\Payment\Model\Method\ConfigInterface; use Magento\Payment\Model\Method\ConfigInterface;
use Magento\Payment\Model\Method\Online\GatewayInterface; use Magento\Payment\Model\Method\Online\GatewayInterface;
...@@ -98,7 +98,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa ...@@ -98,7 +98,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
* @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Payment\Helper\Data $paymentData
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Payment\Model\Method\Logger $logger * @param \Magento\Payment\Model\Method\Logger $logger
* @param \Magento\Framework\Model\Resource\AbstractResource|null $resource * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
* @param array $data * @param array $data
* @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.ExcessiveParameterList)
...@@ -116,7 +116,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa ...@@ -116,7 +116,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
\Magento\Payment\Helper\Data $paymentData, \Magento\Payment\Helper\Data $paymentData,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Payment\Model\Method\Logger $logger, \Magento\Payment\Model\Method\Logger $logger,
\Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = [] array $data = []
) { ) {
...@@ -182,7 +182,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa ...@@ -182,7 +182,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
* *
* @throws \Exception * @throws \Exception
*/ */
public function postRequest(Object $request, ConfigInterface $config) public function postRequest(DataObject $request, ConfigInterface $config)
{ {
// Implement postRequest() method. // Implement postRequest() method.
} }
......
...@@ -54,7 +54,7 @@ class Notification extends \Magento\Framework\Model\AbstractModel ...@@ -54,7 +54,7 @@ class Notification extends \Magento\Framework\Model\AbstractModel
public function __construct( public function __construct(
\Magento\Framework\Model\Context $context, \Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry, \Magento\Framework\Registry $registry,
\Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = [] array $data = []
) { ) {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
namespace Adyen\Payment\Model\Resource; namespace Adyen\Payment\Model\Resource;
class Notification extends \Magento\Framework\Model\Resource\Db\AbstractDb class Notification extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{ {
public function _construct() public function _construct()
...@@ -40,13 +40,12 @@ class Notification extends \Magento\Framework\Model\Resource\Db\AbstractDb ...@@ -40,13 +40,12 @@ class Notification extends \Magento\Framework\Model\Resource\Db\AbstractDb
*/ */
public function getNotification($pspReference, $eventCode, $success) public function getNotification($pspReference, $eventCode, $success)
{ {
$adapter = $this->getReadConnection(); $select = $this->getConnection()->select()
$select = $adapter->select()
->from(['notification' => $this->getTable('adyen_notification')]) ->from(['notification' => $this->getTable('adyen_notification')])
->where('notification.pspreference=?', $pspReference) ->where('notification.pspreference=?', $pspReference)
->where('notification.event_code=?', $eventCode) ->where('notification.event_code=?', $eventCode)
->where('notification.success=?', $success); ->where('notification.success=?', $success);
return $adapter->fetchPairs($select); return $this->getConnection()->fetchAll($select);
} }
} }
\ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
namespace Adyen\Payment\Model\Resource\Notification; namespace Adyen\Payment\Model\Resource\Notification;
class Collection extends \Magento\Framework\Model\Resource\Db\Collection\AbstractCollection class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{ {
public function _construct() public function _construct()
{ {
......
File mode changed from 100644 to 100755
<?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\Setup;
use Magento\Framework\DB\Ddl\Table;
use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
/**
* Upgrade the Catalog module DB scheme
*/
class UpgradeSchema implements UpgradeSchemaInterface
{
/**
* {@inheritdoc}
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '1.0.0.1', '<')) {
$this->updateSchemaVersion1001($setup);
}
$setup->endSetup();
}
public function updateSchemaVersion1001($setup)
{
$connection = $setup->getConnection();
// Add column to indicate if last notification has success true or false
$adyenNotificationEventCodeSuccessColumn = [
'type' => Table::TYPE_BOOLEAN,
'length' => 1,
'nullable' => true,
'comment' => 'Adyen Notification event code success flag'
];
$connection->addColumn($setup->getTable('sales_order'), 'adyen_notification_event_code_success', $adyenNotificationEventCodeSuccessColumn);
// add column to order_payment to save Adyen PspReference
$pspReferenceColumn = [
'type' => Table::TYPE_TEXT,
'length' => 255,
'nullable' => true,
'comment' => 'Adyen PspReference of the payment'
];
$connection->addColumn($setup->getTable('sales_order_payment'), 'adyen_psp_reference', $pspReferenceColumn);
}
}
\ No newline at end of file
{
"name": "adyen/payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module",
"version": "1.0.0.1",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"require": {
"php": "~5.5.0|~5.6.0"
},
"autoload": {
"psr-4": { "Adyen\\Payment\\": "" },
"files": [ "registration.php" ]
}
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -27,5 +27,8 @@ ...@@ -27,5 +27,8 @@
<job name="adyen_payment_process_notification" instance="Adyen\Payment\Model\Cron" method="processNotification"> <job name="adyen_payment_process_notification" instance="Adyen\Payment\Model\Cron" method="processNotification">
<schedule>* * * * *</schedule> <schedule>* * * * *</schedule>
</job> </job>
<job name="adyen_test" instance="Adyen\Payment\Model\Cron" method="test">
<schedule>* * * * *</schedule>
</job>
</group> </group>
</config> </config>
\ No newline at end of file
File mode changed from 100644 to 100755
...@@ -23,11 +23,7 @@ ...@@ -23,11 +23,7 @@
*/ */
--> -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Adyen_Payment" setup_version="1.0.0">
<sequence> <module name="Adyen_Payment" setup_version="1.0.0.1">
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
<module name="Magento_Checkout"/>
</sequence>
</module> </module>
</config> </config>
\ No newline at end of file
<?php
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Adyen_Payment', __DIR__);
\ No newline at end of file
...@@ -31,13 +31,18 @@ ...@@ -31,13 +31,18 @@
?> ?>
<?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?> <?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?>
<?php $_info = $this->getInfo(); ?> <?php
<?php if ($_pspReference = $block->getPspReference()):?> $isDemoMode = $block->isDemoMode();
<div><?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($_info->getAdditionalInformation('pspReference')), $block->escapeHtml($_info->getAdditionalInformation('pspReference'))) ?> ?>
<?php if ($block->getAdyenPspReference()):?>
<?php if($isDemoMode): ?>
<div><?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($block->getAdyenPspReference())); ?>
<?php else: ?>
<div><?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($block->getAdyenPspReference())); ?>
<?php endif; ?>
</div> </div>
<?php endif;?> <?php endif;?>
<?php if ($_specificInfo = $block->getSpecificInformation()):?> <?php if ($_specificInfo = $block->getSpecificInformation()):?>
<table class="data-table admin__table-secondary"> <table class="data-table admin__table-secondary">
<?php foreach ($_specificInfo as $_label => $_value):?> <?php foreach ($_specificInfo as $_label => $_value):?>
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -56,11 +56,10 @@ define( ...@@ -56,11 +56,10 @@ define(
return this; return this;
}, },
initialize: function() { initialize: function() {
var self = this; var self = this;
this._super(); this._super();
// when creditCarNumber change call encrypt function // when creditCarNumber change call encrypt function
this.creditCardNumber.subscribe(function(value) { this.creditCardNumber.subscribe(function(value) {
self.calculateCseKey(); self.calculateCseKey();
...@@ -93,12 +92,12 @@ define( ...@@ -93,12 +92,12 @@ define(
getData: function() { getData: function() {
return { return {
'method': this.item.method, 'method': this.item.method,
'cc_type': this.creditCardType(),
'cc_exp_year': this.creditCardExpYear(),
'cc_exp_month': this.creditCardExpMonth(),
'cc_number': this.creditCardNumber(),
'cc_owner' : this.creditCardOwner(),
additional_data: { additional_data: {
'cc_type': this.creditCardType(),
'cc_exp_year': this.creditCardExpYear(),
'cc_exp_month': this.creditCardExpMonth(),
'cc_number': this.creditCardNumber(),
'cc_owner' : this.creditCardOwner(),
'cc_cid': this.creditCardVerificationNumber(), 'cc_cid': this.creditCardVerificationNumber(),
'cc_ss_start_month': this.creditCardSsStartMonth(), 'cc_ss_start_month': this.creditCardSsStartMonth(),
'cc_ss_start_year': this.creditCardSsStartYear(), 'cc_ss_start_year': this.creditCardSsStartYear(),
...@@ -123,7 +122,7 @@ define( ...@@ -123,7 +122,7 @@ define(
var cseInstance = adyen.encrypt.createEncryptedForm(cse_form, cse_key, cse_options); var cseInstance = adyen.encrypt.createEncryptedForm(cse_form, cse_key, cse_options);
// TODO needs to be done through php // TODO genreation time needs to be set through PHP in hidden field
var generation = new Date().toISOString(); var generation = new Date().toISOString();
var cardData = { var cardData = {
...@@ -139,7 +138,6 @@ define( ...@@ -139,7 +138,6 @@ define(
self.encryptedData(data); self.encryptedData(data);
var placeOrder = placeOrderAction(this.getData(), this.redirectAfterPlaceOrder); var placeOrder = placeOrderAction(this.getData(), this.redirectAfterPlaceOrder);
$.when(placeOrder).fail(function(){ $.when(placeOrder).fail(function(){
......
...@@ -276,3 +276,22 @@ ...@@ -276,3 +276,22 @@
</div> </div>
</div> </div>
<script type="text/javascript">
alert("DF");
</script>
<script>
require([
"jquery",
"mage/mage"
], function($){
alert("DF");
$(document).ready(function () {
'use strict';
var form = $( "#adyen-cc-form").attr('class');
alert(form);
});
});
</script>
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