Skip to content

Commit

Permalink
adding support for ordered_from, brand_name, site_* top level fields,…
Browse files Browse the repository at this point in the history
… and *_language fields in browser and app complex fields (#52)

* adding support for ordered_from, brand_name, site_* top level fields, and *_language fields in browser and app complex fields
  • Loading branch information
rsomavarapu-sift authored Feb 20, 2020
1 parent a51157a commit 7d6317c
Show file tree
Hide file tree
Showing 29 changed files with 541 additions and 58 deletions.
7 changes: 7 additions & 0 deletions CHANGES.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
3.3.0 (2020-02-19)
=================
- Add support for `$client_language` field to `$app` complex field
- Add support for `$accept_language` and `$content_language` fields to `$browser` complex field
- Add support for `$brand_name`, `$site_country` and `$site_domain` fields to custom events and all reserved events except `$chargeback`, `$link_session_to_user` and `$flag_content`
- Add support for `$ordered_from` complex field to `$create_order`, `$update_order`, and `$transaction` events

3.2.0 (2019-07-31)
=================
- Add support for `$tags` field to `$booking` complex field
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Java 1.7 or later.
<dependency>
<groupId>com.siftscience</groupId>
<artifactId>sift-java</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</dependency>
```
### Gradle
```
dependencies {
compile 'com.siftscience:sift-java:3.2.0'
compile 'com.siftscience:sift-java:3.3.0'
}
```
### Other
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'signing'
apply plugin: 'java-library-distribution'

group = 'com.siftscience'
version = '3.2.0'
version = '3.3.0'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class AddItemToCartFieldSet extends BaseAppBrowserFieldSet<AddItemToCartFieldSet> {
public class AddItemToCartFieldSet extends BaseAppBrowserSiteBrandFieldSet<AddItemToCartFieldSet> {
public static AddItemToCartFieldSet fromJson(String json) {
return gson.fromJson(json, AddItemToCartFieldSet.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import java.util.List;

public class AddPromotionFieldSet extends BaseAppBrowserFieldSet<AddPromotionFieldSet> {
public class AddPromotionFieldSet extends BaseAppBrowserSiteBrandFieldSet<AddPromotionFieldSet> {
public static AddPromotionFieldSet fromJson(String json) {
return gson.fromJson(json, AddPromotionFieldSet.class);
}
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/siftscience/model/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class App {
@Expose @SerializedName("$device_unique_id") private String deviceUniqueId;
@Expose @SerializedName("$app_name") private String appName;
@Expose @SerializedName("$app_version") private String appVersion;
@Expose @SerializedName("$client_language") private String clientLanguage;

public String getOperatingSystem() {
return operatingSystem;
Expand Down Expand Up @@ -74,4 +75,13 @@ public App setAppVersion(String appVersion) {
this.appVersion = appVersion;
return this;
}

public String getClientLanguage() {
return clientLanguage;
}

public App setClientLanguage(String clientLanguage) {
this.clientLanguage = clientLanguage;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.List;

public abstract class BaseAccountFieldSet<T extends BaseAccountFieldSet<T>>
extends BaseAppBrowserFieldSet<T> {
extends BaseAppBrowserSiteBrandFieldSet<T> {
@Expose @SerializedName("$user_email") private String userEmail;
@Expose @SerializedName("$name") private String name;
@Expose @SerializedName("$phone") private String phone;
Expand Down
29 changes: 0 additions & 29 deletions src/main/java/com/siftscience/model/BaseAppBrowserFieldSet.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.siftscience.model;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public abstract class BaseAppBrowserSiteBrandFieldSet<T extends BaseAppBrowserSiteBrandFieldSet<T>>
extends EventsApiRequestFieldSet<T> {
@Expose @SerializedName("$app") private App app;
@Expose @SerializedName("$browser") private Browser browser;
@Expose @SerializedName("$brand_name") private String brandName;
@Expose @SerializedName("$site_country") private String siteCountry;
@Expose @SerializedName("$site_domain") private String siteDomain;

public App getApp() {
return app;
}

public T setApp(App app) {
this.app = app;
return (T) this;
}

public Browser getBrowser() {
return browser;
}

public T setBrowser(Browser browser) {
this.browser = browser;
return (T) this;
}

public String getBrandName() {
return brandName;
}

public T setBrandName(String brandName) {
this.brandName = brandName;
return (T) this;
}

public String getSiteCountry() {
return siteCountry;
}

public T setSiteCountry(String siteCountry) {
this.siteCountry = siteCountry;
return (T) this;
}

public String getSiteDomain() {
return siteDomain;
}

public T setSiteDomain(String siteDomain) {
this.siteDomain = siteDomain;
return (T) this;
}
}
4 changes: 1 addition & 3 deletions src/main/java/com/siftscience/model/BaseContentFieldSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

import java.util.List;

public abstract class BaseContentFieldSet<T extends BaseContentFieldSet<T>>
extends BaseAppBrowserFieldSet<T> {
extends BaseAppBrowserSiteBrandFieldSet<T> {
@Expose @SerializedName("$content_id") private String contentId;
@Expose @SerializedName("$status") private String status;

Expand Down
12 changes: 11 additions & 1 deletion src/main/java/com/siftscience/model/BaseOrderFieldSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.List;

public abstract class BaseOrderFieldSet<T extends BaseOrderFieldSet<T>>
extends BaseAppBrowserFieldSet<T> {
extends BaseAppBrowserSiteBrandFieldSet<T> {
@Expose @SerializedName("$order_id") private String orderId;
@Expose @SerializedName("$user_email") private String userEmail;
@Expose @SerializedName("$amount") private Long amount;
Expand All @@ -20,6 +20,7 @@ public abstract class BaseOrderFieldSet<T extends BaseOrderFieldSet<T>>
@Expose @SerializedName("$promotions") private List<Promotion> promotions;
@Expose @SerializedName("$shipping_method") private String shippingMethod;
@Expose @SerializedName("$bookings") private List<Booking> bookings;
@Expose @SerializedName("$ordered_from") private OrderedFrom orderedFrom;

public String getOrderId() {
return orderId;
Expand Down Expand Up @@ -141,4 +142,13 @@ public T setShippingMethod(String shippingMethod) {
this.shippingMethod = shippingMethod;
return (T) this;
}

public OrderedFrom getOrderedFrom() {
return orderedFrom;
}

public T setOrderedFrom(OrderedFrom orderedFrom) {
this.orderedFrom = orderedFrom;
return (T) this;
}
}
21 changes: 21 additions & 0 deletions src/main/java/com/siftscience/model/Browser.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

public class Browser {
@Expose @SerializedName("$user_agent") private String userAgent;
@Expose @SerializedName("$accept_language") private String acceptLanguage;
@Expose @SerializedName("$content_language") private String contentLanguage;

public String getUserAgent() {
return userAgent;
Expand All @@ -14,4 +16,23 @@ public Browser setUserAgent(String userAgent) {
this.userAgent = userAgent;
return this;
}

public String getAcceptLanguage() {
return acceptLanguage;
}

public Browser setAcceptLanguage(String acceptLanguage) {
this.acceptLanguage = acceptLanguage;
return this;
}

public String getContentLanguage() {
return contentLanguage;
}

public Browser setContentLanguage(String contentLanguage) {
this.contentLanguage = contentLanguage;
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class ContentStatusFieldSet extends BaseAppBrowserFieldSet<ContentStatusFieldSet> {
public class ContentStatusFieldSet extends BaseAppBrowserSiteBrandFieldSet<ContentStatusFieldSet> {
public static ContentStatusFieldSet fromJson(String json) {
return gson.fromJson(json, ContentStatusFieldSet.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class CustomEventFieldSet extends BaseAppBrowserFieldSet<CustomEventFieldSet> {
public class CustomEventFieldSet extends BaseAppBrowserSiteBrandFieldSet<CustomEventFieldSet> {
public static CustomEventFieldSet fromJson(String json) {
return gson.fromJson(json, CustomEventFieldSet.class);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/siftscience/model/LoginFieldSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class LoginFieldSet extends BaseAppBrowserFieldSet<LoginFieldSet> {
public class LoginFieldSet extends BaseAppBrowserSiteBrandFieldSet<LoginFieldSet> {
public static LoginFieldSet fromJson(String json) {
return gson.fromJson(json, LoginFieldSet.class);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/siftscience/model/LogoutFieldSet.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.siftscience.model;

public class LogoutFieldSet extends BaseAppBrowserFieldSet<LogoutFieldSet> {
public class LogoutFieldSet extends BaseAppBrowserSiteBrandFieldSet<LogoutFieldSet> {
public static LogoutFieldSet fromJson(String json) {
return gson.fromJson(json, LogoutFieldSet.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class OrderStatusFieldSet extends BaseAppBrowserFieldSet<OrderStatusFieldSet> {
public class OrderStatusFieldSet extends BaseAppBrowserSiteBrandFieldSet<OrderStatusFieldSet> {
public static OrderStatusFieldSet fromJson(String json) {
return gson.fromJson(json, OrderStatusFieldSet.class);
}
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/com/siftscience/model/OrderedFrom.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.siftscience.model;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class OrderedFrom {
@Expose @SerializedName("$store_address") private Address storeAddress;
@Expose @SerializedName("$store_id") private String storeId;

public Address getStoreAddress() {
return storeAddress;
}

public OrderedFrom setStoreAddress(Address storeAddress) {
this.storeAddress = storeAddress;
return this;
}

public String getStoreId() {
return storeId;
}

public OrderedFrom setStoreId(String storeId) {
this.storeId = storeId;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class RemoveItemFromCartFieldSet extends BaseAppBrowserFieldSet<RemoveItemFromCartFieldSet> {
public class RemoveItemFromCartFieldSet extends BaseAppBrowserSiteBrandFieldSet<RemoveItemFromCartFieldSet> {
public static RemoveItemFromCartFieldSet fromJson(String json) {
return gson.fromJson(json, RemoveItemFromCartFieldSet.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.google.gson.annotations.SerializedName;

public class SecurityNotificationFieldSet extends
BaseAppBrowserFieldSet<SecurityNotificationFieldSet> {
BaseAppBrowserSiteBrandFieldSet<SecurityNotificationFieldSet> {
public static SecurityNotificationFieldSet fromJson(String json) {
return gson.fromJson(json, SecurityNotificationFieldSet.class);
}
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/com/siftscience/model/TransactionFieldSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class TransactionFieldSet extends BaseAppBrowserFieldSet<TransactionFieldSet> {
public class TransactionFieldSet extends BaseAppBrowserSiteBrandFieldSet<TransactionFieldSet> {
@Expose @SerializedName("$amount") private Long amount;
@Expose @SerializedName("$currency_code") private String currencyCode;
@Expose @SerializedName("$user_email") private String userEmail;
Expand All @@ -16,6 +16,7 @@ public class TransactionFieldSet extends BaseAppBrowserFieldSet<TransactionField
@Expose @SerializedName("$shipping_address") private Address shippingAddress;
@Expose @SerializedName("$seller_user_id") private String sellerUserId;
@Expose @SerializedName("$transfer_recipient_user_id") private String transferRecipientUserId;
@Expose @SerializedName("$ordered_from") private OrderedFrom orderedFrom;

@Override
public String getEventType() {
Expand Down Expand Up @@ -133,4 +134,13 @@ public TransactionFieldSet setTransferRecipientUserId(String transferRecipientUs
this.transferRecipientUserId = transferRecipientUserId;
return this;
}

public OrderedFrom getOrderedFrom() {
return orderedFrom;
}

public TransactionFieldSet setOrderedFrom(OrderedFrom orderedFrom) {
this.orderedFrom = orderedFrom;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class UpdatePasswordFieldSet extends BaseAppBrowserFieldSet<UpdatePasswordFieldSet> {
public class UpdatePasswordFieldSet extends BaseAppBrowserSiteBrandFieldSet<UpdatePasswordFieldSet> {
public static UpdatePasswordFieldSet fromJson(String json) {
return gson.fromJson(json, UpdatePasswordFieldSet.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class VerificationFieldSet extends BaseAppBrowserFieldSet<VerificationFieldSet> {
public class VerificationFieldSet extends BaseAppBrowserSiteBrandFieldSet<VerificationFieldSet> {
public static VerificationFieldSet fromJson(String json) {
return gson.fromJson(json, VerificationFieldSet.class);
}
Expand Down
Loading

0 comments on commit 7d6317c

Please sign in to comment.