lithic 0.13.0 → 0.14.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: 55e88915ee36cb45b0dbc3d0f0e137d540c453057422cbe736b19c36e33a4715
4
- data.tar.gz: d0f7269d109d93e082076899c1b0a76d2dba25a78033ac77ffdcc1794441c940
3
+ metadata.gz: c905324792265eff590566a39249dca47e8e90434315980e866391b447c73e39
4
+ data.tar.gz: 7d9ccd8f6bc441873fc0dcae340e13e3c2ff2e2101e3583d0f2710593ed659ee
5
5
  SHA512:
6
- metadata.gz: 0c0a3fdff861422c1746f03a32a7fe070bd02c6eb58c7388cf85c4a47938a3cd84458380047dd8ad577507509a42ce22eaa2abe57ad0cc0cdda948d3d104518a
7
- data.tar.gz: d9e925524aac256ed4d04920fc9d0a04731d2ca1ef58e921c28ac8775f84308f43f679d90edf262a7566ea73eac274daa7b82eb82a21af8e8f568bcd5ecc7a20
6
+ metadata.gz: 8c3be69a21773892ce2a36cc9e46c475d43ea62fe3bdb179cabbddaeca36b98c056f4e576f4f2909137b7249275c42fbaf343e8601cf2600051b1800c76b7500
7
+ data.tar.gz: 23265170d427a44068864cd13f0aa92310ac37ce82e8bff938ff408ffa2694f6b43a2284a2b66d25718257046000f0082f21c01592e8eb316de1af2d21b6a611
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.0 (2026-05-08)
4
+
5
+ Full Changelog: [v0.13.0...v0.14.0](https://github.com/lithic-com/lithic-ruby/compare/v0.13.0...v0.14.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add retrieve_signals method to accounts and cards ([c6446ff](https://github.com/lithic-com/lithic-ruby/commit/c6446ffce562ebe1d451d86a56372e3bf91004e9))
10
+ * **api:** add travel speed/distance attributes and unit parameter to auth_rules ([846d5d9](https://github.com/lithic-com/lithic-ruby/commit/846d5d99cea53078bbda45f2a4b845bc4f7f33d2))
11
+
3
12
  ## 0.13.0 (2026-05-06)
4
13
 
5
14
  Full Changelog: [v0.12.0...v0.13.0](https://github.com/lithic-com/lithic-ruby/compare/v0.12.0...v0.13.0)
data/README.md CHANGED
@@ -24,7 +24,7 @@ To use this gem, install via Bundler by adding the following to your application
24
24
  <!-- x-release-please-start-version -->
25
25
 
26
26
  ```ruby
27
- gem "lithic", "~> 0.13.0"
27
+ gem "lithic", "~> 0.14.0"
28
28
  ```
29
29
 
30
30
  <!-- x-release-please-end -->
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lithic
4
+ module Models
5
+ # @see Lithic::Resources::Accounts#retrieve_signals
6
+ class AccountRetrieveSignalsParams < Lithic::Internal::Type::BaseModel
7
+ extend Lithic::Internal::Type::RequestParameters::Converter
8
+ include Lithic::Internal::Type::RequestParameters
9
+
10
+ # @!attribute account_token
11
+ #
12
+ # @return [String]
13
+ required :account_token, String
14
+
15
+ # @!method initialize(account_token:, request_options: {})
16
+ # @param account_token [String]
17
+ # @param request_options [Lithic::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end
@@ -138,6 +138,15 @@ module Lithic
138
138
  # `parameters` required.
139
139
  # - `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
140
140
  # a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
141
+ # - `TRAVEL_SPEED`: The estimated speed of travel derived from the distance
142
+ # between the postal code centers of the last card-present transaction and the
143
+ # current transaction, divided by the elapsed time. Null if there is no prior
144
+ # card-present transaction, if either postal code cannot be geocoded, or if
145
+ # elapsed time is zero. Requires `parameters.unit` set to `MPH` or `KPH`.
146
+ # - `DISTANCE_FROM_LAST_TRANSACTION`: The estimated distance between the postal
147
+ # code centers of the last card-present transaction and the current transaction.
148
+ # Null if there is no prior card-present transaction or if either postal code
149
+ # cannot be geocoded. Requires `parameters.unit` set to `MILES` or `KILOMETERS`.
141
150
  #
142
151
  # @return [Symbol, Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Attribute]
143
152
  required :attribute,
@@ -156,11 +165,12 @@ module Lithic
156
165
  required :value, union: -> { Lithic::AuthRules::ConditionalValue }
157
166
 
158
167
  # @!attribute parameters
159
- # Additional parameters required for transaction history signal attributes.
160
- # Required when `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
161
- # `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
162
- # `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
163
- # or `DISTINCT_COUNTRY_COUNT`. Not used for other attributes.
168
+ # Additional parameters for certain attributes. Required when `attribute` is one
169
+ # of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`,
170
+ # `IS_NEW_COUNTRY`, `IS_NEW_MCC`, `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`,
171
+ # `TIME_SINCE_LAST_TRANSACTION`, or `DISTINCT_COUNTRY_COUNT` (require `scope`); or
172
+ # `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION` (require `unit`). Not used
173
+ # for other attributes.
164
174
  #
165
175
  # @return [Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters, nil]
166
176
  optional :parameters,
@@ -177,7 +187,7 @@ module Lithic
177
187
  #
178
188
  # @param value [String, Integer, Array<String>, Time] A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
179
189
  #
180
- # @param parameters [Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters] Additional parameters required for transaction history signal attributes. Requir
190
+ # @param parameters [Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters] Additional parameters for certain attributes. Required when `attribute` is one o
181
191
 
182
192
  # The attribute to target.
183
193
  #
@@ -281,6 +291,15 @@ module Lithic
281
291
  # `parameters` required.
282
292
  # - `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
283
293
  # a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
294
+ # - `TRAVEL_SPEED`: The estimated speed of travel derived from the distance
295
+ # between the postal code centers of the last card-present transaction and the
296
+ # current transaction, divided by the elapsed time. Null if there is no prior
297
+ # card-present transaction, if either postal code cannot be geocoded, or if
298
+ # elapsed time is zero. Requires `parameters.unit` set to `MPH` or `KPH`.
299
+ # - `DISTANCE_FROM_LAST_TRANSACTION`: The estimated distance between the postal
300
+ # code centers of the last card-present transaction and the current transaction.
301
+ # Null if there is no prior card-present transaction or if either postal code
302
+ # cannot be geocoded. Requires `parameters.unit` set to `MILES` or `KILOMETERS`.
284
303
  #
285
304
  # @see Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition#attribute
286
305
  module Attribute
@@ -323,6 +342,8 @@ module Lithic
323
342
  DISTINCT_COUNTRY_COUNT = :DISTINCT_COUNTRY_COUNT
324
343
  IS_NEW_MERCHANT = :IS_NEW_MERCHANT
325
344
  THREE_DS_SUCCESS_RATE = :THREE_DS_SUCCESS_RATE
345
+ TRAVEL_SPEED = :TRAVEL_SPEED
346
+ DISTANCE_FROM_LAST_TRANSACTION = :DISTANCE_FROM_LAST_TRANSACTION
326
347
 
327
348
  # @!method self.values
328
349
  # @return [Array<Symbol>]
@@ -346,20 +367,36 @@ module Lithic
346
367
  optional :scope,
347
368
  enum: -> { Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Scope }
348
369
 
349
- # @!method initialize(interval: nil, scope: nil)
370
+ # @!attribute unit
371
+ # The unit for impossible travel attributes. Required when `attribute` is
372
+ # `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION`.
373
+ #
374
+ # For `TRAVEL_SPEED`: `MPH` (miles per hour) or `KPH` (kilometers per hour).
375
+ #
376
+ # For `DISTANCE_FROM_LAST_TRANSACTION`: `MILES` or `KILOMETERS`.
377
+ #
378
+ # @return [Symbol, Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit, nil]
379
+ optional :unit,
380
+ enum: -> { Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit }
381
+
382
+ # @!method initialize(interval: nil, scope: nil, unit: nil)
350
383
  # Some parameter documentations has been truncated, see
351
384
  # {Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters}
352
385
  # for more details.
353
386
  #
354
- # Additional parameters required for transaction history signal attributes.
355
- # Required when `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
356
- # `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
357
- # `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
358
- # or `DISTINCT_COUNTRY_COUNT`. Not used for other attributes.
387
+ # Additional parameters for certain attributes. Required when `attribute` is one
388
+ # of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`,
389
+ # `IS_NEW_COUNTRY`, `IS_NEW_MCC`, `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`,
390
+ # `TIME_SINCE_LAST_TRANSACTION`, or `DISTINCT_COUNTRY_COUNT` (require `scope`); or
391
+ # `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION` (require `unit`). Not used
392
+ # for other attributes.
359
393
  #
360
394
  # @param interval [Symbol, Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Interval] The time window for statistical attributes (`AMOUNT_Z_SCORE`, `AVG_TRANSACTION_A
361
395
  #
362
396
  # @param scope [Symbol, Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Scope] The entity scope to evaluate the attribute against.
397
+ #
398
+ # @param unit [Symbol, Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit] The unit for impossible travel attributes. Required when `attribute` is
399
+ # `TRAVEL\_
363
400
 
364
401
  # The time window for statistical attributes (`AMOUNT_Z_SCORE`,
365
402
  # `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`). Use `LIFETIME` for
@@ -391,6 +428,26 @@ module Lithic
391
428
  # @!method self.values
392
429
  # @return [Array<Symbol>]
393
430
  end
431
+
432
+ # The unit for impossible travel attributes. Required when `attribute` is
433
+ # `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION`.
434
+ #
435
+ # For `TRAVEL_SPEED`: `MPH` (miles per hour) or `KPH` (kilometers per hour).
436
+ #
437
+ # For `DISTANCE_FROM_LAST_TRANSACTION`: `MILES` or `KILOMETERS`.
438
+ #
439
+ # @see Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters#unit
440
+ module Unit
441
+ extend Lithic::Internal::Type::Enum
442
+
443
+ MPH = :MPH
444
+ KPH = :KPH
445
+ MILES = :MILES
446
+ KILOMETERS = :KILOMETERS
447
+
448
+ # @!method self.values
449
+ # @return [Array<Symbol>]
450
+ end
394
451
  end
395
452
  end
396
453
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lithic
4
+ module Models
5
+ # @see Lithic::Resources::Cards#retrieve_signals
6
+ class CardRetrieveSignalsParams < Lithic::Internal::Type::BaseModel
7
+ extend Lithic::Internal::Type::RequestParameters::Converter
8
+ include Lithic::Internal::Type::RequestParameters
9
+
10
+ # @!attribute card_token
11
+ #
12
+ # @return [String]
13
+ required :card_token, String
14
+
15
+ # @!method initialize(card_token:, request_options: {})
16
+ # @param card_token [String]
17
+ # @param request_options [Lithic::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,306 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lithic
4
+ module Models
5
+ class SignalsResponse < Lithic::Internal::Type::BaseModel
6
+ # @!attribute approved_txn_amount_m2
7
+ # The Welford M2 accumulator for lifetime approved transaction amounts. Used
8
+ # together with `avg_transaction_amount` and `approved_txn_count` to compute the
9
+ # z-score of a new transaction amount (variance = M2 / (count - 1)).
10
+ #
11
+ # @return [Float, nil]
12
+ required :approved_txn_amount_m2, Float, nil?: true
13
+
14
+ # @!attribute approved_txn_amount_m2_30d
15
+ # The Welford M2 accumulator for approved transaction amounts over the last 30
16
+ # days.
17
+ #
18
+ # @return [Float, nil]
19
+ required :approved_txn_amount_m2_30d, Float, nil?: true
20
+
21
+ # @!attribute approved_txn_amount_m2_7d
22
+ # The Welford M2 accumulator for approved transaction amounts over the last 7
23
+ # days.
24
+ #
25
+ # @return [Float, nil]
26
+ required :approved_txn_amount_m2_7d, Float, nil?: true
27
+
28
+ # @!attribute approved_txn_amount_m2_90d
29
+ # The Welford M2 accumulator for approved transaction amounts over the last 90
30
+ # days.
31
+ #
32
+ # @return [Float, nil]
33
+ required :approved_txn_amount_m2_90d, Float, nil?: true
34
+
35
+ # @!attribute approved_txn_count
36
+ # The total number of approved transactions over the entity's lifetime.
37
+ #
38
+ # @return [Integer, nil]
39
+ required :approved_txn_count, Integer, nil?: true
40
+
41
+ # @!attribute approved_txn_count_30d
42
+ # The number of approved transactions in the last 30 days.
43
+ #
44
+ # @return [Integer, nil]
45
+ required :approved_txn_count_30d, Integer, nil?: true
46
+
47
+ # @!attribute approved_txn_count_7d
48
+ # The number of approved transactions in the last 7 days.
49
+ #
50
+ # @return [Integer, nil]
51
+ required :approved_txn_count_7d, Integer, nil?: true
52
+
53
+ # @!attribute approved_txn_count_90d
54
+ # The number of approved transactions in the last 90 days.
55
+ #
56
+ # @return [Integer, nil]
57
+ required :approved_txn_count_90d, Integer, nil?: true
58
+
59
+ # @!attribute avg_transaction_amount
60
+ # The average approved transaction amount over the entity's lifetime, in cents.
61
+ # Null if fewer than 5 approved transactions have been recorded.
62
+ #
63
+ # @return [Float, nil]
64
+ required :avg_transaction_amount, Float, nil?: true
65
+
66
+ # @!attribute avg_transaction_amount_30d
67
+ # The average approved transaction amount over the last 30 days, in cents. Null if
68
+ # fewer than 5 approved transactions in window.
69
+ #
70
+ # @return [Float, nil]
71
+ required :avg_transaction_amount_30d, Float, nil?: true
72
+
73
+ # @!attribute avg_transaction_amount_7d
74
+ # The average approved transaction amount over the last 7 days, in cents. Null if
75
+ # fewer than 5 approved transactions in window.
76
+ #
77
+ # @return [Float, nil]
78
+ required :avg_transaction_amount_7d, Float, nil?: true
79
+
80
+ # @!attribute avg_transaction_amount_90d
81
+ # The average approved transaction amount over the last 90 days, in cents. Null if
82
+ # fewer than 5 approved transactions in window.
83
+ #
84
+ # @return [Float, nil]
85
+ required :avg_transaction_amount_90d, Float, nil?: true
86
+
87
+ # @!attribute distinct_country_count
88
+ # The number of distinct merchant countries seen in the entity's transaction
89
+ # history.
90
+ #
91
+ # @return [Integer, nil]
92
+ required :distinct_country_count, Integer, nil?: true
93
+
94
+ # @!attribute distinct_mcc_count
95
+ # The number of distinct MCCs seen in the entity's transaction history.
96
+ #
97
+ # @return [Integer, nil]
98
+ required :distinct_mcc_count, Integer, nil?: true
99
+
100
+ # @!attribute first_txn_at
101
+ # The timestamp of the first approved transaction for the entity, in ISO 8601
102
+ # format.
103
+ #
104
+ # @return [Time, nil]
105
+ required :first_txn_at, Time, nil?: true
106
+
107
+ # @!attribute is_first_transaction
108
+ # Whether the entity has no prior transaction history. Returns true if no history
109
+ # is found. Null if transaction history exists but a first transaction timestamp
110
+ # is unavailable.
111
+ #
112
+ # @return [Boolean, nil]
113
+ required :is_first_transaction, Lithic::Internal::Type::Boolean, nil?: true
114
+
115
+ # @!attribute last_cp_country
116
+ # The merchant country of the last card-present transaction.
117
+ #
118
+ # @return [String, nil]
119
+ required :last_cp_country, String, nil?: true
120
+
121
+ # @!attribute last_cp_postal_code
122
+ # The merchant postal code of the last card-present transaction.
123
+ #
124
+ # @return [String, nil]
125
+ required :last_cp_postal_code, String, nil?: true
126
+
127
+ # @!attribute last_cp_timestamp
128
+ # The timestamp of the last card-present transaction, in ISO 8601 format.
129
+ #
130
+ # @return [Time, nil]
131
+ required :last_cp_timestamp, Time, nil?: true
132
+
133
+ # @!attribute last_txn_approved_at
134
+ # The timestamp of the most recent approved transaction for the entity, in ISO
135
+ # 8601 format.
136
+ #
137
+ # @return [Time, nil]
138
+ required :last_txn_approved_at, Time, nil?: true
139
+
140
+ # @!attribute seen_countries
141
+ # The set of merchant countries seen in the entity's transaction history. Clients
142
+ # can use this to determine whether a new transaction's country is novel (i.e.
143
+ # compute `is_new_country`).
144
+ #
145
+ # @return [Array<String>, nil]
146
+ required :seen_countries, Lithic::Internal::Type::ArrayOf[String], nil?: true
147
+
148
+ # @!attribute seen_mccs
149
+ # The set of MCCs seen in the entity's transaction history. Clients can use this
150
+ # to determine whether a new transaction's MCC is novel (i.e. compute
151
+ # `is_new_mcc`).
152
+ #
153
+ # @return [Array<String>, nil]
154
+ required :seen_mccs, Lithic::Internal::Type::ArrayOf[String], nil?: true
155
+
156
+ # @!attribute seen_merchants
157
+ # The set of card acceptor IDs seen in the card's approved transaction history,
158
+ # capped at the 1000 most recently seen. Null for account responses. Clients can
159
+ # use this to determine whether a new transaction's merchant is novel (i.e.
160
+ # compute `is_new_merchant`).
161
+ #
162
+ # @return [Array<String>, nil]
163
+ required :seen_merchants, Lithic::Internal::Type::ArrayOf[String], nil?: true
164
+
165
+ # @!attribute stdev_transaction_amount
166
+ # The standard deviation of approved transaction amounts over the entity's
167
+ # lifetime, in cents. Null if fewer than 30 approved transactions have been
168
+ # recorded.
169
+ #
170
+ # @return [Float, nil]
171
+ required :stdev_transaction_amount, Float, nil?: true
172
+
173
+ # @!attribute stdev_transaction_amount_30d
174
+ # The standard deviation of approved transaction amounts over the last 30 days, in
175
+ # cents. Null if fewer than 30 approved transactions in window.
176
+ #
177
+ # @return [Float, nil]
178
+ required :stdev_transaction_amount_30d, Float, nil?: true
179
+
180
+ # @!attribute stdev_transaction_amount_7d
181
+ # The standard deviation of approved transaction amounts over the last 7 days, in
182
+ # cents. Null if fewer than 30 approved transactions in window.
183
+ #
184
+ # @return [Float, nil]
185
+ required :stdev_transaction_amount_7d, Float, nil?: true
186
+
187
+ # @!attribute stdev_transaction_amount_90d
188
+ # The standard deviation of approved transaction amounts over the last 90 days, in
189
+ # cents. Null if fewer than 30 approved transactions in window.
190
+ #
191
+ # @return [Float, nil]
192
+ required :stdev_transaction_amount_90d, Float, nil?: true
193
+
194
+ # @!attribute three_ds_success_count
195
+ # The number of successful 3DS authentications for the card. Null for account
196
+ # responses.
197
+ #
198
+ # @return [Integer, nil]
199
+ required :three_ds_success_count, Integer, nil?: true
200
+
201
+ # @!attribute three_ds_success_rate
202
+ # The 3DS authentication success rate for the card, as a percentage from 0.0 to
203
+ # 100.0. Null for account responses.
204
+ #
205
+ # @return [Float, nil]
206
+ required :three_ds_success_rate, Float, nil?: true
207
+
208
+ # @!attribute three_ds_total_count
209
+ # The total number of 3DS authentication attempts for the card. Null for account
210
+ # responses.
211
+ #
212
+ # @return [Integer, nil]
213
+ required :three_ds_total_count, Integer, nil?: true
214
+
215
+ # @!attribute time_since_last_transaction_days
216
+ # The number of days since the last approved transaction on the entity.
217
+ #
218
+ # @return [Float, nil]
219
+ required :time_since_last_transaction_days, Float, nil?: true
220
+
221
+ # @!method initialize(approved_txn_amount_m2:, approved_txn_amount_m2_30d:, approved_txn_amount_m2_7d:, approved_txn_amount_m2_90d:, approved_txn_count:, approved_txn_count_30d:, approved_txn_count_7d:, approved_txn_count_90d:, avg_transaction_amount:, avg_transaction_amount_30d:, avg_transaction_amount_7d:, avg_transaction_amount_90d:, distinct_country_count:, distinct_mcc_count:, first_txn_at:, is_first_transaction:, last_cp_country:, last_cp_postal_code:, last_cp_timestamp:, last_txn_approved_at:, seen_countries:, seen_mccs:, seen_merchants:, stdev_transaction_amount:, stdev_transaction_amount_30d:, stdev_transaction_amount_7d:, stdev_transaction_amount_90d:, three_ds_success_count:, three_ds_success_rate:, three_ds_total_count:, time_since_last_transaction_days:)
222
+ # Some parameter documentations has been truncated, see
223
+ # {Lithic::Models::SignalsResponse} for more details.
224
+ #
225
+ # Behavioral feature state for a card or account derived from its transaction
226
+ # history.
227
+ #
228
+ # Derived statistical features (averages, standard deviations, z-scores) are
229
+ # computed using Welford's online algorithm over approved transactions. Average
230
+ # fields are null when fewer than 5 approved transactions have been recorded.
231
+ # Standard deviation fields are null when fewer than 30 approved transactions have
232
+ # been recorded.
233
+ #
234
+ # 3DS fields (`three_ds_success_rate`, `three_ds_success_count`,
235
+ # `three_ds_total_count`) are card-scoped and will be null for account responses.
236
+ #
237
+ # Raw fields (`seen_countries`, `seen_mccs`, `approved_txn_amount_m2`, etc.) are
238
+ # included so clients can compute their own transaction-specific derivations, such
239
+ # as checking whether a new transaction's country is in `seen_countries` to
240
+ # determine `is_new_country`, or computing a z-score using the raw mean and M2
241
+ # values.
242
+ #
243
+ # @param approved_txn_amount_m2 [Float, nil] The Welford M2 accumulator for lifetime approved transaction amounts. Used toget
244
+ #
245
+ # @param approved_txn_amount_m2_30d [Float, nil] The Welford M2 accumulator for approved transaction amounts over the last 30 day
246
+ #
247
+ # @param approved_txn_amount_m2_7d [Float, nil] The Welford M2 accumulator for approved transaction amounts over the last 7 days
248
+ #
249
+ # @param approved_txn_amount_m2_90d [Float, nil] The Welford M2 accumulator for approved transaction amounts over the last 90 day
250
+ #
251
+ # @param approved_txn_count [Integer, nil] The total number of approved transactions over the entity's lifetime.
252
+ #
253
+ # @param approved_txn_count_30d [Integer, nil] The number of approved transactions in the last 30 days.
254
+ #
255
+ # @param approved_txn_count_7d [Integer, nil] The number of approved transactions in the last 7 days.
256
+ #
257
+ # @param approved_txn_count_90d [Integer, nil] The number of approved transactions in the last 90 days.
258
+ #
259
+ # @param avg_transaction_amount [Float, nil] The average approved transaction amount over the entity's lifetime, in cents. Nu
260
+ #
261
+ # @param avg_transaction_amount_30d [Float, nil] The average approved transaction amount over the last 30 days, in cents. Null if
262
+ #
263
+ # @param avg_transaction_amount_7d [Float, nil] The average approved transaction amount over the last 7 days, in cents. Null if
264
+ #
265
+ # @param avg_transaction_amount_90d [Float, nil] The average approved transaction amount over the last 90 days, in cents. Null if
266
+ #
267
+ # @param distinct_country_count [Integer, nil] The number of distinct merchant countries seen in the entity's transaction histo
268
+ #
269
+ # @param distinct_mcc_count [Integer, nil] The number of distinct MCCs seen in the entity's transaction history.
270
+ #
271
+ # @param first_txn_at [Time, nil] The timestamp of the first approved transaction for the entity, in ISO 8601 form
272
+ #
273
+ # @param is_first_transaction [Boolean, nil] Whether the entity has no prior transaction history. Returns true if no history
274
+ #
275
+ # @param last_cp_country [String, nil] The merchant country of the last card-present transaction.
276
+ #
277
+ # @param last_cp_postal_code [String, nil] The merchant postal code of the last card-present transaction.
278
+ #
279
+ # @param last_cp_timestamp [Time, nil] The timestamp of the last card-present transaction, in ISO 8601 format.
280
+ #
281
+ # @param last_txn_approved_at [Time, nil] The timestamp of the most recent approved transaction for the entity, in ISO 860
282
+ #
283
+ # @param seen_countries [Array<String>, nil] The set of merchant countries seen in the entity's transaction history. Clients
284
+ #
285
+ # @param seen_mccs [Array<String>, nil] The set of MCCs seen in the entity's transaction history. Clients can use this t
286
+ #
287
+ # @param seen_merchants [Array<String>, nil] The set of card acceptor IDs seen in the card's approved transaction history, ca
288
+ #
289
+ # @param stdev_transaction_amount [Float, nil] The standard deviation of approved transaction amounts over the entity's lifetim
290
+ #
291
+ # @param stdev_transaction_amount_30d [Float, nil] The standard deviation of approved transaction amounts over the last 30 days, in
292
+ #
293
+ # @param stdev_transaction_amount_7d [Float, nil] The standard deviation of approved transaction amounts over the last 7 days, in
294
+ #
295
+ # @param stdev_transaction_amount_90d [Float, nil] The standard deviation of approved transaction amounts over the last 90 days, in
296
+ #
297
+ # @param three_ds_success_count [Integer, nil] The number of successful 3DS authentications for the card. Null for account resp
298
+ #
299
+ # @param three_ds_success_rate [Float, nil] The 3DS authentication success rate for the card, as a percentage from 0.0 to 10
300
+ #
301
+ # @param three_ds_total_count [Integer, nil] The total number of 3DS authentication attempts for the card. Null for account r
302
+ #
303
+ # @param time_since_last_transaction_days [Float, nil] The number of days since the last approved transaction on the entity.
304
+ end
305
+ end
306
+ end
data/lib/lithic/models.rb CHANGED
@@ -82,6 +82,8 @@ module Lithic
82
82
 
83
83
  AccountRetrieveParams = Lithic::Models::AccountRetrieveParams
84
84
 
85
+ AccountRetrieveSignalsParams = Lithic::Models::AccountRetrieveSignalsParams
86
+
85
87
  AccountRetrieveSpendLimitsParams = Lithic::Models::AccountRetrieveSpendLimitsParams
86
88
 
87
89
  AccountSpendLimits = Lithic::Models::AccountSpendLimits
@@ -176,6 +178,8 @@ module Lithic
176
178
 
177
179
  CardRetrieveParams = Lithic::Models::CardRetrieveParams
178
180
 
181
+ CardRetrieveSignalsParams = Lithic::Models::CardRetrieveSignalsParams
182
+
179
183
  CardRetrieveSpendLimitsParams = Lithic::Models::CardRetrieveSpendLimitsParams
180
184
 
181
185
  Cards = Lithic::Models::Cards
@@ -487,6 +491,8 @@ module Lithic
487
491
 
488
492
  ShippingAddress = Lithic::Models::ShippingAddress
489
493
 
494
+ SignalsResponse = Lithic::Models::SignalsResponse
495
+
490
496
  SpendLimitDuration = Lithic::Models::SpendLimitDuration
491
497
 
492
498
  StatementsCreatedWebhookEvent = Lithic::Models::StatementsCreatedWebhookEvent
@@ -99,6 +99,33 @@ module Lithic
99
99
  )
100
100
  end
101
101
 
102
+ # Returns behavioral feature state derived from an account's transaction history.
103
+ #
104
+ # These signals expose the same data used by behavioral rule attributes (e.g.
105
+ # `AMOUNT_Z_SCORE` with `scope: ACCOUNT`, `IS_NEW_COUNTRY` with `scope: ACCOUNT`)
106
+ # and custom code `TRANSACTION_HISTORY_SIGNALS` features, allowing clients to
107
+ # inspect feature values before writing rules and debug rule behavior.
108
+ #
109
+ # Note: 3DS fields are not available at the account scope and will be null.
110
+ #
111
+ # @overload retrieve_signals(account_token, request_options: {})
112
+ #
113
+ # @param account_token [String] The token of the account to fetch signals for.
114
+ #
115
+ # @param request_options [Lithic::RequestOptions, Hash{Symbol=>Object}, nil]
116
+ #
117
+ # @return [Lithic::Models::SignalsResponse]
118
+ #
119
+ # @see Lithic::Models::AccountRetrieveSignalsParams
120
+ def retrieve_signals(account_token, params = {})
121
+ @client.request(
122
+ method: :get,
123
+ path: ["v1/accounts/%1$s/signals", account_token],
124
+ model: Lithic::SignalsResponse,
125
+ options: params[:request_options]
126
+ )
127
+ end
128
+
102
129
  # Get an Account's available spend limits, which is based on the spend limit
103
130
  # configured on the Account and the amount already spent over the spend limit's
104
131
  # duration. For example, if the Account has a daily spend limit of $1000
@@ -404,6 +404,31 @@ module Lithic
404
404
  )
405
405
  end
406
406
 
407
+ # Returns behavioral feature state derived from a card's transaction history.
408
+ #
409
+ # These signals expose the same data used by behavioral rule attributes (e.g.
410
+ # `AMOUNT_Z_SCORE` with `scope: CARD`, `IS_NEW_COUNTRY` with `scope: CARD`) and
411
+ # custom code `TRANSACTION_HISTORY_SIGNALS` features, allowing clients to inspect
412
+ # feature values before writing rules and debug rule behavior.
413
+ #
414
+ # @overload retrieve_signals(card_token, request_options: {})
415
+ #
416
+ # @param card_token [String] The token of the card to fetch signals for.
417
+ #
418
+ # @param request_options [Lithic::RequestOptions, Hash{Symbol=>Object}, nil]
419
+ #
420
+ # @return [Lithic::Models::SignalsResponse]
421
+ #
422
+ # @see Lithic::Models::CardRetrieveSignalsParams
423
+ def retrieve_signals(card_token, params = {})
424
+ @client.request(
425
+ method: :get,
426
+ path: ["v1/cards/%1$s/signals", card_token],
427
+ model: Lithic::SignalsResponse,
428
+ options: params[:request_options]
429
+ )
430
+ end
431
+
407
432
  # Get a Card's available spend limit, which is based on the spend limit configured
408
433
  # on the Card and the amount already spent over the spend limit's duration. For
409
434
  # example, if the Card has a monthly spend limit of $1000 configured, and has
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lithic
4
- VERSION = "0.13.0"
4
+ VERSION = "0.14.0"
5
5
  end
data/lib/lithic.rb CHANGED
@@ -109,6 +109,7 @@ require_relative "lithic/models/account_holder_upload_document_params"
109
109
  require_relative "lithic/models/account_holder_verification_webhook_event"
110
110
  require_relative "lithic/models/account_list_params"
111
111
  require_relative "lithic/models/account_retrieve_params"
112
+ require_relative "lithic/models/account_retrieve_signals_params"
112
113
  require_relative "lithic/models/account_retrieve_spend_limits_params"
113
114
  require_relative "lithic/models/account_spend_limits"
114
115
  require_relative "lithic/models/account_update_params"
@@ -195,6 +196,7 @@ require_relative "lithic/models/card_reissue_params"
195
196
  require_relative "lithic/models/card_renewed_webhook_event"
196
197
  require_relative "lithic/models/card_renew_params"
197
198
  require_relative "lithic/models/card_retrieve_params"
199
+ require_relative "lithic/models/card_retrieve_signals_params"
198
200
  require_relative "lithic/models/card_retrieve_spend_limits_params"
199
201
  require_relative "lithic/models/cards/balance_list_params"
200
202
  require_relative "lithic/models/cards/financial_transaction_list_params"
@@ -394,6 +396,7 @@ require_relative "lithic/models/settlement_detail"
394
396
  require_relative "lithic/models/settlement_report_updated_webhook_event"
395
397
  require_relative "lithic/models/settlement_summary_details"
396
398
  require_relative "lithic/models/shipping_address"
399
+ require_relative "lithic/models/signals_response"
397
400
  require_relative "lithic/models/spend_limit_duration"
398
401
  require_relative "lithic/models/statements_created_webhook_event"
399
402
  require_relative "lithic/models/statement_totals"