Skip to content

Commit 8d52bd5

Browse files
committed
build(codegen): updating SDK
1 parent 21122ea commit 8d52bd5

14 files changed

+567
-2
lines changed

changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,11 @@
209209
- added type `ProductTailoringSetProductAttributeAction`
210210
- added type `AttributeLevelEnum`
211211
- added type `ProductSetProductAttributeAction`
212+
- added type `DiscountCombinationMode`
213+
- added type `DiscountsConfiguration`
212214
- added type `ProjectChangePriceRoundingModeAction`
213215
- added type `ProjectChangeTaxRoundingModeAction`
216+
- added type `ProjectSetDiscountsConfigurationAction`
214217
- added type `DayOfMonthSchedule`
215218
- added type `DayOfMonthScheduleDraft`
216219
- added type `IntervalUnit`
@@ -481,6 +484,7 @@
481484
- added property `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/` to type `ProductVariantChannelAvailabilityMap`
482485
- added property `priceRoundingMode` to type `CartsConfiguration`
483486
- added property `taxRoundingMode` to type `CartsConfiguration`
487+
- added property `discounts` to type `Project`
484488
- added property `priceRoundingMode` to type `QuoteRequest`
485489
- added property `priceRoundingMode` to type `Quote`
486490
- added property `businessUnit` to type `ShoppingList`
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file has been auto generated
6+
* Do not change it.
7+
*/
8+
9+
namespace Commercetools\Api\Models\Project;
10+
11+
use Commercetools\Base\DateTimeImmutableCollection;
12+
use Commercetools\Base\JsonObject;
13+
14+
interface DiscountsConfiguration extends JsonObject
15+
{
16+
public const FIELD_DISCOUNT_COMBINATION_MODE = 'discountCombinationMode';
17+
18+
/**
19+
* <p>Indicates how Product Discounts and Cart Discounts should be combined. Default value is <code>Stacking</code>.</p>
20+
*
21+
22+
* @return null|string
23+
*/
24+
public function getDiscountCombinationMode();
25+
26+
/**
27+
* @param ?string $discountCombinationMode
28+
*/
29+
public function setDiscountCombinationMode(?string $discountCombinationMode): void;
30+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file has been auto generated
6+
* Do not change it.
7+
*/
8+
9+
namespace Commercetools\Api\Models\Project;
10+
11+
use Commercetools\Base\Builder;
12+
use Commercetools\Base\DateTimeImmutableCollection;
13+
use Commercetools\Base\JsonObject;
14+
use Commercetools\Base\JsonObjectModel;
15+
use Commercetools\Base\MapperFactory;
16+
use stdClass;
17+
18+
/**
19+
* @implements Builder<DiscountsConfiguration>
20+
*/
21+
final class DiscountsConfigurationBuilder implements Builder
22+
{
23+
/**
24+
25+
* @var ?string
26+
*/
27+
private $discountCombinationMode;
28+
29+
/**
30+
* <p>Indicates how Product Discounts and Cart Discounts should be combined. Default value is <code>Stacking</code>.</p>
31+
*
32+
33+
* @return null|string
34+
*/
35+
public function getDiscountCombinationMode()
36+
{
37+
return $this->discountCombinationMode;
38+
}
39+
40+
/**
41+
* @param ?string $discountCombinationMode
42+
* @return $this
43+
*/
44+
public function withDiscountCombinationMode(?string $discountCombinationMode)
45+
{
46+
$this->discountCombinationMode = $discountCombinationMode;
47+
48+
return $this;
49+
}
50+
51+
52+
public function build(): DiscountsConfiguration
53+
{
54+
return new DiscountsConfigurationModel(
55+
$this->discountCombinationMode
56+
);
57+
}
58+
59+
public static function of(): DiscountsConfigurationBuilder
60+
{
61+
return new self();
62+
}
63+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file has been auto generated
6+
* Do not change it.
7+
*/
8+
9+
namespace Commercetools\Api\Models\Project;
10+
11+
use Commercetools\Base\MapperSequence;
12+
use Commercetools\Exception\InvalidArgumentException;
13+
use stdClass;
14+
15+
/**
16+
* @extends MapperSequence<DiscountsConfiguration>
17+
* @method DiscountsConfiguration current()
18+
* @method DiscountsConfiguration end()
19+
* @method DiscountsConfiguration at($offset)
20+
*/
21+
class DiscountsConfigurationCollection extends MapperSequence
22+
{
23+
/**
24+
* @psalm-assert DiscountsConfiguration $value
25+
* @psalm-param DiscountsConfiguration|stdClass $value
26+
* @throws InvalidArgumentException
27+
*
28+
* @return DiscountsConfigurationCollection
29+
*/
30+
public function add($value)
31+
{
32+
if (!$value instanceof DiscountsConfiguration) {
33+
throw new InvalidArgumentException();
34+
}
35+
$this->store($value);
36+
37+
return $this;
38+
}
39+
40+
/**
41+
* @psalm-return callable(int):?DiscountsConfiguration
42+
*/
43+
protected function mapper()
44+
{
45+
return function (?int $index): ?DiscountsConfiguration {
46+
$data = $this->get($index);
47+
if ($data instanceof stdClass) {
48+
/** @var DiscountsConfiguration $data */
49+
$data = DiscountsConfigurationModel::of($data);
50+
$this->set($data, $index);
51+
}
52+
53+
return $data;
54+
};
55+
}
56+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file has been auto generated
6+
* Do not change it.
7+
*/
8+
9+
namespace Commercetools\Api\Models\Project;
10+
11+
use Commercetools\Base\DateTimeImmutableCollection;
12+
use Commercetools\Base\JsonObject;
13+
use Commercetools\Base\JsonObjectModel;
14+
use Commercetools\Base\MapperFactory;
15+
use stdClass;
16+
17+
/**
18+
* @internal
19+
*/
20+
final class DiscountsConfigurationModel extends JsonObjectModel implements DiscountsConfiguration
21+
{
22+
/**
23+
*
24+
* @var ?string
25+
*/
26+
protected $discountCombinationMode;
27+
28+
29+
/**
30+
* @psalm-suppress MissingParamType
31+
*/
32+
public function __construct(
33+
?string $discountCombinationMode = null
34+
) {
35+
$this->discountCombinationMode = $discountCombinationMode;
36+
}
37+
38+
/**
39+
* <p>Indicates how Product Discounts and Cart Discounts should be combined. Default value is <code>Stacking</code>.</p>
40+
*
41+
*
42+
* @return null|string
43+
*/
44+
public function getDiscountCombinationMode()
45+
{
46+
if (is_null($this->discountCombinationMode)) {
47+
/** @psalm-var ?string $data */
48+
$data = $this->raw(self::FIELD_DISCOUNT_COMBINATION_MODE);
49+
if (is_null($data)) {
50+
return null;
51+
}
52+
$this->discountCombinationMode = (string) $data;
53+
}
54+
55+
return $this->discountCombinationMode;
56+
}
57+
58+
59+
/**
60+
* @param ?string $discountCombinationMode
61+
*/
62+
public function setDiscountCombinationMode(?string $discountCombinationMode): void
63+
{
64+
$this->discountCombinationMode = $discountCombinationMode;
65+
}
66+
}

lib/commercetools-api/src/Models/Project/Project.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ interface Project extends JsonObject
3030
public const FIELD_EXTERNAL_O_AUTH = 'externalOAuth';
3131
public const FIELD_SEARCH_INDEXING = 'searchIndexing';
3232
public const FIELD_BUSINESS_UNITS = 'businessUnits';
33+
public const FIELD_DISCOUNTS = 'discounts';
3334

3435
/**
3536
* <p>Current version of the Project.</p>
@@ -151,6 +152,14 @@ public function getSearchIndexing();
151152
*/
152153
public function getBusinessUnits();
153154

155+
/**
156+
* <p>Holds configuration specific to discounts, including how Product and Cart Discounts are combined in every Cart of the Project.</p>
157+
*
158+
159+
* @return null|DiscountsConfiguration
160+
*/
161+
public function getDiscounts();
162+
154163
/**
155164
* @param ?int $version
156165
*/
@@ -225,4 +234,9 @@ public function setSearchIndexing(?SearchIndexingConfiguration $searchIndexing):
225234
* @param ?BusinessUnitConfiguration $businessUnits
226235
*/
227236
public function setBusinessUnits(?BusinessUnitConfiguration $businessUnits): void;
237+
238+
/**
239+
* @param ?DiscountsConfiguration $discounts
240+
*/
241+
public function setDiscounts(?DiscountsConfiguration $discounts): void;
228242
}

lib/commercetools-api/src/Models/Project/ProjectBuilder.php

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ final class ProjectBuilder implements Builder
113113
*/
114114
private $businessUnits;
115115

116+
/**
117+
118+
* @var null|DiscountsConfiguration|DiscountsConfigurationBuilder
119+
*/
120+
private $discounts;
121+
116122
/**
117123
* <p>Current version of the Project.</p>
118124
*
@@ -278,6 +284,17 @@ public function getBusinessUnits()
278284
return $this->businessUnits instanceof BusinessUnitConfigurationBuilder ? $this->businessUnits->build() : $this->businessUnits;
279285
}
280286

287+
/**
288+
* <p>Holds configuration specific to discounts, including how Product and Cart Discounts are combined in every Cart of the Project.</p>
289+
*
290+
291+
* @return null|DiscountsConfiguration
292+
*/
293+
public function getDiscounts()
294+
{
295+
return $this->discounts instanceof DiscountsConfigurationBuilder ? $this->discounts->build() : $this->discounts;
296+
}
297+
281298
/**
282299
* @param ?int $version
283300
* @return $this
@@ -443,6 +460,17 @@ public function withBusinessUnits(?BusinessUnitConfiguration $businessUnits)
443460
return $this;
444461
}
445462

463+
/**
464+
* @param ?DiscountsConfiguration $discounts
465+
* @return $this
466+
*/
467+
public function withDiscounts(?DiscountsConfiguration $discounts)
468+
{
469+
$this->discounts = $discounts;
470+
471+
return $this;
472+
}
473+
446474
/**
447475
* @deprecated use withMessages() instead
448476
* @return $this
@@ -520,6 +548,17 @@ public function withBusinessUnitsBuilder(?BusinessUnitConfigurationBuilder $busi
520548
return $this;
521549
}
522550

551+
/**
552+
* @deprecated use withDiscounts() instead
553+
* @return $this
554+
*/
555+
public function withDiscountsBuilder(?DiscountsConfigurationBuilder $discounts)
556+
{
557+
$this->discounts = $discounts;
558+
559+
return $this;
560+
}
561+
523562
public function build(): Project
524563
{
525564
return new ProjectModel(
@@ -537,7 +576,8 @@ public function build(): Project
537576
$this->shippingRateInputType instanceof ShippingRateInputTypeBuilder ? $this->shippingRateInputType->build() : $this->shippingRateInputType,
538577
$this->externalOAuth instanceof ExternalOAuthBuilder ? $this->externalOAuth->build() : $this->externalOAuth,
539578
$this->searchIndexing instanceof SearchIndexingConfigurationBuilder ? $this->searchIndexing->build() : $this->searchIndexing,
540-
$this->businessUnits instanceof BusinessUnitConfigurationBuilder ? $this->businessUnits->build() : $this->businessUnits
579+
$this->businessUnits instanceof BusinessUnitConfigurationBuilder ? $this->businessUnits->build() : $this->businessUnits,
580+
$this->discounts instanceof DiscountsConfigurationBuilder ? $this->discounts->build() : $this->discounts
541581
);
542582
}
543583

0 commit comments

Comments
 (0)