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\Ratepay\Business\Api\Builder; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\RatepayRequestTransfer; |
|
|
|
|
11
|
|
|
|
12
|
|
|
class ShoppingBasketItem extends AbstractBuilder implements ShoppingBasketItemInterface |
13
|
|
|
{ |
14
|
|
|
public const ROOT_TAG = 'item'; |
15
|
|
|
|
16
|
|
|
public const ITEM_DISCOUNT_COEFFICIENT = -1; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var int |
20
|
|
|
*/ |
21
|
|
|
protected $itemNumber; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @param \Generated\Shared\Transfer\RatepayRequestTransfer $requestTransfer |
25
|
|
|
* @param int $itemNumber |
26
|
|
|
*/ |
27
|
|
|
public function __construct(RatepayRequestTransfer $requestTransfer, $itemNumber) |
28
|
|
|
{ |
29
|
|
|
parent::__construct($requestTransfer); |
30
|
|
|
$this->itemNumber = $itemNumber; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @return array |
35
|
|
|
*/ |
36
|
|
|
public function buildData() |
37
|
|
|
{ |
38
|
|
|
$basketItem = $this->requestTransfer->getShoppingBasket()->getItems()[$this->itemNumber]; |
39
|
|
|
|
40
|
|
|
$return = [ |
41
|
|
|
'@article-number' => $basketItem->getArticleNumber(), |
42
|
|
|
'@unique-article-number' => $basketItem->getUniqueArticleNumber(), |
43
|
|
|
'@quantity' => $basketItem->getQuantity(), |
44
|
|
|
'@unit-price-gross' => $basketItem->getUnitPriceGross(), |
45
|
|
|
'@tax-rate' => $basketItem->getTaxRate(), |
46
|
|
|
'#' => $basketItem->getItemName(), |
47
|
|
|
]; |
48
|
|
|
if ($basketItem->getDiscount() > 0) { |
49
|
|
|
$return['@discount'] = $basketItem->getDiscount() * self::ITEM_DISCOUNT_COEFFICIENT; |
50
|
|
|
} |
51
|
|
|
if ($basketItem->getDescription() !== null) { |
52
|
|
|
$return['@description'] = $basketItem->getDescription(); |
53
|
|
|
} |
54
|
|
|
if ($basketItem->getDescriptionAddition() !== null) { |
55
|
|
|
$return['@description-addition'] = $basketItem->getDescriptionAddition(); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
return $return; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return string |
63
|
|
|
*/ |
64
|
|
|
public function getRootTag() |
65
|
|
|
{ |
66
|
|
|
return static::ROOT_TAG; |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
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