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
73e31065
Commit
73e31065
authored
Jul 10, 2018
by
Bas Maassen
Committed by
GitHub
Jul 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set state (#287)
* Set state * Add in constructor comments
parent
b6cda614
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
Model/Cron.php
Model/Cron.php
+31
-3
No files found.
Model/Cron.php
View file @
73e31065
...
...
@@ -187,6 +187,11 @@ class Cron
*/
protected
$_areaList
;
/**
* @var \Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory
*/
protected
$_orderStatusCollection
;
/**
* Cron constructor.
*
...
...
@@ -203,7 +208,9 @@ class Cron
* @param Api\PaymentRequest $paymentRequest
* @param Order\PaymentFactory $adyenOrderPaymentFactory
* @param ResourceModel\Order\Payment\CollectionFactory $adyenOrderPaymentCollectionFactory
* @param InvoiceFactory $adyenInvoiceFactory
* @param AreaList $areaList
* @param \Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $orderStatusCollection
*/
public
function
__construct
(
\Magento\Framework\App\Config\ScopeConfigInterface
$scopeConfig
,
...
...
@@ -220,8 +227,10 @@ class Cron
\Adyen\Payment\Model\Order\PaymentFactory
$adyenOrderPaymentFactory
,
\Adyen\Payment\Model\ResourceModel\Order\Payment\CollectionFactory
$adyenOrderPaymentCollectionFactory
,
\Adyen\Payment\Model\InvoiceFactory
$adyenInvoiceFactory
,
AreaList
$areaList
)
{
AreaList
$areaList
,
\Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory
$orderStatusCollection
)
{
$this
->
_scopeConfig
=
$scopeConfig
;
$this
->
_adyenLogger
=
$adyenLogger
;
$this
->
_notificationFactory
=
$notificationFactory
;
...
...
@@ -237,6 +246,7 @@ class Cron
$this
->
_adyenOrderPaymentCollectionFactory
=
$adyenOrderPaymentCollectionFactory
;
$this
->
_adyenInvoiceFactory
=
$adyenInvoiceFactory
;
$this
->
_areaList
=
$areaList
;
$this
->
_orderStatusCollection
=
$orderStatusCollection
;
}
/**
...
...
@@ -1137,6 +1147,8 @@ class Cron
// only do this if status in configuration is set
if
(
!
empty
(
$status
))
{
$this
->
_order
->
addStatusHistoryComment
(
__
(
'Payment is authorised waiting for capture'
),
$status
);
$this
->
_setState
(
$status
);
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'Order status is changed to Pre-authorised status, status is '
.
$status
);
...
...
@@ -1594,14 +1606,30 @@ class Cron
$comment
=
"Adyen Payment is in Manual Review check the Adyen platform"
;
}
}
$status
=
(
!
empty
(
$status
))
?
$status
:
$this
->
_order
->
getStatus
();
$this
->
_order
->
addStatusHistoryComment
(
__
(
$comment
),
$status
);
$this
->
_setState
(
$status
);
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'Order status is changed to authorised status, status is '
.
$status
);
}
/**
* Set State from Status
*/
protected
function
_setState
(
$status
)
{
$statusObject
=
$this
->
_orderStatusCollection
->
create
()
->
addFieldToFilter
(
'main_table.status'
,
$status
)
->
addFieldToFilter
(
'state_table.is_default'
,
true
)
->
joinStates
()
->
getFirstItem
();
$this
->
_order
->
setState
(
$statusObject
->
getState
());
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'State is changed to '
.
$statusObject
->
getState
());
}
/**
* Create shipment
...
...
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