Skip to content

Commit 5130ef8

Browse files
committed
build(codegen): updating SDK
1 parent 8691205 commit 5130ef8

File tree

14 files changed

+339
-12
lines changed

14 files changed

+339
-12
lines changed

changes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<details>
44
<summary>Added Type(s)</summary>
55

6+
- added type `DiscountApplicationMode`
67
- added type `DeliveryCustomFieldAddedMessage`
78
- added type `DeliveryCustomFieldChangedMessage`
89
- added type `DeliveryCustomFieldRemovedMessage`
@@ -23,3 +24,11 @@
2324
- :warning: removed method `apiRoot.withProjectKey().me().businessUnits().withKey().delete()`
2425
</details>
2526

27+
28+
<details>
29+
<summary>Added Property(s)</summary>
30+
31+
- added property `applicationMode` to type `CartDiscountValueAbsolute`
32+
- added property `applicationMode` to type `CartDiscountValueAbsoluteDraft`
33+
</details>
34+

commercetools/commercetools-graphql-api/src/main/resources/graphql/schema.graphqls

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ input AWSLambdaDestinationInput {
4444
accessSecret: String!
4545
}
4646

47+
type AbsoluteCartDiscountValue implements CartDiscountValue {
48+
money: [Money!]!
49+
applicationMode: DiscountApplicationMode!
50+
type: String!
51+
}
52+
53+
input AbsoluteCartDiscountValueInput {
54+
money: [MoneyInput!]!
55+
applicationMode: DiscountApplicationMode!
56+
}
57+
4758
type AbsoluteDiscountValue implements CartDiscountValue & ProductDiscountValue {
4859
money: [Money!]!
4960
type: String!
@@ -1911,6 +1922,7 @@ input CartDiscountValueBaseMoneyInput {
19111922
input CartDiscountValueInput {
19121923
relative: RelativeDiscountValueInput
19131924
absolute: AbsoluteDiscountValueInput
1925+
absoluteCart: AbsoluteCartDiscountValueInput
19141926
fixed: FixedPriceDiscountValueInput
19151927
giftLineItem: GiftLineItemValueInput
19161928
}
@@ -3969,6 +3981,12 @@ type DirectDiscountDraftOutput {
39693981
target: CartDiscountTarget
39703982
}
39713983

3984+
enum DiscountApplicationMode {
3985+
ProportionateDistribution
3986+
EvenDistribution
3987+
IndividualApplication
3988+
}
3989+
39723990
"With discount codes it is possible to give specific cart discounts to an eligible amount of users. They are defined by a string value which can be added to a cart so that specific cart discounts can be applied to the cart."
39733991
type DiscountCode implements Versioned & ReferenceExpandable {
39743992
code: String!

commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountValueAbsolute.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ public interface CartDiscountValueAbsolute extends CartDiscountValue, CartDiscou
4848
@JsonProperty("money")
4949
public List<CentPrecisionMoney> getMoney();
5050

51+
/**
52+
* <p>Determines how the discount is applied on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.</p>
53+
* @return applicationMode
54+
*/
55+
56+
@JsonProperty("applicationMode")
57+
public DiscountApplicationMode getApplicationMode();
58+
5159
/**
5260
* <p>Cent precision money values in different currencies.</p>
5361
* @param money values to be set
@@ -63,6 +71,13 @@ public interface CartDiscountValueAbsolute extends CartDiscountValue, CartDiscou
6371

6472
public void setMoney(final List<CentPrecisionMoney> money);
6573

74+
/**
75+
* <p>Determines how the discount is applied on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.</p>
76+
* @param applicationMode value to be set
77+
*/
78+
79+
public void setApplicationMode(final DiscountApplicationMode applicationMode);
80+
6681
/**
6782
* factory method
6883
* @return instance of CartDiscountValueAbsolute
@@ -79,6 +94,7 @@ public static CartDiscountValueAbsolute of() {
7994
public static CartDiscountValueAbsolute of(final CartDiscountValueAbsolute template) {
8095
CartDiscountValueAbsoluteImpl instance = new CartDiscountValueAbsoluteImpl();
8196
instance.setMoney(template.getMoney());
97+
instance.setApplicationMode(template.getApplicationMode());
8298
return instance;
8399
}
84100

@@ -98,6 +114,7 @@ public static CartDiscountValueAbsolute deepCopy(@Nullable final CartDiscountVal
98114
.map(com.commercetools.api.models.common.CentPrecisionMoney::deepCopy)
99115
.collect(Collectors.toList()))
100116
.orElse(null));
117+
instance.setApplicationMode(template.getApplicationMode());
101118
return instance;
102119
}
103120

commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountValueAbsoluteBuilder.java

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import java.util.*;
55
import java.util.function.Function;
66

7+
import javax.annotation.Nullable;
8+
79
import io.vrap.rmf.base.client.Builder;
810
import io.vrap.rmf.base.client.utils.Generated;
911

@@ -24,6 +26,9 @@ public class CartDiscountValueAbsoluteBuilder implements Builder<CartDiscountVal
2426

2527
private java.util.List<com.commercetools.api.models.common.CentPrecisionMoney> money;
2628

29+
@Nullable
30+
private com.commercetools.api.models.cart_discount.DiscountApplicationMode applicationMode;
31+
2732
/**
2833
* <p>Cent precision money values in different currencies.</p>
2934
* @param money value to be set
@@ -113,6 +118,18 @@ public CartDiscountValueAbsoluteBuilder setMoney(
113118
return money(builder.apply(com.commercetools.api.models.common.CentPrecisionMoneyBuilder.of()));
114119
}
115120

121+
/**
122+
* <p>Determines how the discount is applied on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.</p>
123+
* @param applicationMode value to be set
124+
* @return Builder
125+
*/
126+
127+
public CartDiscountValueAbsoluteBuilder applicationMode(
128+
@Nullable final com.commercetools.api.models.cart_discount.DiscountApplicationMode applicationMode) {
129+
this.applicationMode = applicationMode;
130+
return this;
131+
}
132+
116133
/**
117134
* <p>Cent precision money values in different currencies.</p>
118135
* @return money
@@ -122,21 +139,31 @@ public java.util.List<com.commercetools.api.models.common.CentPrecisionMoney> ge
122139
return this.money;
123140
}
124141

142+
/**
143+
* <p>Determines how the discount is applied on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.</p>
144+
* @return applicationMode
145+
*/
146+
147+
@Nullable
148+
public com.commercetools.api.models.cart_discount.DiscountApplicationMode getApplicationMode() {
149+
return this.applicationMode;
150+
}
151+
125152
/**
126153
* builds CartDiscountValueAbsolute with checking for non-null required values
127154
* @return CartDiscountValueAbsolute
128155
*/
129156
public CartDiscountValueAbsolute build() {
130157
Objects.requireNonNull(money, CartDiscountValueAbsolute.class + ": money is missing");
131-
return new CartDiscountValueAbsoluteImpl(money);
158+
return new CartDiscountValueAbsoluteImpl(money, applicationMode);
132159
}
133160

134161
/**
135162
* builds CartDiscountValueAbsolute without checking for non-null required values
136163
* @return CartDiscountValueAbsolute
137164
*/
138165
public CartDiscountValueAbsolute buildUnchecked() {
139-
return new CartDiscountValueAbsoluteImpl(money);
166+
return new CartDiscountValueAbsoluteImpl(money, applicationMode);
140167
}
141168

142169
/**
@@ -155,6 +182,7 @@ public static CartDiscountValueAbsoluteBuilder of() {
155182
public static CartDiscountValueAbsoluteBuilder of(final CartDiscountValueAbsolute template) {
156183
CartDiscountValueAbsoluteBuilder builder = new CartDiscountValueAbsoluteBuilder();
157184
builder.money = template.getMoney();
185+
builder.applicationMode = template.getApplicationMode();
158186
return builder;
159187
}
160188

commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountValueAbsoluteDraft.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ public interface CartDiscountValueAbsoluteDraft
5050
@JsonProperty("money")
5151
public List<Money> getMoney();
5252

53+
/**
54+
* <p>Determines how the discount applies on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.</p>
55+
* <p>If not set, the default behavior is <code>ProportionateDistribution</code>.</p>
56+
* @return applicationMode
57+
*/
58+
59+
@JsonProperty("applicationMode")
60+
public DiscountApplicationMode getApplicationMode();
61+
5362
/**
5463
* <p>Money values in different currencies. An absolute Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10&euro; and 15$, the matching &euro; price will be decreased by 10&euro; and the matching $ price will be decreased by 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.</p>
5564
* <p>If the array is empty, the discount does not apply.</p>
@@ -67,6 +76,14 @@ public interface CartDiscountValueAbsoluteDraft
6776

6877
public void setMoney(final List<Money> money);
6978

79+
/**
80+
* <p>Determines how the discount applies on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.</p>
81+
* <p>If not set, the default behavior is <code>ProportionateDistribution</code>.</p>
82+
* @param applicationMode value to be set
83+
*/
84+
85+
public void setApplicationMode(final DiscountApplicationMode applicationMode);
86+
7087
/**
7188
* factory method
7289
* @return instance of CartDiscountValueAbsoluteDraft
@@ -83,6 +100,7 @@ public static CartDiscountValueAbsoluteDraft of() {
83100
public static CartDiscountValueAbsoluteDraft of(final CartDiscountValueAbsoluteDraft template) {
84101
CartDiscountValueAbsoluteDraftImpl instance = new CartDiscountValueAbsoluteDraftImpl();
85102
instance.setMoney(template.getMoney());
103+
instance.setApplicationMode(template.getApplicationMode());
86104
return instance;
87105
}
88106

@@ -102,6 +120,7 @@ public static CartDiscountValueAbsoluteDraft deepCopy(@Nullable final CartDiscou
102120
.map(com.commercetools.api.models.common.Money::deepCopy)
103121
.collect(Collectors.toList()))
104122
.orElse(null));
123+
instance.setApplicationMode(template.getApplicationMode());
105124
return instance;
106125
}
107126

commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountValueAbsoluteDraftBuilder.java

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import java.util.*;
55
import java.util.function.Function;
66

7+
import javax.annotation.Nullable;
8+
79
import io.vrap.rmf.base.client.Builder;
810
import io.vrap.rmf.base.client.utils.Generated;
911

@@ -24,6 +26,9 @@ public class CartDiscountValueAbsoluteDraftBuilder implements Builder<CartDiscou
2426

2527
private java.util.List<com.commercetools.api.models.common.Money> money;
2628

29+
@Nullable
30+
private com.commercetools.api.models.cart_discount.DiscountApplicationMode applicationMode;
31+
2732
/**
2833
* <p>Money values in different currencies. An absolute Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10&euro; and 15$, the matching &euro; price will be decreased by 10&euro; and the matching $ price will be decreased by 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.</p>
2934
* <p>If the array is empty, the discount does not apply.</p>
@@ -118,6 +123,19 @@ public CartDiscountValueAbsoluteDraftBuilder setMoney(
118123
return money(builder.apply(com.commercetools.api.models.common.MoneyBuilder.of()));
119124
}
120125

126+
/**
127+
* <p>Determines how the discount applies on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.</p>
128+
* <p>If not set, the default behavior is <code>ProportionateDistribution</code>.</p>
129+
* @param applicationMode value to be set
130+
* @return Builder
131+
*/
132+
133+
public CartDiscountValueAbsoluteDraftBuilder applicationMode(
134+
@Nullable final com.commercetools.api.models.cart_discount.DiscountApplicationMode applicationMode) {
135+
this.applicationMode = applicationMode;
136+
return this;
137+
}
138+
121139
/**
122140
* <p>Money values in different currencies. An absolute Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10&euro; and 15$, the matching &euro; price will be decreased by 10&euro; and the matching $ price will be decreased by 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.</p>
123141
* <p>If the array is empty, the discount does not apply.</p>
@@ -128,21 +146,32 @@ public java.util.List<com.commercetools.api.models.common.Money> getMoney() {
128146
return this.money;
129147
}
130148

149+
/**
150+
* <p>Determines how the discount applies on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.</p>
151+
* <p>If not set, the default behavior is <code>ProportionateDistribution</code>.</p>
152+
* @return applicationMode
153+
*/
154+
155+
@Nullable
156+
public com.commercetools.api.models.cart_discount.DiscountApplicationMode getApplicationMode() {
157+
return this.applicationMode;
158+
}
159+
131160
/**
132161
* builds CartDiscountValueAbsoluteDraft with checking for non-null required values
133162
* @return CartDiscountValueAbsoluteDraft
134163
*/
135164
public CartDiscountValueAbsoluteDraft build() {
136165
Objects.requireNonNull(money, CartDiscountValueAbsoluteDraft.class + ": money is missing");
137-
return new CartDiscountValueAbsoluteDraftImpl(money);
166+
return new CartDiscountValueAbsoluteDraftImpl(money, applicationMode);
138167
}
139168

140169
/**
141170
* builds CartDiscountValueAbsoluteDraft without checking for non-null required values
142171
* @return CartDiscountValueAbsoluteDraft
143172
*/
144173
public CartDiscountValueAbsoluteDraft buildUnchecked() {
145-
return new CartDiscountValueAbsoluteDraftImpl(money);
174+
return new CartDiscountValueAbsoluteDraftImpl(money, applicationMode);
146175
}
147176

148177
/**
@@ -161,6 +190,7 @@ public static CartDiscountValueAbsoluteDraftBuilder of() {
161190
public static CartDiscountValueAbsoluteDraftBuilder of(final CartDiscountValueAbsoluteDraft template) {
162191
CartDiscountValueAbsoluteDraftBuilder builder = new CartDiscountValueAbsoluteDraftBuilder();
163192
builder.money = template.getMoney();
193+
builder.applicationMode = template.getApplicationMode();
164194
return builder;
165195
}
166196

commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountValueAbsoluteDraftImpl.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@ public class CartDiscountValueAbsoluteDraftImpl implements CartDiscountValueAbso
2626

2727
private java.util.List<com.commercetools.api.models.common.Money> money;
2828

29+
private com.commercetools.api.models.cart_discount.DiscountApplicationMode applicationMode;
30+
2931
/**
3032
* create instance with all properties
3133
*/
3234
@JsonCreator
3335
CartDiscountValueAbsoluteDraftImpl(
34-
@JsonProperty("money") final java.util.List<com.commercetools.api.models.common.Money> money) {
36+
@JsonProperty("money") final java.util.List<com.commercetools.api.models.common.Money> money,
37+
@JsonProperty("applicationMode") final com.commercetools.api.models.cart_discount.DiscountApplicationMode applicationMode) {
3538
this.money = money;
39+
this.applicationMode = applicationMode;
3640
this.type = ABSOLUTE;
3741
}
3842

@@ -60,6 +64,15 @@ public java.util.List<com.commercetools.api.models.common.Money> getMoney() {
6064
return this.money;
6165
}
6266

67+
/**
68+
* <p>Determines how the discount applies on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.</p>
69+
* <p>If not set, the default behavior is <code>ProportionateDistribution</code>.</p>
70+
*/
71+
72+
public com.commercetools.api.models.cart_discount.DiscountApplicationMode getApplicationMode() {
73+
return this.applicationMode;
74+
}
75+
6376
public void setMoney(final com.commercetools.api.models.common.Money... money) {
6477
this.money = new ArrayList<>(Arrays.asList(money));
6578
}
@@ -68,6 +81,11 @@ public void setMoney(final java.util.List<com.commercetools.api.models.common.Mo
6881
this.money = money;
6982
}
7083

84+
public void setApplicationMode(
85+
final com.commercetools.api.models.cart_discount.DiscountApplicationMode applicationMode) {
86+
this.applicationMode = applicationMode;
87+
}
88+
7189
@Override
7290
public boolean equals(Object o) {
7391
if (this == o)
@@ -80,20 +98,23 @@ public boolean equals(Object o) {
8098

8199
return new EqualsBuilder().append(type, that.type)
82100
.append(money, that.money)
101+
.append(applicationMode, that.applicationMode)
83102
.append(type, that.type)
84103
.append(money, that.money)
104+
.append(applicationMode, that.applicationMode)
85105
.isEquals();
86106
}
87107

88108
@Override
89109
public int hashCode() {
90-
return new HashCodeBuilder(17, 37).append(type).append(money).toHashCode();
110+
return new HashCodeBuilder(17, 37).append(type).append(money).append(applicationMode).toHashCode();
91111
}
92112

93113
@Override
94114
public String toString() {
95115
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("type", type)
96116
.append("money", money)
117+
.append("applicationMode", applicationMode)
97118
.build();
98119
}
99120

0 commit comments

Comments
 (0)