sift 4.6.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f52238626726ed4acc2b903b57bc393b46b2e8df162a021abd0b94d084631acc
4
- data.tar.gz: 4576e4a7bb68d34b9687a8cea83d7e767cb9d10aacbf354d6dcf6167cd0de89b
3
+ metadata.gz: '0316139e47e2c117655c7f8f75497c78e7f657552e816f2ec40f1e2c0a616d67'
4
+ data.tar.gz: 628cddc8debde4d8ad15bafb96a266a6cfbaaa2e1e78ee9202d9a4388a978fb9
5
5
  SHA512:
6
- metadata.gz: 3b7c07547207731c7592c0a08f229adde8400511855ad54ed7ae86de0b891acbb7b4fa91b7666df2e4927a7f9483898554daa8658f28ed9d5e0a49875139a011
7
- data.tar.gz: 3d3fd96f0ed512504cdd4f52f353ef9264ee74395b1c1af58c6d583c17114e3cdd971ec577397d28339ceea68e0d69c495e817bdb42dc16aac61a7b6e348f7a5
6
+ metadata.gz: c9e69e75d82c24f624ae4049e539cf127966de795196cff8a7025a861deb54a7f53a5e21ab90611d3c1de4c1cc5c300905a7bffd6afff3fe16f2942c1b494565
7
+ data.tar.gz: 9997e80b62404f3677b60bf43021b0c700cf26d60d6aff7fa8a447a3757338a2fd988bccb83aa87ddcfe44ea476c5c76e116a99e5de69c8b86bffbf796aff7d2
data/HISTORY CHANGED
@@ -1,3 +1,8 @@
1
+ === 4.7.0 2026-08-27
2
+ - Added support for $nationality, $year_of_birth fields on $create_account, $update_account events
3
+ - Added support for $kyc field on $create_account, $update_account, $transaction, $create_order, $update_order, $verification events
4
+ - Added support for $geo, $bot_identification fields on $create_account, $update_account, $login, $transaction, $create_order, $update_order events
5
+
1
6
  === 4.6.0 2026-02-10
2
7
  - Bump the minimum version of httparty to 0.23.3 to ensure protection against CVE-2025-68696
3
8
  - Refactor Client to use dedicated internal HTTP clients for different API endpoints
data/README.md CHANGED
@@ -87,6 +87,77 @@ response.api_error_message # Error message associated with status Error Code
87
87
  response = client.score(user_id)
88
88
  ```
89
89
 
90
+ ### New KYC Signals, Geo & Bot Detection
91
+
92
+ ```ruby
93
+ # $verification event with KYC outcome
94
+ response = client.track("$verification", {
95
+ "$user_id" => "23056",
96
+ "$verification_type" => "$kyc",
97
+ "$status" => "$success",
98
+ "$kyc" => {
99
+ "$names_match" => true,
100
+ "$kyc_level" => "$basic",
101
+ "$bin_nationality_match" => false,
102
+ "$provider" => "lexisnexis"
103
+ }
104
+ })
105
+
106
+ # $create_account with account-level identity attributes
107
+ response = client.track("$create_account", {
108
+ "$user_id" => "23056",
109
+ "$nationality" => "US",
110
+ "$year_of_birth" => 1985,
111
+ "$kyc" => {
112
+ "$names_match" => true,
113
+ "$kyc_level" => "$full",
114
+ "$provider" => "prove"
115
+ },
116
+ "$geo" => {
117
+ "$uuid" => "gc-abc-123",
118
+ "$provider" => "geocomply"
119
+ },
120
+ "$bot_identification" => {
121
+ "$result" => "$human",
122
+ "$provider" => "datadome"
123
+ }
124
+ })
125
+
126
+ # $login event with geo and bot-detection signals
127
+ response = client.track("$login", {
128
+ "$user_id" => "23056",
129
+ "$login_status" => "$success",
130
+ "$geo" => {
131
+ "$uuid" => "gc-abc-123",
132
+ "$provider" => "geocomply"
133
+ },
134
+ "$bot_identification" => {
135
+ "$result" => "$human",
136
+ "$provider" => "datadome"
137
+ }
138
+ })
139
+
140
+ # $transaction event with KYC, geo, and bot-detection signals
141
+ response = client.track("$transaction", {
142
+ "$user_id" => "23056",
143
+ "$amount" => 15230000,
144
+ "$currency_code" => "USD",
145
+ "$kyc" => {
146
+ "$names_match" => true,
147
+ "$bin_nationality_match" => true,
148
+ "$provider" => "lexisnexis"
149
+ },
150
+ "$geo" => {
151
+ "$uuid" => "gc-abc-123",
152
+ "$provider" => "geocomply"
153
+ },
154
+ "$bot_identification" => {
155
+ "$result" => "$suspected",
156
+ "$provider" => "human_security"
157
+ }
158
+ })
159
+ ```
160
+
90
161
  ## Decisions
91
162
 
92
163
  To learn more about the decisions endpoint visit our [developer docs](https://sift.com/developers/docs/ruby/decisions-api/get-decisions).
data/lib/sift/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Sift
2
- VERSION = "4.6.0"
2
+ VERSION = "4.7.0"
3
3
  API_VERSION = "205"
4
4
  VERIFICATION_API_VERSION = "1.1"
5
5
  end
@@ -0,0 +1,60 @@
1
+ require_relative '../spec_helper'
2
+ require 'sift'
3
+
4
+ describe Sift::Client do
5
+
6
+ before :each do
7
+ Sift.api_key = nil
8
+ end
9
+
10
+ it "Successfully submits a $create_account event with KYC, geo, and bot-detection structured fields" do
11
+ response_json = { :status => 0, :error_message => "OK" }
12
+ stub_request(:post, "https://api.siftscience.com/v205/events").
13
+ with { |request|
14
+ parsed_body = JSON.parse(request.body)
15
+ expect(parsed_body["$nationality"]).to eq("US")
16
+ expect(parsed_body["$year_of_birth"]).to eq(1985)
17
+ expect(parsed_body["$kyc"]).to eq({
18
+ "$names_match" => true,
19
+ "$kyc_level" => "$basic",
20
+ "$bin_nationality_match" => true,
21
+ "$provider" => "lexisnexis"
22
+ })
23
+ expect(parsed_body["$geo"]).to eq({
24
+ "$uuid" => "gc-abc-123",
25
+ "$provider" => "geocomply"
26
+ })
27
+ expect(parsed_body["$bot_identification"]).to eq({
28
+ "$result" => "$human",
29
+ "$provider" => "datadome"
30
+ })
31
+ }.to_return(:status => 200, :body => MultiJson.dump(response_json), :headers => {})
32
+
33
+ api_key = "foobar"
34
+ properties = {
35
+ :$type => "$create_account",
36
+ :$user_id => "23056",
37
+ :$nationality => "US",
38
+ :$year_of_birth => 1985,
39
+ :$kyc => {
40
+ :$names_match => true,
41
+ :$kyc_level => "$basic",
42
+ :$bin_nationality_match => true,
43
+ :$provider => "lexisnexis"
44
+ },
45
+ :$geo => {
46
+ :$uuid => "gc-abc-123",
47
+ :$provider => "geocomply"
48
+ },
49
+ :$bot_identification => {
50
+ :$result => "$human",
51
+ :$provider => "datadome"
52
+ }
53
+ }
54
+
55
+ response = Sift::Client.new(:api_key => api_key, :version => "205")
56
+ .track("$create_account", properties)
57
+ expect(response.ok?).to eq(true)
58
+ expect(response.api_status).to eq(0)
59
+ end
60
+ end
@@ -24,7 +24,16 @@ class EventsAPI
24
24
  "$brand_name" => "sift",
25
25
  "$site_domain" => "sift.com",
26
26
  "$site_country" => "US",
27
-
27
+
28
+ "$geo" => {
29
+ "$uuid" => "gc-abc-123",
30
+ "$provider" => "geocomply"
31
+ },
32
+ "$bot_identification" => {
33
+ "$result" => "$human",
34
+ "$provider" => "datadome"
35
+ },
36
+
28
37
  # Send this information with a login from a BROWSER client.
29
38
  "$browser" => {
30
39
  "$user_agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
@@ -107,13 +116,27 @@ class EventsAPI
107
116
 
108
117
  # For marketplaces, use $seller_user_id to identify the seller
109
118
  "$seller_user_id" => "slinkys_emporium",
110
-
119
+
120
+ "$kyc" => {
121
+ "$names_match" => true,
122
+ "$bin_nationality_match" => false,
123
+ "$provider" => "prove"
124
+ },
125
+ "$geo" => {
126
+ "$uuid" => "gc-abc-123",
127
+ "$provider" => "geocomply"
128
+ },
129
+ "$bot_identification" => {
130
+ "$result" => "$human",
131
+ "$provider" => "human_security"
132
+ },
133
+
111
134
  # Sample Custom Fields
112
135
  "digital_wallet" => "apple_pay", # "google_wallet", etc.
113
136
  "coupon_code" => "dollarMadness",
114
137
  "shipping_choice" => "FedEx Ground Courier",
115
138
  "is_first_time_buyer" => false,
116
-
139
+
117
140
  # Send this information from a BROWSER client.
118
141
  "$browser" => {
119
142
  "$user_agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
@@ -121,7 +144,7 @@ class EventsAPI
121
144
  "$content_language" => "en-GB"
122
145
  }
123
146
  }
124
-
147
+
125
148
  return @@client.track("$transaction", properties, :warnings => 'true')
126
149
  end
127
150
 
@@ -233,7 +256,21 @@ class EventsAPI
233
256
  "coupon_code" => "dollarMadness",
234
257
  "shipping_choice" => "FedEx Ground Courier",
235
258
  "is_first_time_buyer" => false,
236
-
259
+
260
+ "$kyc" => {
261
+ "$names_match" => true,
262
+ "$kyc_level" => "$basic",
263
+ "$provider" => "lexisnexis"
264
+ },
265
+ "$geo" => {
266
+ "$uuid" => "gc-abc-123",
267
+ "$provider" => "geocomply"
268
+ },
269
+ "$bot_identification" => {
270
+ "$result" => "$human",
271
+ "$provider" => "datadome"
272
+ },
273
+
237
274
  # Send this information from a BROWSER client.
238
275
  "$browser" => {
239
276
  "$user_agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
@@ -241,7 +278,7 @@ class EventsAPI
241
278
  "$content_language" => "en-GB"
242
279
  }
243
280
  }
244
-
281
+
245
282
  return @@client.track("$create_order", properties)
246
283
  end
247
284
 
@@ -457,7 +494,23 @@ class EventsAPI
457
494
 
458
495
  "$social_sign_on_type" => "$twitter",
459
496
  "$account_types" => ["merchant", "premium"],
460
-
497
+
498
+ "$nationality" => "US",
499
+ "$year_of_birth" => 1985,
500
+ "$kyc" => {
501
+ "$names_match" => true,
502
+ "$kyc_level" => "$full",
503
+ "$provider" => "prove"
504
+ },
505
+ "$geo" => {
506
+ "$uuid" => "gc-abc-123",
507
+ "$provider" => "geocomply"
508
+ },
509
+ "$bot_identification" => {
510
+ "$result" => "$human",
511
+ "$provider" => "datadome"
512
+ },
513
+
461
514
  # Send this information from a BROWSER client.
462
515
  "$browser" => {
463
516
  "$user_agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
@@ -465,7 +518,7 @@ class EventsAPI
465
518
  "$content_language" => "en-GB"
466
519
  }
467
520
  }
468
-
521
+
469
522
  return @@client.track("$update_account", properties)
470
523
  end
471
524
 
@@ -585,7 +638,23 @@ class EventsAPI
585
638
 
586
639
  "$social_sign_on_type" => "$twitter",
587
640
  "$account_types" => ["merchant", "premium"],
588
-
641
+
642
+ "$nationality" => "US",
643
+ "$year_of_birth" => 1985,
644
+ "$kyc" => {
645
+ "$names_match" => true,
646
+ "$kyc_level" => "$basic",
647
+ "$provider" => "lexisnexis"
648
+ },
649
+ "$geo" => {
650
+ "$uuid" => "gc-abc-123",
651
+ "$provider" => "geocomply"
652
+ },
653
+ "$bot_identification" => {
654
+ "$result" => "$human",
655
+ "$provider" => "datadome"
656
+ },
657
+
589
658
  # Suggested Custom Fields
590
659
  "twitter_handle" => "billyjones",
591
660
  "work_phone" => "1-347-555-5921",
@@ -618,7 +687,14 @@ class EventsAPI
618
687
  "$verified_event" => "$login",
619
688
  "$reason" => "$automated_rule", # Verification was triggered based on risk score
620
689
  "$verification_type" => "$sms",
621
- "$verified_value" => "14155551212"
690
+ "$verified_value" => "14155551212",
691
+
692
+ "$kyc" => {
693
+ "$names_match" => true,
694
+ "$kyc_level" => "$basic",
695
+ "$bin_nationality_match" => false,
696
+ "$provider" => "lexisnexis"
697
+ }
622
698
  }
623
699
 
624
700
  return @@client.track("$verification", properties)
@@ -828,7 +904,21 @@ class EventsAPI
828
904
  "coupon_code" => "dollarMadness",
829
905
  "shipping_choice" => "FedEx Ground Courier",
830
906
  "is_first_time_buyer" => false,
831
-
907
+
908
+ "$kyc" => {
909
+ "$names_match" => true,
910
+ "$kyc_level" => "$basic",
911
+ "$provider" => "lexisnexis"
912
+ },
913
+ "$geo" => {
914
+ "$uuid" => "gc-abc-123",
915
+ "$provider" => "geocomply"
916
+ },
917
+ "$bot_identification" => {
918
+ "$result" => "$human",
919
+ "$provider" => "datadome"
920
+ },
921
+
832
922
  # Send this information from a BROWSER client.
833
923
  "$browser" => {
834
924
  "$user_agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
@@ -836,7 +926,7 @@ class EventsAPI
836
926
  "$content_language" => "en-GB"
837
927
  }
838
928
  }
839
-
929
+
840
930
  return @@client.track("$update_order", properties)
841
931
  end
842
932
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sift
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.0
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Sadaghiani
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2026-03-02 00:00:00.000000000 Z
13
+ date: 2026-09-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -156,6 +156,7 @@ files:
156
156
  - spec/unit/client_label_spec.rb
157
157
  - spec/unit/client_psp_merchant_spec.rb
158
158
  - spec/unit/client_spec.rb
159
+ - spec/unit/client_structured_fields_spec.rb
159
160
  - spec/unit/client_validationapi_spec.rb
160
161
  - spec/unit/configuration_spec.rb
161
162
  - spec/unit/router_spec.rb