Skip to content

Commit c138736

Browse files
Adding support for $merchant_profile complex field to $create_account, $update_account, and $chargeback events (#70)
1 parent 1a830b1 commit c138736

File tree

8 files changed

+85
-12
lines changed

8 files changed

+85
-12
lines changed

CHANGES.MD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
3.4.4 (2022-03-24)
2+
=================
3+
- Add support for `$merchant_profile` complex field to `$create_account`, `$update_account`, and `$chargeback` events
4+
15
3.4.3 (2021-10-12)
26
=================
37
- Add support for `$shortened_iban_first6`, `$shortened_iban_last4`, and `$sepa_direct_debit_mandate` to `$payment_method` complex field and `$transaction` event

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ Java 1.7 or later.
1313
<dependency>
1414
<groupId>com.siftscience</groupId>
1515
<artifactId>sift-java</artifactId>
16-
<version>3.4.3</version>
16+
<version>3.4.4</version>
1717
</dependency>
1818
```
1919
### Gradle
2020
```
2121
dependencies {
22-
compile 'com.siftscience:sift-java:3.4.3'
22+
compile 'com.siftscience:sift-java:3.4.4'
2323
}
2424
```
2525
### Other

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apply plugin: 'signing'
55
apply plugin: 'java-library-distribution'
66

77
group = 'com.siftscience'
8-
version = '3.4.3'
8+
version = '3.4.4'
99

1010
repositories {
1111
mavenCentral()

src/main/java/com/siftscience/model/BaseAccountFieldSet.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public abstract class BaseAccountFieldSet<T extends BaseAccountFieldSet<T>>
1515
@Expose @SerializedName("$billing_address") private Address billingAddress;
1616
@Expose @SerializedName("$shipping_address") private Address shippingAddress;
1717
@Expose @SerializedName("$social_sign_on_type") private String socialSignOnType;
18+
@Expose @SerializedName("$merchant_profile") private MerchantProfile merchantProfile;
1819

1920
public String getUserEmail() {
2021
return userEmail;
@@ -87,4 +88,13 @@ public T setSocialSignOnType(String socialSignOnType) {
8788
this.socialSignOnType = socialSignOnType;
8889
return (T) this;
8990
}
91+
92+
public MerchantProfile getMerchantProfile() {
93+
return merchantProfile;
94+
}
95+
96+
public T setMerchantProfile(MerchantProfile merchantProfile) {
97+
this.merchantProfile = merchantProfile;
98+
return (T) this;
99+
}
90100
}

src/main/java/com/siftscience/model/ChargebackFieldSet.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public static ChargebackFieldSet fromJson(String json) {
1212
@Expose @SerializedName("$transaction_id") private String transactionId;
1313
@Expose @SerializedName("$chargeback_state") private String chargebackState;
1414
@Expose @SerializedName("$chargeback_reason") private String chargebackReason;
15+
@Expose @SerializedName("$merchant_profile") private MerchantProfile merchantProfile;
1516

1617
@Override
1718
public String getEventType() {
@@ -53,4 +54,13 @@ public ChargebackFieldSet setChargebackReason(String chargebackReason) {
5354
this.chargebackReason = chargebackReason;
5455
return this;
5556
}
57+
58+
public MerchantProfile getMerchantProfile() {
59+
return merchantProfile;
60+
}
61+
62+
public ChargebackFieldSet setMerchantProfile(MerchantProfile merchantProfile) {
63+
this.merchantProfile = merchantProfile;
64+
return this;
65+
}
5666
}

src/test/java/com/siftscience/ChargebackEventTest.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,23 @@ public void testChargeback() throws Exception {
2222
" \"$transaction_id\" : \"719637215\",\n" +
2323
"\n" +
2424
" \"$chargeback_state\" : \"$lost\",\n" +
25-
" \"$chargeback_reason\" : \"$duplicate\"\n" +
26-
"}";
25+
" \"$chargeback_reason\" : \"$duplicate\",\n" +
26+
" \"$merchant_profile\" : {\n" +
27+
" \"$merchant_id\" : \"12345\",\n" +
28+
" \"$merchant_category_code\" : \"9876\",\n" +
29+
" \"$merchant_name\" : \"ABC Merchant\",\n" +
30+
" \"$merchant_address\" : {\n" +
31+
" \"$address_1\" : \"2100 Main Street\",\n" +
32+
" \"$address_2\" : \"Apt 3B\",\n" +
33+
" \"$city\" : \"New London\",\n" +
34+
" \"$country\" : \"US\",\n" +
35+
" \"$name\" : \"Bill Jones\",\n" +
36+
" \"$phone\" : \"1-415-555-6040\",\n" +
37+
" \"$region\" : \"New Hampshire\",\n" +
38+
" \"$zipcode\" : \"03257\"\n" +
39+
" }\n" +
40+
" }\n" +
41+
"}\n";
2742

2843
// Start a new mock server and enqueue a mock response.
2944
MockWebServer server = new MockWebServer();
@@ -50,7 +65,8 @@ public void testChargeback() throws Exception {
5065
.setOrderId("ORDER-123124124")
5166
.setTransactionId("719637215")
5267
.setChargebackState("$lost")
53-
.setChargebackReason("$duplicate"));
68+
.setChargebackReason("$duplicate")
69+
.setMerchantProfile(TestUtils.sampleMerchantProfile()));
5470

5571
EventResponse siftResponse = request.send();
5672

src/test/java/com/siftscience/CreateAccountEventTest.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,23 @@ public void testCreateAccount() throws Exception {
7777
" \"referral_code\" : \"MIKEFRIENDS\",\n" +
7878
" \"email_confirmed_status\" : \"$pending\",\n" +
7979
" \"phone_confirmed_status\" : \"$pending\",\n" +
80-
" \"$account_types\" : [\"merchant\", \"premium\"]\n" +
81-
"}";
80+
" \"$account_types\" : [\"merchant\", \"premium\"],\n" +
81+
" \"$merchant_profile\" : {\n" +
82+
" \"$merchant_id\" : \"12345\",\n" +
83+
" \"$merchant_category_code\" : \"9876\",\n" +
84+
" \"$merchant_name\" : \"ABC Merchant\",\n" +
85+
" \"$merchant_address\" : {\n" +
86+
" \"$address_1\" : \"2100 Main Street\",\n" +
87+
" \"$address_2\" : \"Apt 3B\",\n" +
88+
" \"$city\" : \"New London\",\n" +
89+
" \"$country\" : \"US\",\n" +
90+
" \"$name\" : \"Bill Jones\",\n" +
91+
" \"$phone\" : \"1-415-555-6040\",\n" +
92+
" \"$region\" : \"New Hampshire\",\n" +
93+
" \"$zipcode\" : \"03257\"\n" +
94+
" }\n" +
95+
" }\n" +
96+
"}\n";
8297

8398
// Start a new mock server and enqueue a mock response.
8499
MockWebServer server = new MockWebServer();
@@ -127,7 +142,8 @@ public void testCreateAccount() throws Exception {
127142
.setCustomField("referral_code", "MIKEFRIENDS")
128143
.setCustomField("email_confirmed_status", "$pending")
129144
.setCustomField("phone_confirmed_status", "$pending")
130-
.setAccountTypes(Arrays.asList("merchant", "premium")));
145+
.setAccountTypes(Arrays.asList("merchant", "premium"))
146+
.setMerchantProfile(TestUtils.sampleMerchantProfile()));
131147

132148
SiftResponse siftResponse = request.send();
133149

src/test/java/com/siftscience/UpdateAccountEventTest.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,23 @@ public void testUpdateAccount() throws Exception {
5858
" \"$social_sign_on_type\" : \"$twitter\",\n" +
5959
" \"email_confirmed_status\" : \"$success\",\n" +
6060
" \"phone_confirmed_status\" : \"$success\",\n" +
61-
" \"$account_types\" : [\"merchant\", \"premium\"]\n" +
62-
"}";
61+
" \"$account_types\" : [\"merchant\", \"premium\"],\n" +
62+
" \"$merchant_profile\" : {\n" +
63+
" \"$merchant_id\" : \"12345\",\n" +
64+
" \"$merchant_category_code\" : \"9876\",\n" +
65+
" \"$merchant_name\" : \"ABC Merchant\",\n" +
66+
" \"$merchant_address\" : {\n" +
67+
" \"$address_1\" : \"2100 Main Street\",\n" +
68+
" \"$address_2\" : \"Apt 3B\",\n" +
69+
" \"$city\" : \"New London\",\n" +
70+
" \"$country\" : \"US\",\n" +
71+
" \"$name\" : \"Bill Jones\",\n" +
72+
" \"$phone\" : \"1-415-555-6040\",\n" +
73+
" \"$region\" : \"New Hampshire\",\n" +
74+
" \"$zipcode\" : \"03257\"\n" +
75+
" }\n" +
76+
" }\n" +
77+
"}\n";
6378

6479
// Start a new mock server and enqueue a mock response.
6580
MockWebServer server = new MockWebServer();
@@ -99,7 +114,9 @@ public void testUpdateAccount() throws Exception {
99114
.setSocialSignOnType("$twitter")
100115
.setCustomField("email_confirmed_status", "$success")
101116
.setCustomField("phone_confirmed_status", "$success")
102-
.setAccountTypes(Arrays.asList("merchant", "premium")));
117+
.setAccountTypes(Arrays.asList("merchant", "premium"))
118+
.setMerchantProfile(TestUtils.sampleMerchantProfile()));
119+
103120

104121
SiftResponse siftResponse = request.send();
105122

0 commit comments

Comments
 (0)