Skip to content

Commit

Permalink
build(codegen): updating SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
ct-sdks[bot] committed Dec 18, 2024
1 parent 4682298 commit c6fc3c9
Show file tree
Hide file tree
Showing 11 changed files with 295 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@

- added property `applicationMode` to type `CartDiscountValueFixed`
- added property `applicationMode` to type `CartDiscountValueFixedDraft`
- added property `custom` to type `CartSetCustomShippingMethodAction`
- added property `custom` to type `StagedOrderSetCustomShippingMethodAction`
- added property `custom` to type `StagedOrderSetShippingAddressAndCustomShippingMethodAction`
</details>

**History changes**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Commercetools\Api\Models\ShippingMethod\ShippingRateDraft;
use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier;
use Commercetools\Api\Models\Type\CustomFieldsDraft;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;

Expand All @@ -19,6 +20,7 @@ interface CartSetCustomShippingMethodAction extends CartUpdateAction
public const FIELD_SHIPPING_RATE = 'shippingRate';
public const FIELD_TAX_CATEGORY = 'taxCategory';
public const FIELD_EXTERNAL_TAX_RATE = 'externalTaxRate';
public const FIELD_CUSTOM = 'custom';

/**
* <p>Name of the custom Shipping Method.</p>
Expand Down Expand Up @@ -52,6 +54,14 @@ public function getTaxCategory();
*/
public function getExternalTaxRate();

/**
* <p>Custom Fields for the custom Shipping Method.</p>
*
* @return null|CustomFieldsDraft
*/
public function getCustom();

/**
* @param ?string $shippingMethodName
*/
Expand All @@ -71,4 +81,9 @@ public function setTaxCategory(?TaxCategoryResourceIdentifier $taxCategory): voi
* @param ?ExternalTaxRateDraft $externalTaxRate
*/
public function setExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate): void;

/**
* @param ?CustomFieldsDraft $custom
*/
public function setCustom(?CustomFieldsDraft $custom): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use Commercetools\Api\Models\ShippingMethod\ShippingRateDraftBuilder;
use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier;
use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifierBuilder;
use Commercetools\Api\Models\Type\CustomFieldsDraft;
use Commercetools\Api\Models\Type\CustomFieldsDraftBuilder;
use Commercetools\Base\Builder;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
Expand Down Expand Up @@ -48,6 +50,12 @@ final class CartSetCustomShippingMethodActionBuilder implements Builder
*/
private $externalTaxRate;

/**
* @var null|CustomFieldsDraft|CustomFieldsDraftBuilder
*/
private $custom;

/**
* <p>Name of the custom Shipping Method.</p>
*
Expand Down Expand Up @@ -92,6 +100,17 @@ public function getExternalTaxRate()
return $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate;
}

/**
* <p>Custom Fields for the custom Shipping Method.</p>
*
* @return null|CustomFieldsDraft
*/
public function getCustom()
{
return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
}

/**
* @param ?string $shippingMethodName
* @return $this
Expand Down Expand Up @@ -136,6 +155,17 @@ public function withExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
return $this;
}

/**
* @param ?CustomFieldsDraft $custom
* @return $this
*/
public function withCustom(?CustomFieldsDraft $custom)
{
$this->custom = $custom;

return $this;
}

/**
* @deprecated use withShippingRate() instead
* @return $this
Expand Down Expand Up @@ -169,13 +199,25 @@ public function withExternalTaxRateBuilder(?ExternalTaxRateDraftBuilder $externa
return $this;
}

/**
* @deprecated use withCustom() instead
* @return $this
*/
public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
{
$this->custom = $custom;

return $this;
}

public function build(): CartSetCustomShippingMethodAction
{
return new CartSetCustomShippingMethodActionModel(
$this->shippingMethodName,
$this->shippingRate instanceof ShippingRateDraftBuilder ? $this->shippingRate->build() : $this->shippingRate,
$this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory,
$this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate
$this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate,
$this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use Commercetools\Api\Models\ShippingMethod\ShippingRateDraftModel;
use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier;
use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifierModel;
use Commercetools\Api\Models\Type\CustomFieldsDraft;
use Commercetools\Api\Models\Type\CustomFieldsDraftModel;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
use Commercetools\Base\JsonObjectModel;
Expand Down Expand Up @@ -54,6 +56,12 @@ final class CartSetCustomShippingMethodActionModel extends JsonObjectModel imple
*/
protected $externalTaxRate;

/**
*
* @var ?CustomFieldsDraft
*/
protected $custom;


/**
* @psalm-suppress MissingParamType
Expand All @@ -63,12 +71,14 @@ public function __construct(
?ShippingRateDraft $shippingRate = null,
?TaxCategoryResourceIdentifier $taxCategory = null,
?ExternalTaxRateDraft $externalTaxRate = null,
?CustomFieldsDraft $custom = null,
?string $action = null
) {
$this->shippingMethodName = $shippingMethodName;
$this->shippingRate = $shippingRate;
$this->taxCategory = $taxCategory;
$this->externalTaxRate = $externalTaxRate;
$this->custom = $custom;
$this->action = $action ?? self::DISCRIMINATOR_VALUE;
}

Expand Down Expand Up @@ -173,6 +183,27 @@ public function getExternalTaxRate()
return $this->externalTaxRate;
}

/**
* <p>Custom Fields for the custom Shipping Method.</p>
*
*
* @return null|CustomFieldsDraft
*/
public function getCustom()
{
if (is_null($this->custom)) {
/** @psalm-var stdClass|array<string, mixed>|null $data */
$data = $this->raw(self::FIELD_CUSTOM);
if (is_null($data)) {
return null;
}

$this->custom = CustomFieldsDraftModel::of($data);
}

return $this->custom;
}


/**
* @param ?string $shippingMethodName
Expand Down Expand Up @@ -205,4 +236,12 @@ public function setExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate): void
{
$this->externalTaxRate = $externalTaxRate;
}

/**
* @param ?CustomFieldsDraft $custom
*/
public function setCustom(?CustomFieldsDraft $custom): void
{
$this->custom = $custom;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Commercetools\Api\Models\Order\StagedOrderUpdateAction;
use Commercetools\Api\Models\ShippingMethod\ShippingRateDraft;
use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier;
use Commercetools\Api\Models\Type\CustomFieldsDraft;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;

Expand All @@ -21,6 +22,7 @@ interface StagedOrderSetCustomShippingMethodAction extends StagedOrderUpdateActi
public const FIELD_SHIPPING_RATE = 'shippingRate';
public const FIELD_TAX_CATEGORY = 'taxCategory';
public const FIELD_EXTERNAL_TAX_RATE = 'externalTaxRate';
public const FIELD_CUSTOM = 'custom';

/**
* <p>Name of the custom Shipping Method.</p>
Expand Down Expand Up @@ -54,6 +56,14 @@ public function getTaxCategory();
*/
public function getExternalTaxRate();

/**
* <p>Custom Fields for the custom Shipping Method.</p>
*
* @return null|CustomFieldsDraft
*/
public function getCustom();

/**
* @param ?string $shippingMethodName
*/
Expand All @@ -73,4 +83,9 @@ public function setTaxCategory(?TaxCategoryResourceIdentifier $taxCategory): voi
* @param ?ExternalTaxRateDraft $externalTaxRate
*/
public function setExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate): void;

/**
* @param ?CustomFieldsDraft $custom
*/
public function setCustom(?CustomFieldsDraft $custom): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use Commercetools\Api\Models\ShippingMethod\ShippingRateDraftBuilder;
use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifier;
use Commercetools\Api\Models\TaxCategory\TaxCategoryResourceIdentifierBuilder;
use Commercetools\Api\Models\Type\CustomFieldsDraft;
use Commercetools\Api\Models\Type\CustomFieldsDraftBuilder;
use Commercetools\Base\Builder;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
Expand Down Expand Up @@ -52,6 +54,12 @@ final class StagedOrderSetCustomShippingMethodActionBuilder implements Builder
*/
private $externalTaxRate;

/**
* @var null|CustomFieldsDraft|CustomFieldsDraftBuilder
*/
private $custom;

/**
* <p>Name of the custom Shipping Method.</p>
*
Expand Down Expand Up @@ -96,6 +104,17 @@ public function getExternalTaxRate()
return $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate;
}

/**
* <p>Custom Fields for the custom Shipping Method.</p>
*
* @return null|CustomFieldsDraft
*/
public function getCustom()
{
return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
}

/**
* @param ?string $shippingMethodName
* @return $this
Expand Down Expand Up @@ -140,6 +159,17 @@ public function withExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
return $this;
}

/**
* @param ?CustomFieldsDraft $custom
* @return $this
*/
public function withCustom(?CustomFieldsDraft $custom)
{
$this->custom = $custom;

return $this;
}

/**
* @deprecated use withShippingRate() instead
* @return $this
Expand Down Expand Up @@ -173,13 +203,25 @@ public function withExternalTaxRateBuilder(?ExternalTaxRateDraftBuilder $externa
return $this;
}

/**
* @deprecated use withCustom() instead
* @return $this
*/
public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
{
$this->custom = $custom;

return $this;
}

public function build(): StagedOrderSetCustomShippingMethodAction
{
return new StagedOrderSetCustomShippingMethodActionModel(
$this->shippingMethodName,
$this->shippingRate instanceof ShippingRateDraftBuilder ? $this->shippingRate->build() : $this->shippingRate,
$this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory,
$this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate
$this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate,
$this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
);
}

Expand Down
Loading

0 comments on commit c6fc3c9

Please sign in to comment.