1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Yves\Braintree\Model\Processor; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\PaypalExpressSuccessResponseTransfer; |
|
|
|
|
11
|
|
|
use Generated\Shared\Transfer\QuoteTransfer; |
|
|
|
|
12
|
|
|
use SprykerEco\Yves\Braintree\Dependency\Client\BraintreeToQuoteClientInterface; |
13
|
|
|
use SprykerEco\Yves\Braintree\Model\Mapper\PaypalResponse\PaypalResponseMapperInterface; |
14
|
|
|
|
15
|
|
|
class PaypalResponseProcessor implements PaypalResponseProcessorInterface |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @var \SprykerEco\Yves\Braintree\Model\Mapper\PaypalResponse\PaypalResponseMapperInterface |
19
|
|
|
*/ |
20
|
|
|
protected $paypalResponseMapper; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var \SprykerEco\Yves\Braintree\Dependency\Client\BraintreeToQuoteClientInterface |
24
|
|
|
*/ |
25
|
|
|
protected $quoteClient; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param \SprykerEco\Yves\Braintree\Model\Mapper\PaypalResponse\PaypalResponseMapperInterface $paypalResponseMapper |
29
|
|
|
* @param \SprykerEco\Yves\Braintree\Dependency\Client\BraintreeToQuoteClientInterface $quoteClient |
30
|
|
|
*/ |
31
|
|
|
public function __construct( |
32
|
|
|
PaypalResponseMapperInterface $paypalResponseMapper, |
33
|
|
|
BraintreeToQuoteClientInterface $quoteClient |
34
|
|
|
) { |
35
|
|
|
$this->paypalResponseMapper = $paypalResponseMapper; |
36
|
|
|
$this->quoteClient = $quoteClient; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param array $payload |
41
|
|
|
* |
42
|
|
|
* @return \Generated\Shared\Transfer\QuoteTransfer |
43
|
|
|
*/ |
44
|
|
|
public function processSuccessResponse(array $payload): QuoteTransfer |
45
|
|
|
{ |
46
|
|
|
$paypalExpressSuccessResponseTransfer = $this->paypalResponseMapper->mapSuccessResponseToPaypalExpressSuccessResponseTransfer($payload); |
47
|
|
|
$quoteTransfer = $this->updateQuoteDependOnResponse($paypalExpressSuccessResponseTransfer); |
48
|
|
|
|
49
|
|
|
return $quoteTransfer; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param \Generated\Shared\Transfer\PaypalExpressSuccessResponseTransfer $paypalExpressSuccessResponseTransfer |
54
|
|
|
* |
55
|
|
|
* @return \Generated\Shared\Transfer\QuoteTransfer |
56
|
|
|
*/ |
57
|
|
|
protected function updateQuoteDependOnResponse(PaypalExpressSuccessResponseTransfer $paypalExpressSuccessResponseTransfer): QuoteTransfer |
58
|
|
|
{ |
59
|
|
|
$quoteTransfer = $this->quoteClient->getQuote(); |
60
|
|
|
$quoteTransfer = $this->paypalResponseMapper->mapPaypalExpressSuccessResponseTransferToQuoteTransfer( |
61
|
|
|
$paypalExpressSuccessResponseTransfer, |
62
|
|
|
$quoteTransfer |
63
|
|
|
); |
64
|
|
|
|
65
|
|
|
$this->quoteClient->setQuote($quoteTransfer); |
66
|
|
|
|
67
|
|
|
return $quoteTransfer; |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|
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