Skip to content

Commit 31f7f45

Browse files
committed
build(codegen): updating SDK
1 parent 2dc1ff9 commit 31f7f45

File tree

6 files changed

+40
-32
lines changed

6 files changed

+40
-32
lines changed

changes.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
**Api changes**
22

33
<details>
4-
<summary>Added Resource(s)</summary>
4+
<summary>Changed Property(s)</summary>
55

6-
- added resource `/{projectKey}/in-store/key={storeKey}/business-units`
7-
- added resource `/{projectKey}/in-store/key={storeKey}/business-units/key={key}`
8-
- added resource `/{projectKey}/in-store/key={storeKey}/business-units/{ID}`
6+
- :warning: changed property `discount` of type `DiscountedTotalPricePortion` from type `CartDiscountReference` to `Reference`
97
</details>
108

119

@@ -26,6 +24,15 @@
2624
</details>
2725

2826

27+
<details>
28+
<summary>Added Resource(s)</summary>
29+
30+
- added resource `/{projectKey}/in-store/key={storeKey}/business-units`
31+
- added resource `/{projectKey}/in-store/key={storeKey}/business-units/key={key}`
32+
- added resource `/{projectKey}/in-store/key={storeKey}/business-units/{ID}`
33+
</details>
34+
35+
2936
<details>
3037
<summary>Added Method(s)</summary>
3138

lib/commercetools-api/src/Models/Cart/DiscountedTotalPricePortion.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Commercetools\Api\Models\Cart;
1010

11-
use Commercetools\Api\Models\CartDiscount\CartDiscountReference;
11+
use Commercetools\Api\Models\Common\Reference;
1212
use Commercetools\Api\Models\Common\TypedMoney;
1313
use Commercetools\Base\DateTimeImmutableCollection;
1414
use Commercetools\Base\JsonObject;
@@ -19,10 +19,10 @@ interface DiscountedTotalPricePortion extends JsonObject
1919
public const FIELD_DISCOUNTED_AMOUNT = 'discountedAmount';
2020

2121
/**
22-
* <p>Cart Discount related to the discounted price.</p>
22+
* <p>A <a href="ctp:api:type:CartDiscountReference">CartDiscountReference</a> or <a href="ctp:api:type:DirectDiscountReference">DirectDiscountReference</a> to the discount applied on the Cart <code>totalPrice</code>.</p>
2323
*
2424
25-
* @return null|CartDiscountReference
25+
* @return null|Reference
2626
*/
2727
public function getDiscount();
2828

@@ -35,9 +35,9 @@ public function getDiscount();
3535
public function getDiscountedAmount();
3636

3737
/**
38-
* @param ?CartDiscountReference $discount
38+
* @param ?Reference $discount
3939
*/
40-
public function setDiscount(?CartDiscountReference $discount): void;
40+
public function setDiscount(?Reference $discount): void;
4141

4242
/**
4343
* @param ?TypedMoney $discountedAmount

lib/commercetools-api/src/Models/Cart/DiscountedTotalPricePortionBuilder.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
namespace Commercetools\Api\Models\Cart;
1010

11-
use Commercetools\Api\Models\CartDiscount\CartDiscountReference;
12-
use Commercetools\Api\Models\CartDiscount\CartDiscountReferenceBuilder;
11+
use Commercetools\Api\Models\Common\Reference;
12+
use Commercetools\Api\Models\Common\ReferenceBuilder;
1313
use Commercetools\Api\Models\Common\TypedMoney;
1414
use Commercetools\Api\Models\Common\TypedMoneyBuilder;
1515
use Commercetools\Base\Builder;
@@ -26,7 +26,7 @@ final class DiscountedTotalPricePortionBuilder implements Builder
2626
{
2727
/**
2828
29-
* @var null|CartDiscountReference|CartDiscountReferenceBuilder
29+
* @var null|Reference|ReferenceBuilder
3030
*/
3131
private $discount;
3232

@@ -37,14 +37,14 @@ final class DiscountedTotalPricePortionBuilder implements Builder
3737
private $discountedAmount;
3838

3939
/**
40-
* <p>Cart Discount related to the discounted price.</p>
40+
* <p>A <a href="ctp:api:type:CartDiscountReference">CartDiscountReference</a> or <a href="ctp:api:type:DirectDiscountReference">DirectDiscountReference</a> to the discount applied on the Cart <code>totalPrice</code>.</p>
4141
*
4242
43-
* @return null|CartDiscountReference
43+
* @return null|Reference
4444
*/
4545
public function getDiscount()
4646
{
47-
return $this->discount instanceof CartDiscountReferenceBuilder ? $this->discount->build() : $this->discount;
47+
return $this->discount instanceof ReferenceBuilder ? $this->discount->build() : $this->discount;
4848
}
4949

5050
/**
@@ -59,10 +59,10 @@ public function getDiscountedAmount()
5959
}
6060

6161
/**
62-
* @param ?CartDiscountReference $discount
62+
* @param ?Reference $discount
6363
* @return $this
6464
*/
65-
public function withDiscount(?CartDiscountReference $discount)
65+
public function withDiscount(?Reference $discount)
6666
{
6767
$this->discount = $discount;
6868

@@ -84,7 +84,7 @@ public function withDiscountedAmount(?TypedMoney $discountedAmount)
8484
* @deprecated use withDiscount() instead
8585
* @return $this
8686
*/
87-
public function withDiscountBuilder(?CartDiscountReferenceBuilder $discount)
87+
public function withDiscountBuilder(?ReferenceBuilder $discount)
8888
{
8989
$this->discount = $discount;
9090

@@ -105,7 +105,7 @@ public function withDiscountedAmountBuilder(?TypedMoneyBuilder $discountedAmount
105105
public function build(): DiscountedTotalPricePortion
106106
{
107107
return new DiscountedTotalPricePortionModel(
108-
$this->discount instanceof CartDiscountReferenceBuilder ? $this->discount->build() : $this->discount,
108+
$this->discount instanceof ReferenceBuilder ? $this->discount->build() : $this->discount,
109109
$this->discountedAmount instanceof TypedMoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount
110110
);
111111
}

lib/commercetools-api/src/Models/Cart/DiscountedTotalPricePortionModel.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
namespace Commercetools\Api\Models\Cart;
1010

11-
use Commercetools\Api\Models\CartDiscount\CartDiscountReference;
12-
use Commercetools\Api\Models\CartDiscount\CartDiscountReferenceModel;
11+
use Commercetools\Api\Models\Common\Reference;
12+
use Commercetools\Api\Models\Common\ReferenceModel;
1313
use Commercetools\Api\Models\Common\TypedMoney;
1414
use Commercetools\Api\Models\Common\TypedMoneyModel;
1515
use Commercetools\Base\DateTimeImmutableCollection;
@@ -25,7 +25,7 @@ final class DiscountedTotalPricePortionModel extends JsonObjectModel implements
2525
{
2626
/**
2727
*
28-
* @var ?CartDiscountReference
28+
* @var ?Reference
2929
*/
3030
protected $discount;
3131

@@ -40,18 +40,18 @@ final class DiscountedTotalPricePortionModel extends JsonObjectModel implements
4040
* @psalm-suppress MissingParamType
4141
*/
4242
public function __construct(
43-
?CartDiscountReference $discount = null,
43+
?Reference $discount = null,
4444
?TypedMoney $discountedAmount = null
4545
) {
4646
$this->discount = $discount;
4747
$this->discountedAmount = $discountedAmount;
4848
}
4949

5050
/**
51-
* <p>Cart Discount related to the discounted price.</p>
51+
* <p>A <a href="ctp:api:type:CartDiscountReference">CartDiscountReference</a> or <a href="ctp:api:type:DirectDiscountReference">DirectDiscountReference</a> to the discount applied on the Cart <code>totalPrice</code>.</p>
5252
*
5353
*
54-
* @return null|CartDiscountReference
54+
* @return null|Reference
5555
*/
5656
public function getDiscount()
5757
{
@@ -61,8 +61,8 @@ public function getDiscount()
6161
if (is_null($data)) {
6262
return null;
6363
}
64-
65-
$this->discount = CartDiscountReferenceModel::of($data);
64+
$className = ReferenceModel::resolveDiscriminatorClass($data);
65+
$this->discount = $className::of($data);
6666
}
6767

6868
return $this->discount;
@@ -91,9 +91,9 @@ public function getDiscountedAmount()
9191

9292

9393
/**
94-
* @param ?CartDiscountReference $discount
94+
* @param ?Reference $discount
9595
*/
96-
public function setDiscount(?CartDiscountReference $discount): void
96+
public function setDiscount(?Reference $discount): void
9797
{
9898
$this->discount = $discount;
9999
}

lib/commercetools-base/src/Client/ClientCredentials.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ class ClientCredentials
3232
* The client id.
3333
* @param string $clientSecret
3434
* The client secret.
35-
* @param ?string $scope
35+
* @param string $scope
3636
* Provide the scope when you want to request a specific ones for the client.
3737
* Can be omitted to use all scopes of the oauth client.
3838
* Format: `<the scope name>:<the project key>`.
3939
* Example: `manage_products:project1`.
4040
*/
41-
public function __construct(string $clientId, string $clientSecret, ?string $scope = null)
41+
public function __construct(string $clientId, string $clientSecret, string $scope = null)
4242
{
4343
$this->clientId = $clientId;
4444
$this->clientSecret = $clientSecret;
4545
$this->scope = $scope;
46-
$this->cacheKey = sha1($clientId . $scope);
46+
$this->cacheKey = sha1($clientId . (string)$scope);
4747
}
4848

4949
public function getClientId(): string

references.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,4 @@ e3d5bc9cb69146c5d1dd755ed5e8cf2f54566b3a
350350
591d5eaefd1d56fd350895ccea401cb42f2f0ee8
351351
e45c96065b0f2d6cbb563b65fbed44785e8a8149
352352
64c89a7773b97bd6425a82d7d8cee1a9f0f3e6e2
353+
f28a1461a4122eed74c423156f1969ba204e6948

0 commit comments

Comments
 (0)