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\Service\CrefoPay\Generator; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\QuoteTransfer; |
|
|
|
|
11
|
|
|
use SprykerEco\Service\CrefoPay\CrefoPayConfig; |
12
|
|
|
use SprykerEco\Service\CrefoPay\Dependency\Service\CrefoPayToUtilTextServiceInterface; |
13
|
|
|
|
14
|
|
|
class CrefoPayUniqueIdGenerator implements CrefoPayUniqueIdGeneratorInterface |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @var \SprykerEco\Service\CrefoPay\CrefoPayConfig $config |
18
|
|
|
*/ |
19
|
|
|
protected $config; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var \SprykerEco\Service\CrefoPay\Dependency\Service\CrefoPayToUtilTextServiceInterface $crefoPayUniqueIdGeneratorBridge |
23
|
|
|
*/ |
24
|
|
|
protected $crefoPayToUtilTextServiceBridge; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @param \SprykerEco\Service\CrefoPay\CrefoPayConfig $config |
28
|
|
|
* @param \SprykerEco\Service\CrefoPay\Dependency\Service\CrefoPayToUtilTextServiceInterface $crefoPayToUtilTextServiceBridge |
29
|
|
|
*/ |
30
|
|
|
public function __construct( |
31
|
|
|
CrefoPayConfig $config, |
32
|
|
|
CrefoPayToUtilTextServiceInterface $crefoPayToUtilTextServiceBridge |
33
|
|
|
) { |
34
|
|
|
$this->config = $config; |
35
|
|
|
$this->crefoPayToUtilTextServiceBridge = $crefoPayToUtilTextServiceBridge; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer |
40
|
|
|
* |
41
|
|
|
* @return string |
42
|
|
|
*/ |
43
|
|
|
public function generateCrefoPayOrderId(QuoteTransfer $quoteTransfer): string |
44
|
|
|
{ |
45
|
|
|
return $this->config->getUseIndependentOrderIdForTransaction() ? |
46
|
|
|
$this->generateCrefoPayOrderIdIndependent() : |
47
|
|
|
$this->generateCrefoPayOrderIdBasedOnCustomerReference($quoteTransfer); |
|
|
|
|
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @deprecated Use {@link \SprykerEco\Service\CrefoPay\Generator\CrefoPayUniqueIdGenerator::generateCrefoPayOrderIdIndependent()} instead. |
52
|
|
|
* |
53
|
|
|
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer |
54
|
|
|
* |
55
|
|
|
* @return string |
56
|
|
|
*/ |
57
|
|
|
protected function generateCrefoPayOrderIdBasedOnCustomerReference(QuoteTransfer $quoteTransfer): string |
58
|
|
|
{ |
59
|
|
|
return uniqid($quoteTransfer->getCustomerReference() . '-', true); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return string |
64
|
|
|
*/ |
65
|
|
|
protected function generateCrefoPayOrderIdIndependent(): string |
66
|
|
|
{ |
67
|
|
|
return $this->crefoPayToUtilTextServiceBridge->generateRandomString(30); |
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