Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
- added property `invalidateOlderTokens` to type `CustomerCreatePasswordResetToken`
- added property `customerGroupAssignments` to type `CustomerDraft`
- added property `invalidateOlderTokens` to type `CustomerToken`
- added property `minCartQuantity` to type `InventoryEntry`
- added property `maxCartQuantity` to type `InventoryEntry`
- added property `minCartQuantity` to type `InventoryEntryDraft`
- added property `maxCartQuantity` to type `InventoryEntryDraft`
- added property `recurrenceInfo` to type `MyLineItemDraft`
- added property `recurrenceInfo` to type `MyCartAddLineItemAction`
- added property `value` to type `CustomerEmailTokenCreatedMessage`
Expand Down Expand Up @@ -169,6 +173,7 @@
- added type `ImportUnresolvedEventData`
- added type `ImportValidationFailedEventData`
- added type `ImportWaitForMasterVariantEventData`
- added type `InventoryEntrySetInventoryLimitsAction`
- added type `MyCartSetCustomLineItemRecurrenceInfoAction`
- added type `MyCartSetLineItemRecurrenceInfoAction`
- added type `MyPaymentSetMethodInfoCustomFieldAction`
Expand Down
5 changes: 5 additions & 0 deletions lib/commercetools-api/docs/RequestBuilder.md
Original file line number Diff line number Diff line change
Expand Up @@ -6995,8 +6995,13 @@ $request = $builder
```
## `withProjectKey("projectKey")->inventory()->post(null)`

Creates an InventoryEntry in the Project.

If quantity limits are provided, existing Line Items that reference a Product Variant with an SKU that matches the Inventory Entry can be affected. For more information, see [Quantity limits](/../api/carts-orders-overview#quantity-limits).

Produces the [InventoryEntryCreated](ctp:api:type:InventoryEntryCreatedMessage) Message.


### Example
```php
use Commercetools\Api\Client\ApiRequestBuilder;
Expand Down
28 changes: 28 additions & 0 deletions lib/commercetools-api/src/Models/Inventory/InventoryEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ interface InventoryEntry extends BaseResource
public const FIELD_SUPPLY_CHANNEL = 'supplyChannel';
public const FIELD_QUANTITY_ON_STOCK = 'quantityOnStock';
public const FIELD_AVAILABLE_QUANTITY = 'availableQuantity';
public const FIELD_MIN_CART_QUANTITY = 'minCartQuantity';
public const FIELD_MAX_CART_QUANTITY = 'maxCartQuantity';
public const FIELD_RESTOCKABLE_IN_DAYS = 'restockableInDays';
public const FIELD_EXPECTED_DELIVERY = 'expectedDelivery';
public const FIELD_CUSTOM = 'custom';
Expand Down Expand Up @@ -118,6 +120,22 @@ public function getQuantityOnStock();
*/
public function getAvailableQuantity();

/**
* <p>Minimum quantity that can be added to a Cart. See <a href="/../api/carts-orders-overview#quantity-limits">Quantity limits</a>.</p>
*

* @return null|int
*/
public function getMinCartQuantity();

/**
* <p>Maximum quantity that can be added to a Cart. See <a href="/../api/carts-orders-overview#quantity-limits">Quantity limits</a>.</p>
*

* @return null|int
*/
public function getMaxCartQuantity();

/**
* <p>How often the InventoryEntry is restocked (in days).</p>
*
Expand Down Expand Up @@ -197,6 +215,16 @@ public function setQuantityOnStock(?int $quantityOnStock): void;
*/
public function setAvailableQuantity(?int $availableQuantity): void;

/**
* @param ?int $minCartQuantity
*/
public function setMinCartQuantity(?int $minCartQuantity): void;

/**
* @param ?int $maxCartQuantity
*/
public function setMaxCartQuantity(?int $maxCartQuantity): void;

/**
* @param ?int $restockableInDays
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ final class InventoryEntryBuilder implements Builder
*/
private $availableQuantity;

/**

* @var ?int
*/
private $minCartQuantity;

/**

* @var ?int
*/
private $maxCartQuantity;

/**

* @var ?int
Expand Down Expand Up @@ -236,6 +248,28 @@ public function getAvailableQuantity()
return $this->availableQuantity;
}

/**
* <p>Minimum quantity that can be added to a Cart. See <a href="/../api/carts-orders-overview#quantity-limits">Quantity limits</a>.</p>
*

* @return null|int
*/
public function getMinCartQuantity()
{
return $this->minCartQuantity;
}

/**
* <p>Maximum quantity that can be added to a Cart. See <a href="/../api/carts-orders-overview#quantity-limits">Quantity limits</a>.</p>
*

* @return null|int
*/
public function getMaxCartQuantity()
{
return $this->maxCartQuantity;
}

/**
* <p>How often the InventoryEntry is restocked (in days).</p>
*
Expand Down Expand Up @@ -390,6 +424,28 @@ public function withAvailableQuantity(?int $availableQuantity)
return $this;
}

/**
* @param ?int $minCartQuantity
* @return $this
*/
public function withMinCartQuantity(?int $minCartQuantity)
{
$this->minCartQuantity = $minCartQuantity;

return $this;
}

/**
* @param ?int $maxCartQuantity
* @return $this
*/
public function withMaxCartQuantity(?int $maxCartQuantity)
{
$this->maxCartQuantity = $maxCartQuantity;

return $this;
}

/**
* @param ?int $restockableInDays
* @return $this
Expand Down Expand Up @@ -481,6 +537,8 @@ public function build(): InventoryEntry
$this->supplyChannel instanceof ChannelReferenceBuilder ? $this->supplyChannel->build() : $this->supplyChannel,
$this->quantityOnStock,
$this->availableQuantity,
$this->minCartQuantity,
$this->maxCartQuantity,
$this->restockableInDays,
$this->expectedDelivery,
$this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ interface InventoryEntryDraft extends JsonObject
public const FIELD_KEY = 'key';
public const FIELD_SUPPLY_CHANNEL = 'supplyChannel';
public const FIELD_QUANTITY_ON_STOCK = 'quantityOnStock';
public const FIELD_MIN_CART_QUANTITY = 'minCartQuantity';
public const FIELD_MAX_CART_QUANTITY = 'maxCartQuantity';
public const FIELD_RESTOCKABLE_IN_DAYS = 'restockableInDays';
public const FIELD_EXPECTED_DELIVERY = 'expectedDelivery';
public const FIELD_CUSTOM = 'custom';
Expand Down Expand Up @@ -57,6 +59,22 @@ public function getSupplyChannel();
*/
public function getQuantityOnStock();

/**
* <p>Minimum quantity that can be added to a Cart. See <a href="/../api/carts-orders-overview#quantity-limits">Quantity limits</a>.</p>
*

* @return null|int
*/
public function getMinCartQuantity();

/**
* <p>Maximum quantity that can be added to a Cart. See <a href="/../api/carts-orders-overview#quantity-limits">Quantity limits</a>.</p>
*

* @return null|int
*/
public function getMaxCartQuantity();

/**
* <p>How often the InventoryEntry is restocked (in days).</p>
*
Expand Down Expand Up @@ -101,6 +119,16 @@ public function setSupplyChannel(?ChannelResourceIdentifier $supplyChannel): voi
*/
public function setQuantityOnStock(?int $quantityOnStock): void;

/**
* @param ?int $minCartQuantity
*/
public function setMinCartQuantity(?int $minCartQuantity): void;

/**
* @param ?int $maxCartQuantity
*/
public function setMaxCartQuantity(?int $maxCartQuantity): void;

/**
* @param ?int $restockableInDays
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ final class InventoryEntryDraftBuilder implements Builder
*/
private $quantityOnStock;

/**

* @var ?int
*/
private $minCartQuantity;

/**

* @var ?int
*/
private $maxCartQuantity;

/**

* @var ?int
Expand Down Expand Up @@ -112,6 +124,28 @@ public function getQuantityOnStock()
return $this->quantityOnStock;
}

/**
* <p>Minimum quantity that can be added to a Cart. See <a href="/../api/carts-orders-overview#quantity-limits">Quantity limits</a>.</p>
*

* @return null|int
*/
public function getMinCartQuantity()
{
return $this->minCartQuantity;
}

/**
* <p>Maximum quantity that can be added to a Cart. See <a href="/../api/carts-orders-overview#quantity-limits">Quantity limits</a>.</p>
*

* @return null|int
*/
public function getMaxCartQuantity()
{
return $this->maxCartQuantity;
}

/**
* <p>How often the InventoryEntry is restocked (in days).</p>
*
Expand Down Expand Up @@ -189,6 +223,28 @@ public function withQuantityOnStock(?int $quantityOnStock)
return $this;
}

/**
* @param ?int $minCartQuantity
* @return $this
*/
public function withMinCartQuantity(?int $minCartQuantity)
{
$this->minCartQuantity = $minCartQuantity;

return $this;
}

/**
* @param ?int $maxCartQuantity
* @return $this
*/
public function withMaxCartQuantity(?int $maxCartQuantity)
{
$this->maxCartQuantity = $maxCartQuantity;

return $this;
}

/**
* @param ?int $restockableInDays
* @return $this
Expand Down Expand Up @@ -251,6 +307,8 @@ public function build(): InventoryEntryDraft
$this->key,
$this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel,
$this->quantityOnStock,
$this->minCartQuantity,
$this->maxCartQuantity,
$this->restockableInDays,
$this->expectedDelivery,
$this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
Expand Down
Loading