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

- added type `AssociateRoleNameSetMessage`
- added type `AssociateRoleNameSetMessagePayload`
- added type `BestDeal`
- added type `DiscountTypeCombination`
- added type `Stacking`
</details>


<details>
<summary>Removed Type(s)</summary>
<summary>Added Property(s)</summary>

- :warning: removed type `AssociateRoleNameChangedMessage`
- :warning: removed type `AssociateRoleNameChangedMessagePayload`
</details>

**History changes**

<details>
<summary>Removed Enum(s)</summary>

- :warning: removed enum `setAsssetKey` from type `UpdateType`
</details>


<details>
<summary>Added Enum(s)</summary>

- added enum `setAssetKey` to type `UpdateType`
- added property `discountTypeCombination` to type `Cart`
- added property `discountTypeCombination` to type `StagedOrder`
- added property `discountTypeCombination` to type `Order`
</details>

Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,7 @@ type Cart implements Versioned & ReferenceExpandable {
taxedShippingPrice: TaxedPrice
shippingMode: ShippingMode!
shippingCustomFields: CustomFieldsType
discountTypeCombination: DiscountTypeCombination
cartState: CartState!
key: String
custom: CustomFieldsType
Expand Down Expand Up @@ -1963,6 +1964,25 @@ input CartDiscountValueInput {
giftLineItem: GiftLineItemValueInput
}

"Chosen discount type for the cart as part of best deal"
enum ChosenDiscountType {
CartDiscount
ProductDiscount
}

interface DiscountTypeCombination {
type: String!
}

type Stacking implements DiscountTypeCombination {
type: String!
}

type BestDeal implements DiscountTypeCombination {
type: String!
chosenDiscountType: ChosenDiscountType
}

input CartDraft {
currency: Currency!
country: Country
Expand Down Expand Up @@ -6820,6 +6840,7 @@ type Order implements Versioned & ReferenceExpandable {
shippingInfo: ShippingInfo
discountCodes: [DiscountCodeInfo!]!
directDiscounts: [DirectDiscount!]!
discountTypeCombination: DiscountTypeCombination
refusedGifts: [CartDiscount!]!
refusedGiftsRefs: [Reference!]!
paymentInfo: PaymentInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@

package com.commercetools.api.models.cart;

import java.time.*;
import java.util.*;
import java.util.function.Function;

import javax.annotation.Nullable;

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

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

import jakarta.validation.constraints.NotNull;

/**
* <p>Indicates the best deal logic applies to a Cart or Order and indicates the discount type that offers the best deal.</p>
*
* <hr>
* Example to create an instance using the builder pattern
* <div class=code-example>
* <pre><code class='java'>
* BestDeal bestDeal = BestDeal.builder()
* .chosenDiscountType("{chosenDiscountType}")
* .build()
* </code></pre>
* </div>
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
@JsonDeserialize(as = BestDealImpl.class)
public interface BestDeal extends DiscountTypeCombination {

/**
* discriminator value for BestDeal
*/
String BEST_DEAL = "BestDeal";

/**
* <p>Discount type that offers the best deal; the value can be <code>product-discount</code> or <code>cart-discount</code>.</p>
* @return chosenDiscountType
*/
@NotNull
@JsonProperty("chosenDiscountType")
public String getChosenDiscountType();

/**
* <p>Discount type that offers the best deal; the value can be <code>product-discount</code> or <code>cart-discount</code>.</p>
* @param chosenDiscountType value to be set
*/

public void setChosenDiscountType(final String chosenDiscountType);

/**
* factory method
* @return instance of BestDeal
*/
public static BestDeal of() {
return new BestDealImpl();
}

/**
* factory method to create a shallow copy BestDeal
* @param template instance to be copied
* @return copy instance
*/
public static BestDeal of(final BestDeal template) {
BestDealImpl instance = new BestDealImpl();
instance.setChosenDiscountType(template.getChosenDiscountType());
return instance;
}

/**
* factory method to create a deep copy of BestDeal
* @param template instance to be copied
* @return copy instance
*/
@Nullable
public static BestDeal deepCopy(@Nullable final BestDeal template) {
if (template == null) {
return null;
}
BestDealImpl instance = new BestDealImpl();
instance.setChosenDiscountType(template.getChosenDiscountType());
return instance;
}

/**
* builder factory method for BestDeal
* @return builder
*/
public static BestDealBuilder builder() {
return BestDealBuilder.of();
}

/**
* create builder for BestDeal instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static BestDealBuilder builder(final BestDeal template) {
return BestDealBuilder.of(template);
}

/**
* accessor map function
* @param <T> mapped type
* @param helper function to map the object
* @return mapped value
*/
default <T> T withBestDeal(Function<BestDeal, T> helper) {
return helper.apply(this);
}

/**
* gives a TypeReference for usage with Jackson DataBind
* @return TypeReference
*/
public static com.fasterxml.jackson.core.type.TypeReference<BestDeal> typeReference() {
return new com.fasterxml.jackson.core.type.TypeReference<BestDeal>() {

Check warning on line 120 in commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/BestDeal.java

View check run for this annotation

Codecov / codecov/patch

commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/BestDeal.java#L120

Added line #L120 was not covered by tests
@Override
public String toString() {
return "TypeReference<BestDeal>";

Check warning on line 123 in commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/BestDeal.java

View check run for this annotation

Codecov / codecov/patch

commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/BestDeal.java#L123

Added line #L123 was not covered by tests
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@

package com.commercetools.api.models.cart;

import java.util.*;

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

/**
* BestDealBuilder
* <hr>
* Example to create an instance using the builder pattern
* <div class=code-example>
* <pre><code class='java'>
* BestDeal bestDeal = BestDeal.builder()
* .chosenDiscountType("{chosenDiscountType}")
* .build()
* </code></pre>
* </div>
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class BestDealBuilder implements Builder<BestDeal> {

private String chosenDiscountType;

/**
* <p>Discount type that offers the best deal; the value can be <code>product-discount</code> or <code>cart-discount</code>.</p>
* @param chosenDiscountType value to be set
* @return Builder
*/

public BestDealBuilder chosenDiscountType(final String chosenDiscountType) {
this.chosenDiscountType = chosenDiscountType;
return this;
}

/**
* <p>Discount type that offers the best deal; the value can be <code>product-discount</code> or <code>cart-discount</code>.</p>
* @return chosenDiscountType
*/

public String getChosenDiscountType() {
return this.chosenDiscountType;
}

/**
* builds BestDeal with checking for non-null required values
* @return BestDeal
*/
public BestDeal build() {
Objects.requireNonNull(chosenDiscountType, BestDeal.class + ": chosenDiscountType is missing");
return new BestDealImpl(chosenDiscountType);
}

/**
* builds BestDeal without checking for non-null required values
* @return BestDeal
*/
public BestDeal buildUnchecked() {
return new BestDealImpl(chosenDiscountType);
}

/**
* factory method for an instance of BestDealBuilder
* @return builder
*/
public static BestDealBuilder of() {
return new BestDealBuilder();
}

/**
* create builder for BestDeal instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static BestDealBuilder of(final BestDeal template) {
BestDealBuilder builder = new BestDealBuilder();
builder.chosenDiscountType = template.getChosenDiscountType();
return builder;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

package com.commercetools.api.models.cart;

import java.time.*;
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;
import io.vrap.rmf.base.client.utils.Generated;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
* <p>Indicates the best deal logic applies to a Cart or Order and indicates the discount type that offers the best deal.</p>
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class BestDealImpl implements BestDeal, ModelBase {

private String type;

private String chosenDiscountType;

/**
* create instance with all properties
*/
@JsonCreator
BestDealImpl(@JsonProperty("chosenDiscountType") final String chosenDiscountType) {
this.chosenDiscountType = chosenDiscountType;
this.type = BEST_DEAL;
}

/**
* create empty instance
*/
public BestDealImpl() {
this.type = BEST_DEAL;
}

/**
*
*/

public String getType() {
return this.type;
}

/**
* <p>Discount type that offers the best deal; the value can be <code>product-discount</code> or <code>cart-discount</code>.</p>
*/

public String getChosenDiscountType() {
return this.chosenDiscountType;
}

public void setChosenDiscountType(final String chosenDiscountType) {
this.chosenDiscountType = chosenDiscountType;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;

if (o == null || getClass() != o.getClass())
return false;

BestDealImpl that = (BestDealImpl) o;

return new EqualsBuilder().append(type, that.type)
.append(chosenDiscountType, that.chosenDiscountType)
.append(type, that.type)
.append(chosenDiscountType, that.chosenDiscountType)
.isEquals();
}

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

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

}
Loading