Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Adyen Magento2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared Libs
Adyen Magento2
Commits
10df523c
Commit
10df523c
authored
Jan 22, 2018
by
Rik ter Beek
Committed by
GitHub
Jan 22, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #242 from Adyen/pw-364
Remove Cron controller should not be accessable from browser,
parents
48fbfd7a
f7f6fbde
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
66 additions
and
105 deletions
+66
-105
Block/Info/AbstractInfo.php
Block/Info/AbstractInfo.php
+3
-3
Controller/Process/Cron.php
Controller/Process/Cron.php
+0
-62
Controller/Process/Json.php
Controller/Process/Json.php
+29
-11
Gateway/Request/RefundDataBuilder.php
Gateway/Request/RefundDataBuilder.php
+3
-3
Helper/Data.php
Helper/Data.php
+9
-4
Model/Cron.php
Model/Cron.php
+9
-9
Model/Method/Adapter.php
Model/Method/Adapter.php
+1
-1
Model/Notification.php
Model/Notification.php
+1
-1
Model/Order/Payment.php
Model/Order/Payment.php
+1
-1
Model/ResourceModel/Billing/Agreement.php
Model/ResourceModel/Billing/Agreement.php
+1
-1
Model/ResourceModel/Billing/Agreement/Collection.php
Model/ResourceModel/Billing/Agreement/Collection.php
+1
-1
Model/ResourceModel/Notification.php
Model/ResourceModel/Notification.php
+1
-1
Model/ResourceModel/Notification/Collection.php
Model/ResourceModel/Notification/Collection.php
+2
-2
Model/ResourceModel/Order/Payment.php
Model/ResourceModel/Order/Payment.php
+1
-1
Model/ResourceModel/Order/Payment/Collection.php
Model/ResourceModel/Order/Payment/Collection.php
+2
-2
Test/Unit/Helper/DataTest.php
Test/Unit/Helper/DataTest.php
+2
-2
No files found.
Block/Info/AbstractInfo.php
View file @
10df523c
...
...
@@ -34,7 +34,7 @@ class AbstractInfo extends \Magento\Payment\Block\Info
protected
$_adyenHelper
;
/**
* @var \Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory
* @var \Adyen\Payment\Model\Resource
Model
\Order\Payment\CollectionFactory
*/
protected
$_adyenOrderPaymentCollectionFactory
;
...
...
@@ -42,13 +42,13 @@ class AbstractInfo extends \Magento\Payment\Block\Info
* AbstractInfo constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory $adyenOrderPaymentCollectionFactory
* @param \Adyen\Payment\Model\Resource
Model
\Order\Payment\CollectionFactory $adyenOrderPaymentCollectionFactory
* @param Template\Context $context
* @param array $data
*/
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory
$adyenOrderPaymentCollectionFactory
,
\Adyen\Payment\Model\Resource
Model
\Order\Payment\CollectionFactory
$adyenOrderPaymentCollectionFactory
,
Template\Context
$context
,
array
$data
=
[]
)
...
...
Controller/Process/Cron.php
deleted
100644 → 0
View file @
48fbfd7a
<?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\Process
;
use
Symfony\Component\Config\Definition\Exception\Exception
;
/**
* Class Json
* @package Adyen\Payment\Controller\Process
*/
class
Cron
extends
\Magento\Framework\App\Action\Action
{
/**
* @var \Magento\Framework\ObjectManagerInterface
*/
protected
$_objectManager
;
/**
* @var \Magento\Framework\Controller\Result\RawFactory
*/
protected
$_resultFactory
;
/**
* Cron constructor.
*
* @param \Magento\Framework\App\Action\Context $context
*/
public
function
__construct
(
\Magento\Framework\App\Action\Context
$context
)
{
parent
::
__construct
(
$context
);
$this
->
_objectManager
=
$context
->
getObjectManager
();
$this
->
_resultFactory
=
$context
->
getResultFactory
();
}
/**
* Process Notification from Cron
*/
public
function
execute
()
{
$cron
=
$this
->
_objectManager
->
create
(
'Adyen\Payment\Model\Cron'
);
$cron
->
processNotification
();
die
();
}
}
\ No newline at end of file
Controller/Process/Json.php
View file @
10df523c
...
...
@@ -62,7 +62,8 @@ class Json extends \Magento\Framework\App\Action\Action
\Magento\Framework\App\Action\Context
$context
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
)
{
)
{
parent
::
__construct
(
$context
);
$this
->
_objectManager
=
$context
->
getObjectManager
();
$this
->
_resultFactory
=
$context
->
getResultFactory
();
...
...
@@ -100,6 +101,8 @@ class Json extends \Magento\Framework\App\Action\Action
if
(
$notificationMode
!=
""
&&
$this
->
_validateNotificationMode
(
$notificationMode
))
{
foreach
(
$notificationItems
[
'notificationItems'
]
as
$notificationItem
)
{
$status
=
$this
->
_processNotification
(
$notificationItem
[
'NotificationRequestItem'
],
$notificationMode
);
...
...
@@ -108,9 +111,10 @@ class Json extends \Magento\Framework\App\Action\Action
$this
->
_return401
();
return
;
}
}
$acceptedMessage
=
"[accepted]"
;
$acceptedMessage
=
"[accepted]"
;
}
$cronCheckTest
=
$notificationItems
[
'notificationItems'
][
0
][
'NotificationRequestItem'
][
'pspReference'
];
// Run the query for checking unprocessed notifications, do this only for test notifications coming from the Adyen Customer Area
...
...
@@ -247,8 +251,7 @@ class Json extends \Magento\Framework\App\Action\Action
if
(
empty
(
$submitedMerchantAccount
)
&&
empty
(
$internalMerchantAccount
))
{
if
(
$this
->
_isTestNotification
(
$response
[
'pspReference'
]))
{
echo
'merchantAccountCode is empty in magento settings'
;
exit
();
$this
->
_returnResult
(
'merchantAccountCode is empty in magento settings'
);
}
return
false
;
}
...
...
@@ -256,8 +259,9 @@ class Json extends \Magento\Framework\App\Action\Action
// validate username and password
if
((
!
isset
(
$_SERVER
[
'PHP_AUTH_USER'
])
&&
!
isset
(
$_SERVER
[
'PHP_AUTH_PW'
])))
{
if
(
$this
->
_isTestNotification
(
$response
[
'pspReference'
]))
{
echo
'Authentication failed: PHP_AUTH_USER and PHP_AUTH_PW are empty. See Adyen Magento manual CGI mode'
;
exit
();
$this
->
_returnResult
(
'Authentication failed: PHP_AUTH_USER and PHP_AUTH_PW are empty. See Adyen Magento manual CGI mode'
);
}
return
false
;
}
...
...
@@ -275,11 +279,11 @@ class Json extends \Magento\Framework\App\Action\Action
// If notification is test check if fields are correct if not return error
if
(
$this
->
_isTestNotification
(
$response
[
'pspReference'
]))
{
if
(
$accountCmp
!=
0
)
{
echo
'MerchantAccount in notification is not the same as in Magento settings'
;
exit
();
$this
->
_returnResult
(
'MerchantAccount in notification is not the same as in Magento settings'
);
}
elseif
(
$usernameCmp
!=
0
||
$passwordCmp
!=
0
)
{
echo
'username (PHP_AUTH_USER) and\or password (PHP_AUTH_PW) are not the same as Magento settings'
;
exit
();
$this
->
_returnResult
(
'username (PHP_AUTH_USER) and\or password (PHP_AUTH_PW) are not the same as Magento settings'
);
}
}
return
false
;
...
...
@@ -356,4 +360,18 @@ class Json extends \Magento\Framework\App\Action\Action
return
false
;
}
}
/**
* Returns the message to the browser
*
* @param $message
*/
protected
function
_returnResult
(
$message
)
{
$this
->
getResponse
()
->
clearHeader
(
'Content-Type'
)
->
setHeader
(
'Content-Type'
,
'text/html'
)
->
setBody
(
$message
);
return
;
}
}
\ No newline at end of file
Gateway/Request/RefundDataBuilder.php
View file @
10df523c
...
...
@@ -37,18 +37,18 @@ class RefundDataBuilder implements BuilderInterface
private
$adyenHelper
;
/**
* @var \Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory
* @var \Adyen\Payment\Model\Resource
Model
\Order\Payment\CollectionFactory
*/
private
$orderPaymentCollectionFactory
;
/**
* RefundDataBuilder constructor.
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory $orderPaymentCollectionFactory
* @param \Adyen\Payment\Model\Resource
Model
\Order\Payment\CollectionFactory $orderPaymentCollectionFactory
*/
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory
$orderPaymentCollectionFactory
\Adyen\Payment\Model\Resource
Model
\Order\Payment\CollectionFactory
$orderPaymentCollectionFactory
)
{
$this
->
adyenHelper
=
$adyenHelper
;
...
...
Helper/Data.php
View file @
10df523c
...
...
@@ -55,7 +55,7 @@ class Data extends AbstractHelper
protected
$_moduleList
;
/**
* @var \Adyen\Payment\Model\Resource\Billing\Agreement\CollectionFactory
* @var \Adyen\Payment\Model\Resource
Model
\Billing\Agreement\CollectionFactory
*/
protected
$_billingAgreementCollectionFactory
;
...
...
@@ -69,6 +69,11 @@ class Data extends AbstractHelper
*/
protected
$_assetSource
;
/**
* @var \Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory
*/
protected
$_notificationFactory
;
/**
* Data constructor.
*
...
...
@@ -77,7 +82,7 @@ class Data extends AbstractHelper
* @param \Magento\Framework\Config\DataInterface $dataStorage
* @param \Magento\Directory\Model\Config\Source\Country $country
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
* @param \Adyen\Payment\Model\Resource\Billing\Agreement\CollectionFactory $billingAgreementCollectionFactory
* @param \Adyen\Payment\Model\Resource
Model
\Billing\Agreement\CollectionFactory $billingAgreementCollectionFactory
* @param \Magento\Framework\View\Asset\Repository $assetRepo
* @param \Magento\Framework\View\Asset\Source $assetSource
*/
...
...
@@ -87,10 +92,10 @@ class Data extends AbstractHelper
\Magento\Framework\Config\DataInterface
$dataStorage
,
\Magento\Directory\Model\Config\Source\Country
$country
,
\Magento\Framework\Module\ModuleListInterface
$moduleList
,
\Adyen\Payment\Model\Resource\Billing\Agreement\CollectionFactory
$billingAgreementCollectionFactory
,
\Adyen\Payment\Model\Resource
Model
\Billing\Agreement\CollectionFactory
$billingAgreementCollectionFactory
,
\Magento\Framework\View\Asset\Repository
$assetRepo
,
\Magento\Framework\View\Asset\Source
$assetSource
,
\Adyen\Payment\Model\Resource\Notification\CollectionFactory
$notificationFactory
\Adyen\Payment\Model\Resource
Model
\Notification\CollectionFactory
$notificationFactory
)
{
parent
::
__construct
(
$context
);
...
...
Model/Cron.php
View file @
10df523c
...
...
@@ -41,7 +41,7 @@ class Cron
protected
$_logger
;
/**
* @var Resource\Notification\CollectionFactory
* @var Resource
Model
\Notification\CollectionFactory
*/
protected
$_notificationFactory
;
...
...
@@ -88,7 +88,7 @@ class Cron
protected
$_billingAgreementFactory
;
/**
* @var Resource\Billing\Agreement\CollectionFactory
* @var Resource
Model
\Billing\Agreement\CollectionFactory
*/
protected
$_billingAgreementCollectionFactory
;
...
...
@@ -168,7 +168,7 @@ class Cron
protected
$_adyenOrderPaymentFactory
;
/**
* @var Resource\Order\Payment\CollectionFactory
* @var Resource
Model
\Order\Payment\CollectionFactory
*/
protected
$_adyenOrderPaymentCollectionFactory
;
...
...
@@ -182,33 +182,33 @@ class Cron
*
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param Resource\Notification\CollectionFactory $notificationFactory
* @param Resource
Model
\Notification\CollectionFactory $notificationFactory
* @param \Magento\Sales\Model\OrderFactory $orderFactory
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param OrderSender $orderSender
* @param InvoiceSender $invoiceSender
* @param \Magento\Framework\DB\TransactionFactory $transactionFactory
* @param Billing\AgreementFactory $billingAgreementFactory
* @param Resource\Billing\Agreement\CollectionFactory $billingAgreementCollectionFactory
* @param Resource
Model
\Billing\Agreement\CollectionFactory $billingAgreementCollectionFactory
* @param Api\PaymentRequest $paymentRequest
* @param Order\PaymentFactory $adyenOrderPaymentFactory
* @param Resource\Order\Payment\CollectionFactory $adyenOrderPaymentCollectionFactory
* @param Resource
Model
\Order\Payment\CollectionFactory $adyenOrderPaymentCollectionFactory
* @param AreaList $areaList
*/
public
function
__construct
(
\Magento\Framework\App\Config\ScopeConfigInterface
$scopeConfig
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
,
\Adyen\Payment\Model\Resource\Notification\CollectionFactory
$notificationFactory
,
\Adyen\Payment\Model\Resource
Model
\Notification\CollectionFactory
$notificationFactory
,
\Magento\Sales\Model\OrderFactory
$orderFactory
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
OrderSender
$orderSender
,
InvoiceSender
$invoiceSender
,
\Magento\Framework\DB\TransactionFactory
$transactionFactory
,
\Adyen\Payment\Model\Billing\AgreementFactory
$billingAgreementFactory
,
\Adyen\Payment\Model\Resource\Billing\Agreement\CollectionFactory
$billingAgreementCollectionFactory
,
\Adyen\Payment\Model\Resource
Model
\Billing\Agreement\CollectionFactory
$billingAgreementCollectionFactory
,
\Adyen\Payment\Model\Api\PaymentRequest
$paymentRequest
,
\Adyen\Payment\Model\Order\PaymentFactory
$adyenOrderPaymentFactory
,
\Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory
$adyenOrderPaymentCollectionFactory
,
\Adyen\Payment\Model\Resource
Model
\Order\Payment\CollectionFactory
$adyenOrderPaymentCollectionFactory
,
AreaList
$areaList
)
{
...
...
Model/Method/Adapter.php
View file @
10df523c
...
...
@@ -96,7 +96,7 @@ class Adapter extends Method\Adapter
$agreement
->
getCustomerReference
(),
$agreement
->
getStoreId
()
);
}
catch
(
Exception
$e
)
{
}
catch
(
\
Exception
$e
)
{
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
'Failed to disable this contract'
));
}
}
...
...
Model/Notification.php
View file @
10df523c
...
...
@@ -76,7 +76,7 @@ class Notification extends \Magento\Framework\Model\AbstractModel
*/
protected
function
_construct
()
{
$this
->
_init
(
'Adyen\Payment\Model\Resource\Notification'
);
$this
->
_init
(
'Adyen\Payment\Model\Resource
Model
\Notification'
);
}
/**
...
...
Model/Order/Payment.php
View file @
10df523c
...
...
@@ -55,7 +55,7 @@ class Payment extends \Magento\Framework\Model\AbstractModel
*/
protected
function
_construct
()
{
$this
->
_init
(
'Adyen\Payment\Model\Resource\Order\Payment'
);
$this
->
_init
(
'Adyen\Payment\Model\Resource
Model
\Order\Payment'
);
}
/**
...
...
Model/Resource/Billing/Agreement.php
→
Model/Resource
Model
/Billing/Agreement.php
View file @
10df523c
...
...
@@ -21,7 +21,7 @@
* Author: Adyen <magento@adyen.com>
*/
namespace
Adyen\Payment\Model\Resource\Billing
;
namespace
Adyen\Payment\Model\Resource
Model
\Billing
;
/**
* Billing agreement resource model
...
...
Model/Resource/Billing/Agreement/Collection.php
→
Model/Resource
Model
/Billing/Agreement/Collection.php
View file @
10df523c
...
...
@@ -21,7 +21,7 @@
* Author: Adyen <magento@adyen.com>
*/
namespace
Adyen\Payment\Model\Resource\Billing\Agreement
;
namespace
Adyen\Payment\Model\Resource
Model
\Billing\Agreement
;
/**
* Billing agreements resource collection
...
...
Model/Resource/Notification.php
→
Model/Resource
Model
/Notification.php
View file @
10df523c
...
...
@@ -21,7 +21,7 @@
* Author: Adyen <magento@adyen.com>
*/
namespace
Adyen\Payment\Model\Resource
;
namespace
Adyen\Payment\Model\Resource
Model
;
class
Notification
extends
\Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
...
...
Model/Resource/Notification/Collection.php
→
Model/Resource
Model
/Notification/Collection.php
View file @
10df523c
...
...
@@ -21,7 +21,7 @@
* Author: Adyen <magento@adyen.com>
*/
namespace
Adyen\Payment\Model\Resource\Notification
;
namespace
Adyen\Payment\Model\Resource
Model
\Notification
;
class
Collection
extends
\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
...
...
@@ -30,7 +30,7 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab
*/
public
function
_construct
()
{
$this
->
_init
(
'Adyen\Payment\Model\Notification'
,
'Adyen\Payment\Model\Resource\Notification'
);
$this
->
_init
(
'Adyen\Payment\Model\Notification'
,
'Adyen\Payment\Model\Resource
Model
\Notification'
);
}
/**
...
...
Model/Resource/Order/Payment.php
→
Model/Resource
Model
/Order/Payment.php
View file @
10df523c
...
...
@@ -21,7 +21,7 @@
* Author: Adyen <magento@adyen.com>
*/
namespace
Adyen\Payment\Model\Resource\Order
;
namespace
Adyen\Payment\Model\Resource
Model
\Order
;
class
Payment
extends
\Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
...
...
Model/Resource/Order/Payment/Collection.php
→
Model/Resource
Model
/Order/Payment/Collection.php
View file @
10df523c
...
...
@@ -21,7 +21,7 @@
* Author: Adyen <magento@adyen.com>
*/
namespace
Adyen\Payment\Model\Resource\Order\Payment
;
namespace
Adyen\Payment\Model\Resource
Model
\Order\Payment
;
/**
* Billing agreements resource collection
...
...
@@ -36,7 +36,7 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab
*/
protected
function
_construct
()
{
$this
->
_init
(
'Adyen\Payment\Model\Order\Payment'
,
'Adyen\Payment\Model\Resource\Order\Payment'
);
$this
->
_init
(
'Adyen\Payment\Model\Order\Payment'
,
'Adyen\Payment\Model\Resource
Model
\Order\Payment'
);
}
/**
...
...
Test/Unit/Helper/DataTest.php
View file @
10df523c
...
...
@@ -43,10 +43,10 @@ class DataTest extends \PHPUnit_Framework_TestCase
$dataStorage
=
$this
->
getSimpleMock
(
'\Magento\Framework\Config\DataInterface'
);
$country
=
$this
->
getSimpleMock
(
'\Magento\Directory\Model\Config\Source\Country'
);
$moduleList
=
$this
->
getSimpleMock
(
'\Magento\Framework\Module\ModuleListInterface'
);
$billingAgreementCollectionFactory
=
$this
->
getSimpleMock
(
'\Adyen\Payment\Model\Resource\Billing\Agreement\CollectionFactory'
);
$billingAgreementCollectionFactory
=
$this
->
getSimpleMock
(
'\Adyen\Payment\Model\Resource
Model
\Billing\Agreement\CollectionFactory'
);
$assetRepo
=
$this
->
getSimpleMock
(
'\Magento\Framework\View\Asset\Repository'
);
$assetSource
=
$this
->
getSimpleMock
(
'\Magento\Framework\View\Asset\Source'
);
$notificationFactory
=
$this
->
getSimpleMock
(
'\Adyen\Payment\Model\Resource\Notification\CollectionFactory'
);
$notificationFactory
=
$this
->
getSimpleMock
(
'\Adyen\Payment\Model\Resource
Model
\Notification\CollectionFactory'
);
$this
->
dataHelper
=
new
Data
(
$context
,
$encryptor
,
$dataStorage
,
$country
,
$moduleList
,
$billingAgreementCollectionFactory
,
$assetRepo
,
$assetSource
,
$notificationFactory
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment