1 | <?php |
||
2 | /** |
||
3 | * Copyright © Wirecard Brasil. All rights reserved. |
||
4 | * |
||
5 | * @author Bruno Elisei <[email protected]> |
||
6 | * See COPYING.txt for license details. |
||
7 | */ |
||
8 | |||
9 | declare(strict_types=1); |
||
10 | |||
11 | namespace Moip\Magento2\Plugin; |
||
12 | |||
13 | use Magento\Sales\Api\Data\OrderPaymentInterface; |
||
0 ignored issues
–
show
|
|||
14 | use Magento\Vault\Api\Data\PaymentTokenInterface; |
||
0 ignored issues
–
show
The type
Magento\Vault\Api\Data\PaymentTokenInterface 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 ![]() |
|||
15 | use Magento\Vault\Api\PaymentTokenManagementInterface; |
||
0 ignored issues
–
show
The type
Magento\Vault\Api\PaymentTokenManagementInterface 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 ![]() |
|||
16 | |||
17 | /** |
||
18 | * Class PaymentTokenManagementInterface - Fixed Issue #84. |
||
19 | */ |
||
20 | class PaymentToken |
||
21 | { |
||
22 | public function aroundSaveTokenWithPaymentLink( |
||
23 | PaymentTokenManagementInterface $paymentTokenManagement, |
||
24 | callable $proceed, |
||
25 | PaymentTokenInterface $token, |
||
26 | OrderPaymentInterface $payment |
||
27 | ): bool { |
||
28 | $order = $payment->getOrder(); |
||
29 | |||
30 | if ($order->getCustomerIsGuest()) { |
||
31 | return $proceed($token, $payment); |
||
32 | } |
||
33 | |||
34 | $existingToken = $paymentTokenManagement->getByGatewayToken( |
||
35 | $token->getGatewayToken(), |
||
36 | $payment->getMethodInstance()->getCode(), |
||
37 | $order->getCustomerId() |
||
38 | ); |
||
39 | |||
40 | if ($existingToken === null) { |
||
41 | return $proceed($token, $payment); |
||
42 | } |
||
43 | |||
44 | $existingToken->addData($token->getData()); |
||
45 | |||
46 | return $proceed($existingToken, $payment); |
||
47 | } |
||
48 | } |
||
49 |
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