Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.20.0 (2025-05-12)
=================
- Added support for `$promotions` complex field to `$update_account` event fields
- Added support for `$iata_carrier_code` to the `$segment` complex field
- Removed support for `$iata_carrier_code` in the `$booking` complex field

3.19.0 (2025-04-24)
=================
- Added support for `$exchange_rate` complex field to `$transaction`, `$create_order`,
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.19.0</version>
<version>3.20.0</version>
</dependency>
```
### Gradle
```
dependencies {
compile 'com.siftscience:sift-java:3.19.0'
compile 'com.siftscience:sift-java:3.20.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.19.0'
version = '3.20.0'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/siftscience/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
public class Constants {

public static final String API_VERSION = "v205";
public static final String LIB_VERSION = "3.19.0";
public static final String LIB_VERSION = "3.20.0";
public static final String USER_AGENT_HEADER = String.format("SiftScience/%s sift-java/%s", API_VERSION, LIB_VERSION);
}
10 changes: 10 additions & 0 deletions src/main/java/com/siftscience/model/BaseAccountFieldSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public abstract class BaseAccountFieldSet<T extends BaseAccountFieldSet<T>>
@Expose @SerializedName("$payment_methods") private List<PaymentMethod> paymentMethods;
@Expose @SerializedName("$billing_address") private Address billingAddress;
@Expose @SerializedName("$shipping_address") private Address shippingAddress;
@Expose @SerializedName("$promotions") private List<Promotion> promotions;
@Expose @SerializedName("$social_sign_on_type") private String socialSignOnType;
@Expose @SerializedName("$merchant_profile") private MerchantProfile merchantProfile;
@Expose @SerializedName(VERIFICATION_PHONE_NUMBER) private String verificationPhoneNumber;
Expand Down Expand Up @@ -107,4 +108,13 @@ public T setVerificationPhoneNumber(String verificationPhoneNumber) {
this.verificationPhoneNumber = verificationPhoneNumber;
return (T) this;
}

public List<Promotion> getPromotions() {
return promotions;
}

public T setPromotions(List<Promotion> promotions) {
this.promotions = promotions;
return (T) this;
}
}
10 changes: 0 additions & 10 deletions src/main/java/com/siftscience/model/Booking.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class Booking {
@Expose @SerializedName("$currency_code") private String currencyCode;
@Expose @SerializedName("$exchange_rate") private ExchangeRate exchangeRate;
@Expose @SerializedName("$quantity") private Long quantity;
@Expose @SerializedName("$iata_carrier_code") private String iataCarrierCode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure nobody started using $iata_carrier_code with booking $booking?

@Expose @SerializedName("$guests") private List<Guest> guests;
@Expose @SerializedName("$segments") private List<Segment> segments;
@Expose @SerializedName("$room_type") private String roomType;
Expand Down Expand Up @@ -96,15 +95,6 @@ public Booking setQuantity(Long quantity) {
return this;
}

public String getIataCarrierCode() {
return iataCarrierCode;
}

public Booking setIataCarrierCode(String iataCarrierCode) {
this.iataCarrierCode = iataCarrierCode;
return this;
}

public List<Guest> getGuests() {
return guests;
}
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/com/siftscience/model/CreateAccountFieldSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,12 @@ public static CreateAccountFieldSet fromJson(String json) {
}

@Expose @SerializedName("$account_types") private List<String> accountTypes;
@Expose @SerializedName("$promotions") private List<Promotion> promotions;

@Override
public String getEventType() {
return "$create_account";
}

public List<Promotion> getPromotions() {
return promotions;
}

public CreateAccountFieldSet setPromotions(List<Promotion> promotions) {
this.promotions = promotions;
return this;
}

public List<String> getAccountTypes() { return accountTypes; }

public CreateAccountFieldSet setAccountTypes(List<String> accountTypes) {
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/siftscience/model/Segment.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Segment {
@Expose @SerializedName("$arrival_airport_code") private String arrivalAirportCode;
@Expose @SerializedName("$departure_airport_code") private String departureAirportCode;
@Expose @SerializedName("$fare_class") private String fareClass;
@Expose @SerializedName("$iata_carrier_code") private String iataCarrierCode;


public Address getDepartureAddress() {
Expand Down Expand Up @@ -85,4 +86,21 @@ public Segment setFareClass(String fareClass) {
this.fareClass = fareClass;
return this;
}

public String getIataCarrierCode() {
return iataCarrierCode;
}

/**
* Sets the IATA carrier code for the flight segment.
*
* <p>This field should only be set when the booking type is {@code $flight}.</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think we need to assess where enhanced validation is needed and what that effort may be as a possible tech debt project?

*
* @param iataCarrierCode The IATA carrier code.
* @return The updated {@code Segment} object.
*/
public Segment setIataCarrierCode(String iataCarrierCode) {
this.iataCarrierCode = iataCarrierCode;
return this;
}
}
4 changes: 2 additions & 2 deletions src/test/java/com/siftscience/CreateOrderEventTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ public void testCreateOrderEventWithBookings() throws JSONException, IOException
" \"$vessel_number\": \"LH454\",\n" +
" \"$fare_class\": \"Premium Economy\",\n" +
" \"$departure_airport_code\": \"SFO\",\n" +
" \"$arrival_airport_code\": \"LAS\"\n" +
" \"$arrival_airport_code\": \"LAS\",\n" +
" \"$iata_carrier_code\": \"AS\"\n" +
" }\n" +
" ],\n" +
" \"$price\": 49900000,\n" +
" \"$currency_code\": \"USD\",\n" +
" \"$iata_carrier_code\": \"AS\",\n" +
" \"$quantity\": 1,\n" +
" \"$tags\": [\n" +
" \"team-123\",\n" +
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/siftscience/SiftRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void testUserAgentHeader() throws Exception {

// then
RecordedRequest recordedRequest = server.takeRequest();
assertEquals("SiftScience/v205 sift-java/3.19.0",
assertEquals("SiftScience/v205 sift-java/3.20.0",
recordedRequest.getHeader("User-Agent"));
}

Expand Down
5 changes: 3 additions & 2 deletions src/test/java/com/siftscience/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ static Booking sampleBooking() {
.setSegments(segments)
.setPrice(49900000L)
.setCurrencyCode("USD")
.setIataCarrierCode("AS")
.setTags(sampleTags3())
.setQuantity(1L);
}
Expand Down Expand Up @@ -243,8 +242,10 @@ static Segment sampleSegment() {
.setVesselNumber("LH454")
.setFareClass("Premium Economy")
.setDepartureAirportCode("SFO")
.setArrivalAirportCode("LAS");
.setArrivalAirportCode("LAS")
.setIataCarrierCode("AS");
}

static Discount sampleDiscount1() {
return new Discount()
.setAmount(5000000L)
Expand Down
17 changes: 17 additions & 0 deletions src/test/java/com/siftscience/UpdateAccountEventTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.List;

import com.siftscience.model.PaymentMethod;
import com.siftscience.model.Promotion;
import com.siftscience.model.UpdateAccountFieldSet;
import okhttp3.OkHttpClient;
import okhttp3.mockwebserver.MockResponse;
Expand Down Expand Up @@ -55,6 +56,17 @@ public void testUpdateAccount() throws Exception {
" \"$country\" : \"US\",\n" +
" \"$zipcode\" : \"03257\"\n" +
" },\n" +
" \"$promotions\" : [\n" +
" {\n" +
" \"$promotion_id\" : \"FriendReferral\",\n" +
" \"$status\" : \"$success\",\n" +
" \"$referrer_user_id\" : \"janejane102\",\n" +
" \"$credit_point\" : {\n" +
" \"$amount\" : 100,\n" +
" \"$credit_point_type\" : \"account karma\"\n" +
" }\n" +
" }\n" +
" ],\n" +
" \"$social_sign_on_type\" : \"$twitter\",\n" +
" \"email_confirmed_status\" : \"$success\",\n" +
" \"phone_confirmed_status\" : \"$success\",\n" +
Expand Down Expand Up @@ -99,6 +111,10 @@ public void testUpdateAccount() throws Exception {
List<PaymentMethod> paymentMethodList = new ArrayList<>();
paymentMethodList.add(TestUtils.samplePaymentMethod2());

// Promotions.
List<Promotion> promotionList = new ArrayList<>();
promotionList.add(TestUtils.samplePromotion2());

// Build and execute the request against the mock server.
SiftRequest request = client.buildRequest(
new UpdateAccountFieldSet()
Expand All @@ -111,6 +127,7 @@ public void testUpdateAccount() throws Exception {
.setPaymentMethods(paymentMethodList)
.setBillingAddress(TestUtils.sampleAddress2())
.setShippingAddress(TestUtils.sampleAddress2())
.setPromotions(promotionList)
.setSocialSignOnType("$twitter")
.setCustomField("email_confirmed_status", "$success")
.setCustomField("phone_confirmed_status", "$success")
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/siftscience/UpdateOrderEventTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ public void testUpdateOrderEventWithBookings() throws JSONException, IOException
" \"$vessel_number\": \"LH454\",\n" +
" \"$fare_class\": \"Premium Economy\",\n" +
" \"$departure_airport_code\": \"SFO\",\n" +
" \"$arrival_airport_code\": \"LAS\"\n" +
" \"$arrival_airport_code\": \"LAS\",\n" +
" \"$iata_carrier_code\": \"AS\"\n" +
" }\n" +
" ],\n" +
" \"$price\": 49900000,\n" +
" \"$currency_code\": \"USD\",\n" +
" \"$iata_carrier_code\": \"AS\",\n" +
" \"$quantity\": 1,\n" +
" \"$tags\": [\n" +
" \"team-123\",\n" +
Expand Down