Skip to content

Commit 712502a

Browse files
authored
v4.4.0: Customer Inventory Enhancements, Rule Failure Reasons and Import Endpoints (#20)
<i id="toc"></i> ## Summary - [Management API](#user-content-management-api) - [Expose Import Endpoints](#user-content-expose-import-endpoints) - [Introduce `updateReferral` Endpoint](#user-content-update-referral) - [Integration API](#user-content-integration-api) - [Improve Responses Transparency](#user-content-improve-responses) - [Extended Customer Inventory Endpoint](#user-content-customer-inventory) - [Attach Loyalty Program ID in responses](#user-content-attach-loyalty-id) - [A reminder of The Deprecation Notice: Integration API@v1 endpoints](#user-content-deprecation-reminder) <i id="management-api"></i> ## Management API <i id="expose-import-endpoints"></i> ### Expose import endpoints as integral part of the SDK All of our CSV import endpoints are accessible via the Web Application from the corresponding entity pages (refer to our [Help Center](https://help.talon.one/hc/en-us/articles/360010114599-Import-and-Export-Coupons#ImportCoupons) for an example regarding Coupons). Now these are also available endpoints as part of the SDK (links to our developer docs): - [Coupons Import](https://developers.talon.one/Management-API/API-Reference#importCoupons) - [Referrals Import](https://developers.talon.one/Management-API/API-Reference#importReferrals) - [Loyalty Points Import](https://developers.talon.one/Management-API/API-Reference#importLoyaltyPoints) - [Giveaway Codes Import](https://developers.talon.one/Management-API/API-Reference#importPoolGiveaways) Example code snippet demonstrating import coupons using a CSV file: ```java // ...preparing api client... // An example could be seen at the repository's README file: https://github.com/talon-one/TalonOneJavaSdk#management-api try { Integer applicationId = 1; Integer campaignId = 184; File upFile = new File("path/to/coupons.csv"); ModelImport response = api.importCoupons(applicationId, campaignId, upFile); } catch (FileNotFoundException e) { System.out.println("CSV file was not found."); e.printStackTrace(); } catch (Exception e) { System.out.println("Error while importing coupons."); System.out.println(e); } ``` [☝️ Back to Table of Contents](#user-content-toc) <i id="update-referral"></i> ### Introduce [`updateReferral`](https://developers.talon.one/Management-API/API-Reference#updateReferral) Endpoint We introduced an endpoint to update referrals in order to allow updating their scheduling, usage limits and custom attributes attached to them. Please consult [the endpoint reference](https://developers.talon.one/Management-API/API-Reference#updateReferral) in our developer docs for more details. [☝️ Back to Table of Contents](#user-content-toc) <i id="integration-api"></i> ## Integration API <i id="improve-responses"></i> ### Improve Responses Transparency We are constantly extending and improving our integration API to provide our consumers with the best transparency regarding what exactly has happened within their requests. We have added new data points to our **v2 endpoints** effects in order to improve the transparency we aspire for: - If an effect was triggered because of a specific coupon the effect will now include this coupon ID, see [`Effect.md`](https://github.com/talon-one/TalonOneJavaSdk/blob/e63620817d5e7bb07e0b6bd9ef515a6b38257524/docs/Effect.md#L15) - When a coupon is rejected we attach more details regarding the origin of the failure in [`RejectCouponEffectProps`](https://github.com/talon-one/TalonOneJavaSdk/blob/1042bd65a2a48296d38591f652fa967fe096af1c/docs/RejectCouponEffectProps.md#L12-L14): - `conditionIndex` - The index of the condition that caused the rejection of the coupon - `effectIndex` - The index of the effect that caused the rejection of the coupon - `details` - More details about the failure (if available) - The same applies for referrals, when a referral is rejected we attach more details regarding the origin of the failure in [`RejectReferralEffectProps`](https://github.com/talon-one/TalonOneJavaSdk/blob/1042bd65a2a48296d38591f652fa967fe096af1c/docs/RejectReferralEffectProps.md#L12-L14): - `conditionIndex` - The index of the condition that caused the rejection of the referral - `effectIndex` - The index of the effect that caused the rejection of the referral - `details` - More details about the failure (if available) Moreover, we have introduced a new [response content](https://github.com/talon-one/TalonOneJavaSdk/blob/1042bd65a2a48296d38591f652fa967fe096af1c/src/main/java/one/talon/model/IntegrationRequest.java#L61), `RuleFailureReasons`, which when requested will attach to the response a collection containing **all failed rules**, with details (see the [`RuleFailureReason` model](https://github.com/talon-one/TalonOneJavaSdk/blob/1042bd65a2a48296d38591f652fa967fe096af1c/docs/RuleFailureReason.md) to help narrowing down failures and further debugging efforts to a specific single condition or effect that caused the failure. _One "gotcha" to keep in mind_: in order to maximize transparency, and due to the fact that we do not know in advance which campaign in the application the request targets, the list contains a collection of **all** failure reasons. Meaning that, it might have "white noise" with data about failures that could be considered as "obvious" to the consumer. Therefore, we suggest always filtering the list by the campaign id that was expected to trigger and did not. [☝️ Back to Table of Contents](#user-content-toc) <i id="customer-inventory"></i> ### Extended Customer Inventory Endpoint We have added a couple of useful data points to our customer inventory to make integration even simpler. #### ⚠️⚠️ It involves a breaking change when calling the operation ```diff IntegrationApi apiInstance = new IntegrationApi(defaultClient); String integrationId = "integrationId_example"; // String | The custom identifier for this profile, must be unique within the account. Boolean profile = true; // Boolean | optional flag to decide if you would like customer profile information in the response Boolean referrals = true; // Boolean | optional flag to decide if you would like referral information in the response Boolean coupons = true; // Boolean | optional flag to decide if you would like coupon information in the response Boolean loyalty = true; // Boolean | optional flag to decide if you would like loyalty information in the response +Boolean giveaways = true; // Boolean | optional flag to decide if you would like giveaways information in the response - CustomerInventory result = apiInstance.getCustomerInventory(integrationId, profile, referrals, coupons, loyalty); + CustomerInventory result = apiInstance.getCustomerInventory(integrationId, profile, referrals, coupons, loyalty, giveaways); // ... ``` We are aware of the inconvenience, and as explained in #16, we are working on a better and improved implementation to avoid these breaking changes in the future. As one can see, customer inventory now has the ability to return giveaway codes that belong to the profile in query. In order to learn more about setting up such campaigns refer to [this help center article](https://help.talon.one/hc/en-us/articles/360020631099-Giveaway-Campaigns) and [this developer docs tutorial](https://developers.talon.one/Tutorials/creating-giveaways). We have also extended the coupons objects that are returned as part of the inventory and attached these two useful data-points to each returned coupon: - `profileRedemptionCount` - holds the number of times the coupon was redeemed by the profile - `state` - holds the state of the coupon and can be one of the below values: - **_active_**: reserved coupons that are neither pending nor used nor expired, and have a non-exhausted limit counter - **_used_**: coupons that are not pending, and have reached their redemption limit or were redeemed by the profile before expiration - **_expired_**: all non-pending, non-active, non-used coupons that were not redeemed by the profile - **_pending_**: coupons that have a start date in the future [☝️ Back to Table of Contents](#user-content-toc) <i id="attach-loyalty-id"></i> ### Attach Loyalty Program ID in responses When the consumer requires that the response will contain the details of loyalty programs involved in processing the requests, we now attach the identifier of the loyalty program to the returned [`LoyaltyProgramLedgers` models](https://github.com/talon-one/TalonOneJavaSdk/blob/1042bd65a2a48296d38591f652fa967fe096af1c/docs/LoyaltyProgramLedgers.md#L10). The idea behind attaching the identifier is to help streamline further potential requests to our Management API with regard to details about a Loyalty Program, for example [getLoyaltyStatistics](https://developers.talon.one/Management-API/API-Reference#getLoyaltyStatistics) or [getLoyaltyPoints](https://developers.talon.one/Management-API/API-Reference#getLoyaltyPoints), that require the program identifier as part of the URI of the endpoint. [☝️ Back to Table of Contents](#user-content-toc) <i id="deprecation-reminder"></i> ### ⚠️ A reminder of The Deprecation Notice: Integration API@v1 endpoints The deprecation was introduced already in the last release of the SDK, here is a kind reminder of the deprecation notices for Integration API@v1 endpoints: - [Update a Customer Session (V1)](https://github.com/talon-one/TalonOneJavaSdk/blob/1042bd65a2a48296d38591f652fa967fe096af1c/docs/IntegrationApi.md#updatecustomersession) - [Update a Customer Profile (V1)](https://github.com/talon-one/TalonOneJavaSdk/blob/1042bd65a2a48296d38591f652fa967fe096af1c/docs/IntegrationApi.md#updatecustomerprofile) These endpoints will be flagged deprecated on _15.07.2021_, meaning support for requests to these endpoints will end on that date. **We will not remove the endpoints**, and they will still be accessible for you to use. We highly encourage migrating to the correspondent v2 endpoints for easier and more granular integration, as well as new features support (See [our developer docs section](https://developers.talon.one/Getting-Started/APIV2) about API V2.0). [☝️ Back to Table of Contents](#user-content-toc)
1 parent e636208 commit 712502a

File tree

221 files changed

+14903
-2430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+14903
-2430
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ bundle:
2222
cp target/talon-one-client-$(VERSION).jar $(DIST)
2323

2424
prepare: build bundle
25+
26+
testenv:
27+
docker run \
28+
--rm -it \
29+
-v $(PWD):/tmp/talon-client \
30+
-w "/tmp/talon-client" \
31+
maven:3.5.2-jdk-9-slim \
32+
/bin/bash

README.md

Lines changed: 41 additions & 11 deletions
Large diffs are not rendered by default.

api/openapi.yaml

Lines changed: 2627 additions & 818 deletions
Large diffs are not rendered by default.

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.1'
6+
version = '4.4.0'
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.1",
5+
version := "4.4.0",
66
scalaVersion := "2.11.4",
77
scalacOptions ++= Seq("-feature"),
88
javacOptions in compile ++= Seq("-Xlint:deprecation"),

docs/ApplicationCampaignStats.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
3+
# ApplicationCampaignStats
4+
5+
Provides statistics regarding an application's campaigns
6+
## Properties
7+
8+
Name | Type | Description | Notes
9+
------------ | ------------- | ------------- | -------------
10+
**draft** | **Integer** | Number of draft campaigns |
11+
**disabled** | **Integer** | Number of disabled campaigns |
12+
**scheduled** | **Integer** | Number of scheduled campaigns |
13+
**running** | **Integer** | Number of running campaigns |
14+
**expired** | **Integer** | Number of expired campaigns |
15+
**archived** | **Integer** | Number of archived campaigns |
16+
17+
18+

docs/ApplicationEvent.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Name | Type | Description | Notes
1515
**type** | **String** | A string representing the event. Must not be a reserved event name. |
1616
**attributes** | [**Object**](.md) | Additional JSON serialized data associated with the event. |
1717
**effects** | **List&lt;Object&gt;** | An array containing the effects that were applied as a result of this event. |
18+
**ruleFailureReasons** | [**List&lt;RuleFailureReason&gt;**](RuleFailureReason.md) | An array containing the rule failure reasons which happened during this event. | [optional]
1819

1920

2021

docs/ApplicationReferee.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
3+
# ApplicationReferee
4+
5+
6+
## Properties
7+
8+
Name | Type | Description | Notes
9+
------------ | ------------- | ------------- | -------------
10+
**applicationId** | **Integer** | The ID of the application that owns this entity. |
11+
**sessionId** | **String** | Integration ID of the session in which the customer redeemed the referral |
12+
**advocateIntegrationId** | **String** | Integration ID of the Advocate&#39;s Profile |
13+
**friendIntegrationId** | **String** | Integration ID of the Friend&#39;s Profile |
14+
**code** | **String** | Advocate&#39;s referral code. |
15+
**created** | [**OffsetDateTime**](OffsetDateTime.md) | Timestamp of the moment the customer redeemed the referral |
16+
17+
18+

docs/Attribute.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ CUSTOMERSESSION | &quot;CustomerSession&quot;
3434
CARTITEM | &quot;CartItem&quot;
3535
COUPON | &quot;Coupon&quot;
3636
EVENT | &quot;Event&quot;
37+
GIVEAWAY | &quot;Giveaway&quot;
38+
REFERRAL | &quot;Referral&quot;
3739

3840

3941

docs/AwardGiveawayEffectProps.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
# AwardGiveawayEffectProps
4+
5+
The properties specific to the \"awardGiveaway\" effect. This effect contains information on the giveaway item, and which profile it was awarded to.
6+
## Properties
7+
8+
Name | Type | Description | Notes
9+
------------ | ------------- | ------------- | -------------
10+
**poolId** | **Integer** | The ID of the giveaways pool the code was taken from. |
11+
**poolName** | **String** | The name of the giveaways pool the code was taken from. |
12+
**recipientIntegrationId** | **String** | The integration ID of the profile that was awarded the giveaway. |
13+
**giveawayId** | **Integer** | The internal ID for the giveaway that was awarded. |
14+
**code** | **String** | The giveaway code that was awarded. |
15+
16+
17+

0 commit comments

Comments
 (0)