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
3 changes: 3 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<summary>Added Type(s)</summary>

- added type `CartLock`
- added type `FreezeStrategy`
- added type `CartLockCartAction`
- added type `CartSetPurchaseOrderNumberAction`
- added type `CartUnlockCartAction`
Expand All @@ -15,8 +16,10 @@
<details>
<summary>Added Property(s)</summary>

- added property `freezeStrategy` to type `Cart`
- added property `lock` to type `Cart`
- added property `purchaseOrderNumber` to type `Cart`
- added property `purchaseOrderNumber` to type `CartDraft`
- added property `strategy` to type `CartFreezeCartAction`
</details>

Original file line number Diff line number Diff line change
Expand Up @@ -1835,6 +1835,7 @@ type Cart implements Versioned & ReferenceExpandable {
shippingCustomFields: CustomFieldsType
discountTypeCombination: DiscountTypeCombination
cartState: CartState!
freezeStrategy: FreezeStrategy
key: String
lock: CartLock
custom: CustomFieldsType
Expand Down Expand Up @@ -4978,8 +4979,21 @@ input FixedPriceDiscountValueInput {
money: [CartDiscountValueBaseMoneyInput!]!
}

enum FreezeStrategy {
"""
More lenient version of a Cart freeze (See [Freeze a Cart](https://docs.commercetools.com/api/carts-orders-overview#freeze-a-cart) for details).
"""
SoftFreeze

"""
Stricter version of a Cart freeze (See [Freeze a Cart](https://docs.commercetools.com/api/carts-orders-overview#freeze-a-cart) for details).
"""
HardFreeze
}

input FreezeCart {
dummy: String
strategy: FreezeStrategy
}

interface Geometry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@ public interface Cart extends BaseResource, CartMixin, com.commercetools.api.mod
@JsonProperty("cartState")
public CartState getCartState();

/**
* <p>Determines freezing behavior when <code>cartState</code> is <code>Frozen</code>.</p>
* @return freezeStrategy
*/

@JsonProperty("freezeStrategy")
public FreezeStrategy getFreezeStrategy();

/**
* <p>Billing address associated with the Cart.</p>
* @return billingAddress
Expand Down Expand Up @@ -640,6 +648,13 @@ public interface Cart extends BaseResource, CartMixin, com.commercetools.api.mod

public void setCartState(final CartState cartState);

/**
* <p>Determines freezing behavior when <code>cartState</code> is <code>Frozen</code>.</p>
* @param freezeStrategy value to be set
*/

public void setFreezeStrategy(final FreezeStrategy freezeStrategy);

/**
* <p>Billing address associated with the Cart.</p>
* @param billingAddress value to be set
Expand Down Expand Up @@ -902,6 +917,7 @@ public static Cart of(final Cart template) {
instance.setTaxCalculationMode(template.getTaxCalculationMode());
instance.setInventoryMode(template.getInventoryMode());
instance.setCartState(template.getCartState());
instance.setFreezeStrategy(template.getFreezeStrategy());
instance.setBillingAddress(template.getBillingAddress());
instance.setShippingAddress(template.getShippingAddress());
instance.setShippingMode(template.getShippingMode());
Expand Down Expand Up @@ -978,6 +994,7 @@ public static Cart deepCopy(@Nullable final Cart template) {
instance.setTaxCalculationMode(template.getTaxCalculationMode());
instance.setInventoryMode(template.getInventoryMode());
instance.setCartState(template.getCartState());
instance.setFreezeStrategy(template.getFreezeStrategy());
instance.setBillingAddress(com.commercetools.api.models.common.Address.deepCopy(template.getBillingAddress()));
instance.setShippingAddress(
com.commercetools.api.models.common.Address.deepCopy(template.getShippingAddress()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ public class CartBuilder implements Builder<Cart> {

private com.commercetools.api.models.cart.CartState cartState;

@Nullable
private com.commercetools.api.models.cart.FreezeStrategy freezeStrategy;

@Nullable
private com.commercetools.api.models.common.Address billingAddress;

Expand Down Expand Up @@ -777,6 +780,17 @@ public CartBuilder cartState(final com.commercetools.api.models.cart.CartState c
return this;
}

/**
* <p>Determines freezing behavior when <code>cartState</code> is <code>Frozen</code>.</p>
* @param freezeStrategy value to be set
* @return Builder
*/

public CartBuilder freezeStrategy(@Nullable final com.commercetools.api.models.cart.FreezeStrategy freezeStrategy) {
this.freezeStrategy = freezeStrategy;
return this;
}

/**
* <p>Billing address associated with the Cart.</p>
* @param builder function to build the billingAddress value
Expand Down Expand Up @@ -1914,6 +1928,16 @@ public com.commercetools.api.models.cart.CartState getCartState() {
return this.cartState;
}

/**
* <p>Determines freezing behavior when <code>cartState</code> is <code>Frozen</code>.</p>
* @return freezeStrategy
*/

@Nullable
public com.commercetools.api.models.cart.FreezeStrategy getFreezeStrategy() {
return this.freezeStrategy;
}

/**
* <p>Billing address associated with the Cart.</p>
* @return billingAddress
Expand Down Expand Up @@ -2172,9 +2196,9 @@ public Cart build() {
return new CartImpl(id, version, createdAt, lastModifiedAt, key, customerId, customerEmail, customerGroup,
anonymousId, businessUnit, store, lineItems, customLineItems, totalLineItemQuantity, totalPrice, taxedPrice,
taxedShippingPrice, discountOnTotalPrice, taxMode, priceRoundingMode, taxRoundingMode, taxCalculationMode,
inventoryMode, cartState, billingAddress, shippingAddress, shippingMode, shippingKey, shippingInfo,
shippingRateInput, shippingCustomFields, shipping, itemShippingAddresses, discountCodes, directDiscounts,
refusedGifts, paymentInfo, country, locale, origin, custom, discountTypeCombination, lock,
inventoryMode, cartState, freezeStrategy, billingAddress, shippingAddress, shippingMode, shippingKey,
shippingInfo, shippingRateInput, shippingCustomFields, shipping, itemShippingAddresses, discountCodes,
directDiscounts, refusedGifts, paymentInfo, country, locale, origin, custom, discountTypeCombination, lock,
deleteDaysAfterLastModification, purchaseOrderNumber, lastModifiedBy, createdBy);
}

Expand All @@ -2186,9 +2210,9 @@ public Cart buildUnchecked() {
return new CartImpl(id, version, createdAt, lastModifiedAt, key, customerId, customerEmail, customerGroup,
anonymousId, businessUnit, store, lineItems, customLineItems, totalLineItemQuantity, totalPrice, taxedPrice,
taxedShippingPrice, discountOnTotalPrice, taxMode, priceRoundingMode, taxRoundingMode, taxCalculationMode,
inventoryMode, cartState, billingAddress, shippingAddress, shippingMode, shippingKey, shippingInfo,
shippingRateInput, shippingCustomFields, shipping, itemShippingAddresses, discountCodes, directDiscounts,
refusedGifts, paymentInfo, country, locale, origin, custom, discountTypeCombination, lock,
inventoryMode, cartState, freezeStrategy, billingAddress, shippingAddress, shippingMode, shippingKey,
shippingInfo, shippingRateInput, shippingCustomFields, shipping, itemShippingAddresses, discountCodes,
directDiscounts, refusedGifts, paymentInfo, country, locale, origin, custom, discountTypeCombination, lock,
deleteDaysAfterLastModification, purchaseOrderNumber, lastModifiedBy, createdBy);
}

Expand Down Expand Up @@ -2231,6 +2255,7 @@ public static CartBuilder of(final Cart template) {
builder.taxCalculationMode = template.getTaxCalculationMode();
builder.inventoryMode = template.getInventoryMode();
builder.cartState = template.getCartState();
builder.freezeStrategy = template.getFreezeStrategy();
builder.billingAddress = template.getBillingAddress();
builder.shippingAddress = template.getShippingAddress();
builder.shippingMode = template.getShippingMode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@
import io.vrap.rmf.base.client.utils.Generated;

/**
* <p>Changes the <a href="https://docs.commercetools.com/apis/ctp:api:type:CartState" rel="nofollow">CartState</a> from <code>Active</code> to <code>Frozen</code>. Results in a <a href="https://docs.commercetools.com/apis/ctp:api:type:FrozenCarts" rel="nofollow">Frozen Cart</a>. Fails with <a href="https://docs.commercetools.com/apis/ctp:api:type:InvalidOperationError" rel="nofollow">InvalidOperation</a> error when the Cart is empty.</p>
* <p>Freezing a Cart produces the <a href="https://docs.commercetools.com/apis/ctp:api:type:CartFrozenMessage" rel="nofollow">CartFrozen</a> Message.</p>
* <p>Freezes the Cart based on the provided <a href="https://docs.commercetools.com/apis/ctp:api:type:FreezeStrategy" rel="nofollow">FreezeStrategy</a>.</p>
* <p>The following behavior occurs:</p>
* <ul>
* <li>Changes the Cart State from <code>Active</code> to <code>Frozen</code>.</li>
* <li>Sets the corresponding <a href="https://docs.commercetools.com/apis/ctp:api:type:FreezeStrategy" rel="nofollow">FreezeStrategy</a> on the Cart's <code>freezeStrategy</code> field.</li>
* <li>Produces the <a href="https://docs.commercetools.com/apis/ctp:api:type:CartFrozenMessage" rel="nofollow">CartFrozen</a> Message.</li>
* </ul>
* <p>If the Cart is empty, an <a href="https://docs.commercetools.com/apis/ctp:api:type:InvalidOperationError" rel="nofollow">InvalidOperation</a> error is returned.</p>
*
* <hr>
* Example to create an instance using the builder pattern
Expand All @@ -35,6 +41,21 @@ public interface CartFreezeCartAction extends CartUpdateAction {
*/
String FREEZE_CART = "freezeCart";

/**
* <p>Strategy that determines the freezing behavior.</p>
* @return strategy
*/

@JsonProperty("strategy")
public FreezeStrategy getStrategy();

/**
* <p>Strategy that determines the freezing behavior.</p>
* @param strategy value to be set
*/

public void setStrategy(final FreezeStrategy strategy);

/**
* factory method
* @return instance of CartFreezeCartAction
Expand All @@ -50,6 +71,7 @@ public static CartFreezeCartAction of() {
*/
public static CartFreezeCartAction of(final CartFreezeCartAction template) {
CartFreezeCartActionImpl instance = new CartFreezeCartActionImpl();
instance.setStrategy(template.getStrategy());
return instance;
}

Expand All @@ -66,6 +88,7 @@ public static CartFreezeCartAction deepCopy(@Nullable final CartFreezeCartAction
return null;
}
CartFreezeCartActionImpl instance = new CartFreezeCartActionImpl();
instance.setStrategy(template.getStrategy());
return instance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import java.util.*;

import javax.annotation.Nullable;

import io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;

Expand All @@ -20,20 +22,45 @@
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class CartFreezeCartActionBuilder implements Builder<CartFreezeCartAction> {

@Nullable
private com.commercetools.api.models.cart.FreezeStrategy strategy;

/**
* <p>Strategy that determines the freezing behavior.</p>
* @param strategy value to be set
* @return Builder
*/

public CartFreezeCartActionBuilder strategy(
@Nullable final com.commercetools.api.models.cart.FreezeStrategy strategy) {
this.strategy = strategy;
return this;
}

/**
* <p>Strategy that determines the freezing behavior.</p>
* @return strategy
*/

@Nullable
public com.commercetools.api.models.cart.FreezeStrategy getStrategy() {
return this.strategy;
}

/**
* builds CartFreezeCartAction with checking for non-null required values
* @return CartFreezeCartAction
*/
public CartFreezeCartAction build() {
return new CartFreezeCartActionImpl();
return new CartFreezeCartActionImpl(strategy);
}

/**
* builds CartFreezeCartAction without checking for non-null required values
* @return CartFreezeCartAction
*/
public CartFreezeCartAction buildUnchecked() {
return new CartFreezeCartActionImpl();
return new CartFreezeCartActionImpl(strategy);
}

/**
Expand All @@ -51,6 +78,7 @@ public static CartFreezeCartActionBuilder of() {
*/
public static CartFreezeCartActionBuilder of(final CartFreezeCartAction template) {
CartFreezeCartActionBuilder builder = new CartFreezeCartActionBuilder();
builder.strategy = template.getStrategy();
return builder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.*;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.*;

import io.vrap.rmf.base.client.ModelBase;
Expand All @@ -16,18 +17,35 @@
import org.apache.commons.lang3.builder.ToStringStyle;

/**
* <p>Changes the <a href="https://docs.commercetools.com/apis/ctp:api:type:CartState" rel="nofollow">CartState</a> from <code>Active</code> to <code>Frozen</code>. Results in a <a href="https://docs.commercetools.com/apis/ctp:api:type:FrozenCarts" rel="nofollow">Frozen Cart</a>. Fails with <a href="https://docs.commercetools.com/apis/ctp:api:type:InvalidOperationError" rel="nofollow">InvalidOperation</a> error when the Cart is empty.</p>
* <p>Freezing a Cart produces the <a href="https://docs.commercetools.com/apis/ctp:api:type:CartFrozenMessage" rel="nofollow">CartFrozen</a> Message.</p>
* <p>Freezes the Cart based on the provided <a href="https://docs.commercetools.com/apis/ctp:api:type:FreezeStrategy" rel="nofollow">FreezeStrategy</a>.</p>
* <p>The following behavior occurs:</p>
* <ul>
* <li>Changes the Cart State from <code>Active</code> to <code>Frozen</code>.</li>
* <li>Sets the corresponding <a href="https://docs.commercetools.com/apis/ctp:api:type:FreezeStrategy" rel="nofollow">FreezeStrategy</a> on the Cart's <code>freezeStrategy</code> field.</li>
* <li>Produces the <a href="https://docs.commercetools.com/apis/ctp:api:type:CartFrozenMessage" rel="nofollow">CartFrozen</a> Message.</li>
* </ul>
* <p>If the Cart is empty, an <a href="https://docs.commercetools.com/apis/ctp:api:type:InvalidOperationError" rel="nofollow">InvalidOperation</a> error is returned.</p>
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class CartFreezeCartActionImpl implements CartFreezeCartAction, ModelBase {

private String action;

private com.commercetools.api.models.cart.FreezeStrategy strategy;

/**
* create instance with all properties
*/
@JsonCreator
CartFreezeCartActionImpl(
@JsonProperty("strategy") final com.commercetools.api.models.cart.FreezeStrategy strategy) {
this.strategy = strategy;
this.action = FREEZE_CART;
}

/**
* create empty instance
*/
public CartFreezeCartActionImpl() {
this.action = FREEZE_CART;
}
Expand All @@ -40,6 +58,18 @@ public String getAction() {
return this.action;
}

/**
* <p>Strategy that determines the freezing behavior.</p>
*/

public com.commercetools.api.models.cart.FreezeStrategy getStrategy() {
return this.strategy;
}

public void setStrategy(final com.commercetools.api.models.cart.FreezeStrategy strategy) {
this.strategy = strategy;
}

@Override
public boolean equals(Object o) {
if (this == o)
Expand All @@ -50,17 +80,23 @@ public boolean equals(Object o) {

CartFreezeCartActionImpl that = (CartFreezeCartActionImpl) o;

return new EqualsBuilder().append(action, that.action).append(action, that.action).isEquals();
return new EqualsBuilder().append(action, that.action)
.append(strategy, that.strategy)
.append(action, that.action)
.append(strategy, that.strategy)
.isEquals();
}

@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(action).toHashCode();
return new HashCodeBuilder(17, 37).append(action).append(strategy).toHashCode();
}

@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("action", action).build();
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("action", action)
.append("strategy", strategy)
.build();
}

@Override
Expand Down
Loading