Skip to content

Commit

Permalink
v4.3.1: Introduce triggeredByCoupon property for Effects (#19)
Browse files Browse the repository at this point in the history
## 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`.
  • Loading branch information
altJake committed Dec 22, 2020
1 parent 3ce141f commit e636208
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>one.talon</groupId>
<artifactId>talon-one-client</artifactId>
<version>4.3.0</version>
<version>4.3.1</version>
<scope>compile</scope>
</dependency>
```
Expand All @@ -59,7 +59,7 @@ Add this dependency to your project's POM:
Add this dependency to your project's build file:

```groovy
compile "one.talon:talon-one-client:4.3.0"
compile "one.talon:talon-one-client:4.3.1"
```

### Others
Expand All @@ -72,7 +72,7 @@ mvn clean package

Then manually install the following JARs:

* `target/talon-one-client-4.3.0.jar`
* `target/talon-one-client-4.3.1.jar`
* `target/lib/*.jar`

## Getting Started
Expand Down
26 changes: 26 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5212,6 +5212,7 @@ components:
couponPattern:
description: |
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.
maxLength: 100
minLength: 3
type: string
required:
Expand Down Expand Up @@ -6750,6 +6751,7 @@ components:
couponPattern:
description: |
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.
maxLength: 100
minLength: 3
type: string
required:
Expand Down Expand Up @@ -6817,6 +6819,7 @@ components:
couponPattern:
description: |
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.
maxLength: 100
minLength: 3
type: string
required:
Expand Down Expand Up @@ -8551,10 +8554,12 @@ components:
type: string
coupon:
description: Any coupon code entered.
maxLength: 100
title: Coupon entered in session
type: string
referral:
description: Any referral code entered.
maxLength: 100
title: Referral code entered in session
type: string
state:
Expand Down Expand Up @@ -8646,11 +8651,13 @@ components:
couponCodes:
description: Any coupon codes entered.
items:
maxLength: 100
type: string
title: Coupons entered in session
type: array
referralCode:
description: Any referral code entered.
maxLength: 100
title: Referral code entered in session
type: string
state:
Expand Down Expand Up @@ -8873,10 +8880,12 @@ components:
type: string
coupon:
description: Any coupon code entered.
maxLength: 100
title: Coupon entered in session
type: string
referral:
description: Any referral code entered.
maxLength: 100
title: Referral code entered in session
type: string
state:
Expand Down Expand Up @@ -9012,11 +9021,13 @@ components:
couponCodes:
description: Any coupon codes entered.
items:
maxLength: 100
type: string
title: Coupons entered in session
type: array
referralCode:
description: Any referral code entered.
maxLength: 100
title: Referral code entered in session
type: string
state:
Expand Down Expand Up @@ -9487,12 +9498,14 @@ components:
ruleIndex: 8
campaignId: 4
ruleName: ruleName
triggeredByCoupon: 4
effectType: effectType
props: '{}'
- rulesetId: 6
ruleIndex: 8
campaignId: 4
ruleName: ruleName
triggeredByCoupon: 4
effectType: effectType
props: '{}'
referral:
Expand Down Expand Up @@ -12172,6 +12185,7 @@ components:
ruleIndex: 8
campaignId: 4
ruleName: ruleName
triggeredByCoupon: 4
effectType: effectType
props: '{}'
properties:
Expand All @@ -12192,6 +12206,10 @@ components:
effectType:
description: The type of effect that was triggered
type: string
triggeredByCoupon:
description: The ID of the coupon that was being evaluated when this effect
was triggered
type: integer
props:
type: object
required:
Expand Down Expand Up @@ -12223,6 +12241,10 @@ components:
effectType:
description: The type of effect that was triggered
type: string
triggeredByCoupon:
description: The ID of the coupon that was being evaluated when this effect
was triggered
type: integer
required:
- campaignId
- effectType
Expand Down Expand Up @@ -12804,12 +12826,14 @@ components:
ruleIndex: 8
campaignId: 4
ruleName: ruleName
triggeredByCoupon: 4
effectType: effectType
props: '{}'
- rulesetId: 6
ruleIndex: 8
campaignId: 4
ruleName: ruleName
triggeredByCoupon: 4
effectType: effectType
props: '{}'
referral:
Expand Down Expand Up @@ -13163,12 +13187,14 @@ components:
ruleIndex: 8
campaignId: 4
ruleName: ruleName
triggeredByCoupon: 4
effectType: effectType
props: '{}'
- rulesetId: 6
ruleIndex: 8
campaignId: 4
ruleName: ruleName
triggeredByCoupon: 4
effectType: effectType
props: '{}'
referral:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'eclipse'
apply plugin: 'java'

group = 'one.talon'
version = '4.3.0'
version = '4.3.1'

buildscript {
repositories {
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
settings(
organization := "one.talon",
name := "talon-one-client",
version := "4.3.0",
version := "4.3.1",
scalaVersion := "2.11.4",
scalacOptions ++= Seq("-feature"),
javacOptions in compile ++= Seq("-Xlint:deprecation"),
Expand Down
1 change: 1 addition & 0 deletions docs/Effect.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**ruleIndex** | **Integer** | The position of the rule that triggered this effect within the ruleset |
**ruleName** | **String** | The name of the rule that triggered this effect |
**effectType** | **String** | The type of effect that was triggered |
**triggeredByCoupon** | **Integer** | The ID of the coupon that was being evaluated when this effect was triggered | [optional]
**props** | [**Object**](.md) | |


Expand Down
1 change: 1 addition & 0 deletions docs/EffectEntity.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**ruleIndex** | **Integer** | The position of the rule that triggered this effect within the ruleset |
**ruleName** | **String** | The name of the rule that triggered this effect |
**effectType** | **String** | The type of effect that was triggered |
**triggeredByCoupon** | **Integer** | The ID of the coupon that was being evaluated when this effect was triggered | [optional]



2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>talon-one-client</artifactId>
<packaging>jar</packaging>
<name>talon-one-client</name>
<version>4.3.0</version>
<version>4.3.1</version>
<url>https://github.com/talon-one/maven-artefacts</url>
<description>Talon.One unified JAVA SDK. It allows for programmatic access to the integration and management API with their respective authentication strategies</description>
<scm>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/one/talon/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private void init() {
json = new JSON();

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

authentications = new HashMap<String, Authentication>();
}
Expand Down
31 changes: 30 additions & 1 deletion src/main/java/one/talon/model/Effect.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public class Effect {
@SerializedName(SERIALIZED_NAME_EFFECT_TYPE)
private String effectType;

public static final String SERIALIZED_NAME_TRIGGERED_BY_COUPON = "triggeredByCoupon";
@SerializedName(SERIALIZED_NAME_TRIGGERED_BY_COUPON)
private Integer triggeredByCoupon;

public static final String SERIALIZED_NAME_PROPS = "props";
@SerializedName(SERIALIZED_NAME_PROPS)
private Object props;
Expand Down Expand Up @@ -165,6 +169,29 @@ public void setEffectType(String effectType) {
}


public Effect triggeredByCoupon(Integer triggeredByCoupon) {

this.triggeredByCoupon = triggeredByCoupon;
return this;
}

/**
* The ID of the coupon that was being evaluated when this effect was triggered
* @return triggeredByCoupon
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "The ID of the coupon that was being evaluated when this effect was triggered")

public Integer getTriggeredByCoupon() {
return triggeredByCoupon;
}


public void setTriggeredByCoupon(Integer triggeredByCoupon) {
this.triggeredByCoupon = triggeredByCoupon;
}


public Effect props(Object props) {

this.props = props;
Expand Down Expand Up @@ -201,12 +228,13 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.ruleIndex, effect.ruleIndex) &&
Objects.equals(this.ruleName, effect.ruleName) &&
Objects.equals(this.effectType, effect.effectType) &&
Objects.equals(this.triggeredByCoupon, effect.triggeredByCoupon) &&
Objects.equals(this.props, effect.props);
}

@Override
public int hashCode() {
return Objects.hash(campaignId, rulesetId, ruleIndex, ruleName, effectType, props);
return Objects.hash(campaignId, rulesetId, ruleIndex, ruleName, effectType, triggeredByCoupon, props);
}


Expand All @@ -219,6 +247,7 @@ public String toString() {
sb.append(" ruleIndex: ").append(toIndentedString(ruleIndex)).append("\n");
sb.append(" ruleName: ").append(toIndentedString(ruleName)).append("\n");
sb.append(" effectType: ").append(toIndentedString(effectType)).append("\n");
sb.append(" triggeredByCoupon: ").append(toIndentedString(triggeredByCoupon)).append("\n");
sb.append(" props: ").append(toIndentedString(props)).append("\n");
sb.append("}");
return sb.toString();
Expand Down
33 changes: 31 additions & 2 deletions src/main/java/one/talon/model/EffectEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public class EffectEntity {
@SerializedName(SERIALIZED_NAME_EFFECT_TYPE)
private String effectType;

public static final String SERIALIZED_NAME_TRIGGERED_BY_COUPON = "triggeredByCoupon";
@SerializedName(SERIALIZED_NAME_TRIGGERED_BY_COUPON)
private Integer triggeredByCoupon;


public EffectEntity campaignId(Integer campaignId) {

Expand Down Expand Up @@ -161,6 +165,29 @@ public void setEffectType(String effectType) {
}


public EffectEntity triggeredByCoupon(Integer triggeredByCoupon) {

this.triggeredByCoupon = triggeredByCoupon;
return this;
}

/**
* The ID of the coupon that was being evaluated when this effect was triggered
* @return triggeredByCoupon
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "The ID of the coupon that was being evaluated when this effect was triggered")

public Integer getTriggeredByCoupon() {
return triggeredByCoupon;
}


public void setTriggeredByCoupon(Integer triggeredByCoupon) {
this.triggeredByCoupon = triggeredByCoupon;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand All @@ -174,12 +201,13 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.rulesetId, effectEntity.rulesetId) &&
Objects.equals(this.ruleIndex, effectEntity.ruleIndex) &&
Objects.equals(this.ruleName, effectEntity.ruleName) &&
Objects.equals(this.effectType, effectEntity.effectType);
Objects.equals(this.effectType, effectEntity.effectType) &&
Objects.equals(this.triggeredByCoupon, effectEntity.triggeredByCoupon);
}

@Override
public int hashCode() {
return Objects.hash(campaignId, rulesetId, ruleIndex, ruleName, effectType);
return Objects.hash(campaignId, rulesetId, ruleIndex, ruleName, effectType, triggeredByCoupon);
}


Expand All @@ -192,6 +220,7 @@ public String toString() {
sb.append(" ruleIndex: ").append(toIndentedString(ruleIndex)).append("\n");
sb.append(" ruleName: ").append(toIndentedString(ruleName)).append("\n");
sb.append(" effectType: ").append(toIndentedString(effectType)).append("\n");
sb.append(" triggeredByCoupon: ").append(toIndentedString(triggeredByCoupon)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/one/talon/model/EffectEntityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,12 @@ public void effectTypeTest() {
// TODO: test effectType
}

/**
* Test the property 'triggeredByCoupon'
*/
@Test
public void triggeredByCouponTest() {
// TODO: test triggeredByCoupon
}

}
8 changes: 8 additions & 0 deletions src/test/java/one/talon/model/EffectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ public void effectTypeTest() {
// TODO: test effectType
}

/**
* Test the property 'triggeredByCoupon'
*/
@Test
public void triggeredByCouponTest() {
// TODO: test triggeredByCoupon
}

/**
* Test the property 'props'
*/
Expand Down

0 comments on commit e636208

Please sign in to comment.