PAYONE-GmbH /
magento-2
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify |
||
| 5 | * it under the terms of the GNU Lesser General Public License as published by |
||
| 6 | * the Free Software Foundation, either version 3 of the License, or |
||
| 7 | * (at your option) any later version. |
||
| 8 | * |
||
| 9 | * PAYONE Magento 2 Connector is distributed in the hope that it will be useful, |
||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 12 | * GNU Lesser General Public License for more details. |
||
| 13 | * |
||
| 14 | * You should have received a copy of the GNU Lesser General Public License |
||
| 15 | * along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>. |
||
| 16 | * |
||
| 17 | * PHP version 5 |
||
| 18 | * |
||
| 19 | * @category Payone |
||
| 20 | * @package Payone_Magento2_Plugin |
||
| 21 | * @author FATCHIP GmbH <[email protected]> |
||
| 22 | * @copyright 2003 - 2018 Payone GmbH |
||
| 23 | * @license <http://www.gnu.org/licenses/> GNU Lesser General Public License |
||
| 24 | * @link http://www.payone.de |
||
| 25 | */ |
||
| 26 | |||
| 27 | namespace Payone\Core\Model\Handler; |
||
| 28 | |||
| 29 | use Magento\Checkout\Model\Session; |
||
|
0 ignored issues
–
show
|
|||
| 30 | use Magento\Sales\Model\Order; |
||
|
0 ignored issues
–
show
The type
Magento\Sales\Model\Order was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 31 | use Magento\Sales\Model\OrderFactory; |
||
|
0 ignored issues
–
show
The type
Magento\Sales\Model\OrderFactory was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 32 | use Magento\Framework\Exception\LocalizedException; |
||
|
0 ignored issues
–
show
The type
Magento\Framework\Exception\LocalizedException was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 33 | use \Magento\Quote\Api\CartRepositoryInterface as QuoteRepo; |
||
|
0 ignored issues
–
show
The type
\Magento\Quote\Api\CartRepositoryInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 34 | |||
| 35 | class TransactionStatus |
||
| 36 | { |
||
| 37 | /** |
||
| 38 | * TransactionStatus array |
||
| 39 | * |
||
| 40 | * @var array |
||
| 41 | */ |
||
| 42 | protected $status = []; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * PAYONE TransactionStatus Mapping |
||
| 46 | * |
||
| 47 | * @var \Payone\Core\Model\TransactionStatus\Mapping |
||
| 48 | */ |
||
| 49 | protected $statusMapping; |
||
| 50 | |||
| 51 | /** |
||
| 52 | * PAYONE TransactionStatus Forwarding |
||
| 53 | * |
||
| 54 | * @var \Payone\Core\Model\TransactionStatus\Forwarding |
||
| 55 | */ |
||
| 56 | protected $statusForwarding; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Magento event manager |
||
| 60 | * |
||
| 61 | * @var \Magento\Framework\Event\ManagerInterface |
||
|
0 ignored issues
–
show
The type
Magento\Framework\Event\ManagerInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 62 | */ |
||
| 63 | protected $eventManager; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Url builder object |
||
| 67 | * |
||
| 68 | * @var \Magento\Framework\UrlInterface |
||
|
0 ignored issues
–
show
The type
Magento\Framework\UrlInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 69 | */ |
||
| 70 | protected $urlBuilder; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Constructor |
||
| 74 | * |
||
| 75 | * @param \Payone\Core\Model\TransactionStatus\Mapping $statusMapping |
||
| 76 | * @param \Payone\Core\Model\TransactionStatus\Forwarding $statusForwarding |
||
| 77 | * @param \Magento\Framework\Event\ManagerInterface $eventManager |
||
| 78 | * @param \Magento\Framework\UrlInterface $urlBuilder |
||
| 79 | */ |
||
| 80 | public function __construct( |
||
| 81 | \Payone\Core\Model\TransactionStatus\Mapping $statusMapping, |
||
| 82 | \Payone\Core\Model\TransactionStatus\Forwarding $statusForwarding, |
||
| 83 | \Magento\Framework\Event\ManagerInterface $eventManager, |
||
| 84 | \Magento\Framework\UrlInterface $urlBuilder |
||
| 85 | ) { |
||
| 86 | $this->statusMapping = $statusMapping; |
||
| 87 | $this->statusForwarding = $statusForwarding; |
||
| 88 | $this->eventManager = $eventManager; |
||
| 89 | $this->urlBuilder = $urlBuilder; |
||
| 90 | } |
||
| 91 | |||
| 92 | /** |
||
| 93 | * Set status array |
||
| 94 | * |
||
| 95 | * @param array $aStatus |
||
| 96 | * @return void |
||
| 97 | */ |
||
| 98 | protected function setStatus($aStatus) |
||
| 99 | { |
||
| 100 | if (is_array($aStatus)) { |
||
|
0 ignored issues
–
show
|
|||
| 101 | $this->status = $aStatus; |
||
| 102 | } |
||
| 103 | } |
||
| 104 | |||
| 105 | /** |
||
| 106 | * Return status array |
||
| 107 | * |
||
| 108 | * @return array |
||
| 109 | */ |
||
| 110 | protected function getStatus() |
||
| 111 | { |
||
| 112 | return $this->status; |
||
| 113 | } |
||
| 114 | |||
| 115 | /** |
||
| 116 | * Return certain key from status array |
||
| 117 | * |
||
| 118 | * @param string $sKey |
||
| 119 | * @return string|null |
||
| 120 | */ |
||
| 121 | protected function getParam($sKey) |
||
| 122 | { |
||
| 123 | if (isset($this->status[$sKey])) { |
||
| 124 | return $this->status[$sKey]; |
||
| 125 | } |
||
| 126 | return null; |
||
| 127 | } |
||
| 128 | |||
| 129 | /** |
||
| 130 | * Handle TransactionStatus |
||
| 131 | * |
||
| 132 | * @param Order $oOrder |
||
| 133 | * @param array $aStatus |
||
| 134 | * @return void |
||
| 135 | */ |
||
| 136 | public function handle(Order $oOrder, $aStatus) |
||
| 137 | { |
||
| 138 | $this->setStatus($aStatus); |
||
| 139 | |||
| 140 | $sAction = $this->getParam('txaction'); |
||
| 141 | |||
| 142 | if ($oOrder) { |
||
|
0 ignored issues
–
show
|
|||
| 143 | $oOrder->setPayoneTransactionStatus($sAction); |
||
| 144 | $oOrder->save(); |
||
| 145 | |||
| 146 | $this->statusMapping->handleMapping($oOrder, $sAction); |
||
| 147 | } |
||
| 148 | |||
| 149 | $this->statusForwarding->forwardAsyncRequest($this->getStatus(), $this->urlBuilder->getUrl("payone/transactionstatus/decouple", ['_secure' => true])); |
||
| 150 | |||
| 151 | $aParams = [ |
||
| 152 | 'order' => $oOrder, |
||
| 153 | 'transactionstatus' => $this->getStatus(), |
||
| 154 | ]; |
||
| 155 | |||
| 156 | $this->eventManager->dispatch('payone_core_transactionstatus_all', $aParams); |
||
| 157 | $this->eventManager->dispatch('payone_core_transactionstatus_'.$sAction, $aParams); |
||
| 158 | } |
||
| 159 | } |
||
| 160 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths