|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* MIT License |
|
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\Payone\Communication\Plugin\Checkout; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\CheckoutResponseTransfer; |
|
|
|
|
|
|
11
|
|
|
use Generated\Shared\Transfer\QuoteTransfer; |
|
|
|
|
|
|
12
|
|
|
use Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface; |
|
13
|
|
|
use Spryker\Zed\Kernel\Communication\AbstractPlugin; |
|
14
|
|
|
use SprykerEco\Zed\Payone\PayoneConfig; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @method \SprykerEco\Zed\Payone\Business\PayoneFacadeInterface getFacade() |
|
18
|
|
|
* @method \SprykerEco\Zed\Payone\Communication\PayoneCommunicationFactory getFactory() |
|
19
|
|
|
* @method \SprykerEco\Zed\Payone\Persistence\PayoneQueryContainerInterface getQueryContainer() |
|
20
|
|
|
* @method \SprykerEco\Zed\Payone\PayoneConfig getConfig() |
|
21
|
|
|
*/ |
|
22
|
|
|
class PayoneCheckoutPreConditionPlugin extends AbstractPlugin implements CheckoutPreConditionPluginInterface |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* {@inheritDoc} |
|
26
|
|
|
* - Does additional logic only if the payment provider is 'Payone' otherwise does nothing. |
|
27
|
|
|
* - Maps Quote to CalculableObject. |
|
28
|
|
|
* - Run all calculator plugins. |
|
29
|
|
|
* - Maps CalculableObject to Quote. |
|
30
|
|
|
* - Executes `QuotePostRecalculatePluginInterface` stack of plugins if `$executeQuotePlugins` is true. |
|
31
|
|
|
* - Sets the amount of the payment detail of the 'Payone' payment. |
|
32
|
|
|
* - Returns 'true' in any case. |
|
33
|
|
|
* |
|
34
|
|
|
* @api |
|
35
|
|
|
* |
|
36
|
|
|
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer |
|
37
|
|
|
* @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer |
|
38
|
|
|
* |
|
39
|
|
|
* @return bool |
|
40
|
|
|
*/ |
|
41
|
|
|
public function checkCondition(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer) |
|
42
|
|
|
{ |
|
43
|
|
|
if ($quoteTransfer->getPayment()->getPaymentProvider() === PayoneConfig::PROVIDER_NAME) { |
|
44
|
|
|
$quoteTransfer = $this->getFactory()->getCalculationFacade()->recalculateQuote($quoteTransfer); |
|
45
|
|
|
$quoteTransfer->getPayment()->getPayone()->getPaymentDetail()->setAmount($quoteTransfer->getPayment()->getAmount()); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
return true; |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|
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