Skip to content

Commit e636208

Browse files
authored
v4.3.1: Introduce triggeredByCoupon property for Effects (#19)
## Summary ### Integration API Introducing property `triggeredByCoupon` on [`Effect`](https://github.com/talon-one/TalonOneJavaSdk/blob/master/src/main/java/one/talon/model/Effect.java) entities returned from our integration API, which holds the `id` of the related coupon. This should increase observability and allow to make deductions with regard to whether an effect was triggered directly by a coupon. In order to match the coupon from the property, pass `coupons` as part of the `responseContent` array passed to the [`/v2/customer_session` endpoint](https://developers.talon.one/Integration-API/API-Reference#updateCustomerSessionV2). Then you would be able to lookup the `id` of the returned coupons and match the corresponding one to the property from the new field `triggeredByCoupon`.
1 parent 3ce141f commit e636208

File tree

12 files changed

+112
-10
lines changed

12 files changed

+112
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Add this dependency to your project's POM:
4949
<dependency>
5050
<groupId>one.talon</groupId>
5151
<artifactId>talon-one-client</artifactId>
52-
<version>4.3.0</version>
52+
<version>4.3.1</version>
5353
<scope>compile</scope>
5454
</dependency>
5555
```
@@ -59,7 +59,7 @@ Add this dependency to your project's POM:
5959
Add this dependency to your project's build file:
6060

6161
```groovy
62-
compile "one.talon:talon-one-client:4.3.0"
62+
compile "one.talon:talon-one-client:4.3.1"
6363
```
6464

6565
### Others
@@ -72,7 +72,7 @@ mvn clean package
7272

7373
Then manually install the following JARs:
7474

75-
* `target/talon-one-client-4.3.0.jar`
75+
* `target/talon-one-client-4.3.1.jar`
7676
* `target/lib/*.jar`
7777

7878
## Getting Started

api/openapi.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5212,6 +5212,7 @@ components:
52125212
couponPattern:
52135213
description: |
52145214
The pattern that will be used to generate coupon codes. The character `#` acts as a placeholder and will be replaced by a random character from the `validCharacters` set.
5215+
maxLength: 100
52155216
minLength: 3
52165217
type: string
52175218
required:
@@ -6750,6 +6751,7 @@ components:
67506751
couponPattern:
67516752
description: |
67526753
The pattern that will be used to generate coupon codes. The character `#` acts as a placeholder and will be replaced by a random character from the `validCharacters` set.
6754+
maxLength: 100
67536755
minLength: 3
67546756
type: string
67556757
required:
@@ -6817,6 +6819,7 @@ components:
68176819
couponPattern:
68186820
description: |
68196821
The pattern that will be used to generate coupon codes. The character `#` acts as a placeholder and will be replaced by a random character from the `validCharacters` set.
6822+
maxLength: 100
68206823
minLength: 3
68216824
type: string
68226825
required:
@@ -8551,10 +8554,12 @@ components:
85518554
type: string
85528555
coupon:
85538556
description: Any coupon code entered.
8557+
maxLength: 100
85548558
title: Coupon entered in session
85558559
type: string
85568560
referral:
85578561
description: Any referral code entered.
8562+
maxLength: 100
85588563
title: Referral code entered in session
85598564
type: string
85608565
state:
@@ -8646,11 +8651,13 @@ components:
86468651
couponCodes:
86478652
description: Any coupon codes entered.
86488653
items:
8654+
maxLength: 100
86498655
type: string
86508656
title: Coupons entered in session
86518657
type: array
86528658
referralCode:
86538659
description: Any referral code entered.
8660+
maxLength: 100
86548661
title: Referral code entered in session
86558662
type: string
86568663
state:
@@ -8873,10 +8880,12 @@ components:
88738880
type: string
88748881
coupon:
88758882
description: Any coupon code entered.
8883+
maxLength: 100
88768884
title: Coupon entered in session
88778885
type: string
88788886
referral:
88798887
description: Any referral code entered.
8888+
maxLength: 100
88808889
title: Referral code entered in session
88818890
type: string
88828891
state:
@@ -9012,11 +9021,13 @@ components:
90129021
couponCodes:
90139022
description: Any coupon codes entered.
90149023
items:
9024+
maxLength: 100
90159025
type: string
90169026
title: Coupons entered in session
90179027
type: array
90189028
referralCode:
90199029
description: Any referral code entered.
9030+
maxLength: 100
90209031
title: Referral code entered in session
90219032
type: string
90229033
state:
@@ -9487,12 +9498,14 @@ components:
94879498
ruleIndex: 8
94889499
campaignId: 4
94899500
ruleName: ruleName
9501+
triggeredByCoupon: 4
94909502
effectType: effectType
94919503
props: '{}'
94929504
- rulesetId: 6
94939505
ruleIndex: 8
94949506
campaignId: 4
94959507
ruleName: ruleName
9508+
triggeredByCoupon: 4
94969509
effectType: effectType
94979510
props: '{}'
94989511
referral:
@@ -12172,6 +12185,7 @@ components:
1217212185
ruleIndex: 8
1217312186
campaignId: 4
1217412187
ruleName: ruleName
12188+
triggeredByCoupon: 4
1217512189
effectType: effectType
1217612190
props: '{}'
1217712191
properties:
@@ -12192,6 +12206,10 @@ components:
1219212206
effectType:
1219312207
description: The type of effect that was triggered
1219412208
type: string
12209+
triggeredByCoupon:
12210+
description: The ID of the coupon that was being evaluated when this effect
12211+
was triggered
12212+
type: integer
1219512213
props:
1219612214
type: object
1219712215
required:
@@ -12223,6 +12241,10 @@ components:
1222312241
effectType:
1222412242
description: The type of effect that was triggered
1222512243
type: string
12244+
triggeredByCoupon:
12245+
description: The ID of the coupon that was being evaluated when this effect
12246+
was triggered
12247+
type: integer
1222612248
required:
1222712249
- campaignId
1222812250
- effectType
@@ -12804,12 +12826,14 @@ components:
1280412826
ruleIndex: 8
1280512827
campaignId: 4
1280612828
ruleName: ruleName
12829+
triggeredByCoupon: 4
1280712830
effectType: effectType
1280812831
props: '{}'
1280912832
- rulesetId: 6
1281012833
ruleIndex: 8
1281112834
campaignId: 4
1281212835
ruleName: ruleName
12836+
triggeredByCoupon: 4
1281312837
effectType: effectType
1281412838
props: '{}'
1281512839
referral:
@@ -13163,12 +13187,14 @@ components:
1316313187
ruleIndex: 8
1316413188
campaignId: 4
1316513189
ruleName: ruleName
13190+
triggeredByCoupon: 4
1316613191
effectType: effectType
1316713192
props: '{}'
1316813193
- rulesetId: 6
1316913194
ruleIndex: 8
1317013195
campaignId: 4
1317113196
ruleName: ruleName
13197+
triggeredByCoupon: 4
1317213198
effectType: effectType
1317313199
props: '{}'
1317413200
referral:

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'eclipse'
33
apply plugin: 'java'
44

55
group = 'one.talon'
6-
version = '4.3.0'
6+
version = '4.3.1'
77

88
buildscript {
99
repositories {

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
22
settings(
33
organization := "one.talon",
44
name := "talon-one-client",
5-
version := "4.3.0",
5+
version := "4.3.1",
66
scalaVersion := "2.11.4",
77
scalacOptions ++= Seq("-feature"),
88
javacOptions in compile ++= Seq("-Xlint:deprecation"),

docs/Effect.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Name | Type | Description | Notes
1212
**ruleIndex** | **Integer** | The position of the rule that triggered this effect within the ruleset |
1313
**ruleName** | **String** | The name of the rule that triggered this effect |
1414
**effectType** | **String** | The type of effect that was triggered |
15+
**triggeredByCoupon** | **Integer** | The ID of the coupon that was being evaluated when this effect was triggered | [optional]
1516
**props** | [**Object**](.md) | |
1617

1718

docs/EffectEntity.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Name | Type | Description | Notes
1212
**ruleIndex** | **Integer** | The position of the rule that triggered this effect within the ruleset |
1313
**ruleName** | **String** | The name of the rule that triggered this effect |
1414
**effectType** | **String** | The type of effect that was triggered |
15+
**triggeredByCoupon** | **Integer** | The ID of the coupon that was being evaluated when this effect was triggered | [optional]
1516

1617

1718

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>talon-one-client</artifactId>
66
<packaging>jar</packaging>
77
<name>talon-one-client</name>
8-
<version>4.3.0</version>
8+
<version>4.3.1</version>
99
<url>https://github.com/talon-one/maven-artefacts</url>
1010
<description>Talon.One unified JAVA SDK. It allows for programmatic access to the integration and management API with their respective authentication strategies</description>
1111
<scm>

src/main/java/one/talon/ApiClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private void init() {
128128
json = new JSON();
129129

130130
// Set default User-Agent.
131-
setUserAgent("OpenAPI-Generator/4.3.0/java");
131+
setUserAgent("OpenAPI-Generator/4.3.1/java");
132132

133133
authentications = new HashMap<String, Authentication>();
134134
}

src/main/java/one/talon/model/Effect.java

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public class Effect {
5050
@SerializedName(SERIALIZED_NAME_EFFECT_TYPE)
5151
private String effectType;
5252

53+
public static final String SERIALIZED_NAME_TRIGGERED_BY_COUPON = "triggeredByCoupon";
54+
@SerializedName(SERIALIZED_NAME_TRIGGERED_BY_COUPON)
55+
private Integer triggeredByCoupon;
56+
5357
public static final String SERIALIZED_NAME_PROPS = "props";
5458
@SerializedName(SERIALIZED_NAME_PROPS)
5559
private Object props;
@@ -165,6 +169,29 @@ public void setEffectType(String effectType) {
165169
}
166170

167171

172+
public Effect triggeredByCoupon(Integer triggeredByCoupon) {
173+
174+
this.triggeredByCoupon = triggeredByCoupon;
175+
return this;
176+
}
177+
178+
/**
179+
* The ID of the coupon that was being evaluated when this effect was triggered
180+
* @return triggeredByCoupon
181+
**/
182+
@javax.annotation.Nullable
183+
@ApiModelProperty(value = "The ID of the coupon that was being evaluated when this effect was triggered")
184+
185+
public Integer getTriggeredByCoupon() {
186+
return triggeredByCoupon;
187+
}
188+
189+
190+
public void setTriggeredByCoupon(Integer triggeredByCoupon) {
191+
this.triggeredByCoupon = triggeredByCoupon;
192+
}
193+
194+
168195
public Effect props(Object props) {
169196

170197
this.props = props;
@@ -201,12 +228,13 @@ public boolean equals(java.lang.Object o) {
201228
Objects.equals(this.ruleIndex, effect.ruleIndex) &&
202229
Objects.equals(this.ruleName, effect.ruleName) &&
203230
Objects.equals(this.effectType, effect.effectType) &&
231+
Objects.equals(this.triggeredByCoupon, effect.triggeredByCoupon) &&
204232
Objects.equals(this.props, effect.props);
205233
}
206234

207235
@Override
208236
public int hashCode() {
209-
return Objects.hash(campaignId, rulesetId, ruleIndex, ruleName, effectType, props);
237+
return Objects.hash(campaignId, rulesetId, ruleIndex, ruleName, effectType, triggeredByCoupon, props);
210238
}
211239

212240

@@ -219,6 +247,7 @@ public String toString() {
219247
sb.append(" ruleIndex: ").append(toIndentedString(ruleIndex)).append("\n");
220248
sb.append(" ruleName: ").append(toIndentedString(ruleName)).append("\n");
221249
sb.append(" effectType: ").append(toIndentedString(effectType)).append("\n");
250+
sb.append(" triggeredByCoupon: ").append(toIndentedString(triggeredByCoupon)).append("\n");
222251
sb.append(" props: ").append(toIndentedString(props)).append("\n");
223252
sb.append("}");
224253
return sb.toString();

src/main/java/one/talon/model/EffectEntity.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public class EffectEntity {
5050
@SerializedName(SERIALIZED_NAME_EFFECT_TYPE)
5151
private String effectType;
5252

53+
public static final String SERIALIZED_NAME_TRIGGERED_BY_COUPON = "triggeredByCoupon";
54+
@SerializedName(SERIALIZED_NAME_TRIGGERED_BY_COUPON)
55+
private Integer triggeredByCoupon;
56+
5357

5458
public EffectEntity campaignId(Integer campaignId) {
5559

@@ -161,6 +165,29 @@ public void setEffectType(String effectType) {
161165
}
162166

163167

168+
public EffectEntity triggeredByCoupon(Integer triggeredByCoupon) {
169+
170+
this.triggeredByCoupon = triggeredByCoupon;
171+
return this;
172+
}
173+
174+
/**
175+
* The ID of the coupon that was being evaluated when this effect was triggered
176+
* @return triggeredByCoupon
177+
**/
178+
@javax.annotation.Nullable
179+
@ApiModelProperty(value = "The ID of the coupon that was being evaluated when this effect was triggered")
180+
181+
public Integer getTriggeredByCoupon() {
182+
return triggeredByCoupon;
183+
}
184+
185+
186+
public void setTriggeredByCoupon(Integer triggeredByCoupon) {
187+
this.triggeredByCoupon = triggeredByCoupon;
188+
}
189+
190+
164191
@Override
165192
public boolean equals(java.lang.Object o) {
166193
if (this == o) {
@@ -174,12 +201,13 @@ public boolean equals(java.lang.Object o) {
174201
Objects.equals(this.rulesetId, effectEntity.rulesetId) &&
175202
Objects.equals(this.ruleIndex, effectEntity.ruleIndex) &&
176203
Objects.equals(this.ruleName, effectEntity.ruleName) &&
177-
Objects.equals(this.effectType, effectEntity.effectType);
204+
Objects.equals(this.effectType, effectEntity.effectType) &&
205+
Objects.equals(this.triggeredByCoupon, effectEntity.triggeredByCoupon);
178206
}
179207

180208
@Override
181209
public int hashCode() {
182-
return Objects.hash(campaignId, rulesetId, ruleIndex, ruleName, effectType);
210+
return Objects.hash(campaignId, rulesetId, ruleIndex, ruleName, effectType, triggeredByCoupon);
183211
}
184212

185213

@@ -192,6 +220,7 @@ public String toString() {
192220
sb.append(" ruleIndex: ").append(toIndentedString(ruleIndex)).append("\n");
193221
sb.append(" ruleName: ").append(toIndentedString(ruleName)).append("\n");
194222
sb.append(" effectType: ").append(toIndentedString(effectType)).append("\n");
223+
sb.append(" triggeredByCoupon: ").append(toIndentedString(triggeredByCoupon)).append("\n");
195224
sb.append("}");
196225
return sb.toString();
197226
}

0 commit comments

Comments
 (0)