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.
@@ -0,0 +1,35 @@
1
+ # typed: strong
2
+
3
+ module Lithic
4
+ module Models
5
+ class AccountRetrieveSignalsParams < Lithic::Internal::Type::BaseModel
6
+ extend Lithic::Internal::Type::RequestParameters::Converter
7
+ include Lithic::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Lithic::AccountRetrieveSignalsParams, Lithic::Internal::AnyHash)
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :account_token
16
+
17
+ sig do
18
+ params(
19
+ account_token: String,
20
+ request_options: Lithic::RequestOptions::OrHash
21
+ ).returns(T.attached_class)
22
+ end
23
+ def self.new(account_token:, request_options: {})
24
+ end
25
+
26
+ sig do
27
+ override.returns(
28
+ { account_token: String, request_options: Lithic::RequestOptions }
29
+ )
30
+ end
31
+ def to_hash
32
+ end
33
+ end
34
+ end
35
+ end
@@ -207,6 +207,15 @@ module Lithic
207
207
  # `parameters` required.
208
208
  # - `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
209
209
  # a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
210
+ # - `TRAVEL_SPEED`: The estimated speed of travel derived from the distance
211
+ # between the postal code centers of the last card-present transaction and the
212
+ # current transaction, divided by the elapsed time. Null if there is no prior
213
+ # card-present transaction, if either postal code cannot be geocoded, or if
214
+ # elapsed time is zero. Requires `parameters.unit` set to `MPH` or `KPH`.
215
+ # - `DISTANCE_FROM_LAST_TRANSACTION`: The estimated distance between the postal
216
+ # code centers of the last card-present transaction and the current transaction.
217
+ # Null if there is no prior card-present transaction or if either postal code
218
+ # cannot be geocoded. Requires `parameters.unit` set to `MILES` or `KILOMETERS`.
210
219
  sig do
211
220
  returns(
212
221
  Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Attribute::OrSymbol
@@ -222,11 +231,12 @@ module Lithic
222
231
  sig { returns(Lithic::AuthRules::ConditionalValue::Variants) }
223
232
  attr_accessor :value
224
233
 
225
- # Additional parameters required for transaction history signal attributes.
226
- # Required when `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
227
- # `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
228
- # `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
229
- # or `DISTINCT_COUNTRY_COUNT`. Not used for other attributes.
234
+ # Additional parameters for certain attributes. Required when `attribute` is one
235
+ # of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`,
236
+ # `IS_NEW_COUNTRY`, `IS_NEW_MCC`, `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`,
237
+ # `TIME_SINCE_LAST_TRANSACTION`, or `DISTINCT_COUNTRY_COUNT` (require `scope`); or
238
+ # `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION` (require `unit`). Not used
239
+ # for other attributes.
230
240
  sig do
231
241
  returns(
232
242
  T.nilable(
@@ -357,16 +367,26 @@ module Lithic
357
367
  # `parameters` required.
358
368
  # - `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
359
369
  # a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
370
+ # - `TRAVEL_SPEED`: The estimated speed of travel derived from the distance
371
+ # between the postal code centers of the last card-present transaction and the
372
+ # current transaction, divided by the elapsed time. Null if there is no prior
373
+ # card-present transaction, if either postal code cannot be geocoded, or if
374
+ # elapsed time is zero. Requires `parameters.unit` set to `MPH` or `KPH`.
375
+ # - `DISTANCE_FROM_LAST_TRANSACTION`: The estimated distance between the postal
376
+ # code centers of the last card-present transaction and the current transaction.
377
+ # Null if there is no prior card-present transaction or if either postal code
378
+ # cannot be geocoded. Requires `parameters.unit` set to `MILES` or `KILOMETERS`.
360
379
  attribute:,
361
380
  # The operation to apply to the attribute
362
381
  operation:,
363
382
  # A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
364
383
  value:,
365
- # Additional parameters required for transaction history signal attributes.
366
- # Required when `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
367
- # `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
368
- # `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
369
- # or `DISTINCT_COUNTRY_COUNT`. Not used for other attributes.
384
+ # Additional parameters for certain attributes. Required when `attribute` is one
385
+ # of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`,
386
+ # `IS_NEW_COUNTRY`, `IS_NEW_MCC`, `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`,
387
+ # `TIME_SINCE_LAST_TRANSACTION`, or `DISTINCT_COUNTRY_COUNT` (require `scope`); or
388
+ # `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION` (require `unit`). Not used
389
+ # for other attributes.
370
390
  parameters: nil
371
391
  )
372
392
  end
@@ -488,6 +508,15 @@ module Lithic
488
508
  # `parameters` required.
489
509
  # - `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
490
510
  # a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
511
+ # - `TRAVEL_SPEED`: The estimated speed of travel derived from the distance
512
+ # between the postal code centers of the last card-present transaction and the
513
+ # current transaction, divided by the elapsed time. Null if there is no prior
514
+ # card-present transaction, if either postal code cannot be geocoded, or if
515
+ # elapsed time is zero. Requires `parameters.unit` set to `MPH` or `KPH`.
516
+ # - `DISTANCE_FROM_LAST_TRANSACTION`: The estimated distance between the postal
517
+ # code centers of the last card-present transaction and the current transaction.
518
+ # Null if there is no prior card-present transaction or if either postal code
519
+ # cannot be geocoded. Requires `parameters.unit` set to `MILES` or `KILOMETERS`.
491
520
  module Attribute
492
521
  extend Lithic::Internal::Type::Enum
493
522
 
@@ -685,6 +714,16 @@ module Lithic
685
714
  :THREE_DS_SUCCESS_RATE,
686
715
  Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Attribute::TaggedSymbol
687
716
  )
717
+ TRAVEL_SPEED =
718
+ T.let(
719
+ :TRAVEL_SPEED,
720
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Attribute::TaggedSymbol
721
+ )
722
+ DISTANCE_FROM_LAST_TRANSACTION =
723
+ T.let(
724
+ :DISTANCE_FROM_LAST_TRANSACTION,
725
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Attribute::TaggedSymbol
726
+ )
688
727
 
689
728
  sig do
690
729
  override.returns(
@@ -744,17 +783,43 @@ module Lithic
744
783
  end
745
784
  attr_writer :scope
746
785
 
747
- # Additional parameters required for transaction history signal attributes.
748
- # Required when `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
749
- # `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
750
- # `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
751
- # or `DISTINCT_COUNTRY_COUNT`. Not used for other attributes.
786
+ # The unit for impossible travel attributes. Required when `attribute` is
787
+ # `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION`.
788
+ #
789
+ # For `TRAVEL_SPEED`: `MPH` (miles per hour) or `KPH` (kilometers per hour).
790
+ #
791
+ # For `DISTANCE_FROM_LAST_TRANSACTION`: `MILES` or `KILOMETERS`.
792
+ sig do
793
+ returns(
794
+ T.nilable(
795
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit::OrSymbol
796
+ )
797
+ )
798
+ end
799
+ attr_reader :unit
800
+
801
+ sig do
802
+ params(
803
+ unit:
804
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit::OrSymbol
805
+ ).void
806
+ end
807
+ attr_writer :unit
808
+
809
+ # Additional parameters for certain attributes. Required when `attribute` is one
810
+ # of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`,
811
+ # `IS_NEW_COUNTRY`, `IS_NEW_MCC`, `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`,
812
+ # `TIME_SINCE_LAST_TRANSACTION`, or `DISTINCT_COUNTRY_COUNT` (require `scope`); or
813
+ # `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION` (require `unit`). Not used
814
+ # for other attributes.
752
815
  sig do
753
816
  params(
754
817
  interval:
755
818
  Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Interval::OrSymbol,
756
819
  scope:
757
- Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Scope::OrSymbol
820
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Scope::OrSymbol,
821
+ unit:
822
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit::OrSymbol
758
823
  ).returns(T.attached_class)
759
824
  end
760
825
  def self.new(
@@ -763,7 +828,14 @@ module Lithic
763
828
  # all-time history or a specific window (`7D`, `30D`, `90D`).
764
829
  interval: nil,
765
830
  # The entity scope to evaluate the attribute against.
766
- scope: nil
831
+ scope: nil,
832
+ # The unit for impossible travel attributes. Required when `attribute` is
833
+ # `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION`.
834
+ #
835
+ # For `TRAVEL_SPEED`: `MPH` (miles per hour) or `KPH` (kilometers per hour).
836
+ #
837
+ # For `DISTANCE_FROM_LAST_TRANSACTION`: `MILES` or `KILOMETERS`.
838
+ unit: nil
767
839
  )
768
840
  end
769
841
 
@@ -773,7 +845,9 @@ module Lithic
773
845
  interval:
774
846
  Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Interval::OrSymbol,
775
847
  scope:
776
- Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Scope::OrSymbol
848
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Scope::OrSymbol,
849
+ unit:
850
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit::OrSymbol
777
851
  }
778
852
  )
779
853
  end
@@ -866,6 +940,56 @@ module Lithic
866
940
  def self.values
867
941
  end
868
942
  end
943
+
944
+ # The unit for impossible travel attributes. Required when `attribute` is
945
+ # `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION`.
946
+ #
947
+ # For `TRAVEL_SPEED`: `MPH` (miles per hour) or `KPH` (kilometers per hour).
948
+ #
949
+ # For `DISTANCE_FROM_LAST_TRANSACTION`: `MILES` or `KILOMETERS`.
950
+ module Unit
951
+ extend Lithic::Internal::Type::Enum
952
+
953
+ TaggedSymbol =
954
+ T.type_alias do
955
+ T.all(
956
+ Symbol,
957
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit
958
+ )
959
+ end
960
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
961
+
962
+ MPH =
963
+ T.let(
964
+ :MPH,
965
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit::TaggedSymbol
966
+ )
967
+ KPH =
968
+ T.let(
969
+ :KPH,
970
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit::TaggedSymbol
971
+ )
972
+ MILES =
973
+ T.let(
974
+ :MILES,
975
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit::TaggedSymbol
976
+ )
977
+ KILOMETERS =
978
+ T.let(
979
+ :KILOMETERS,
980
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit::TaggedSymbol
981
+ )
982
+
983
+ sig do
984
+ override.returns(
985
+ T::Array[
986
+ Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Unit::TaggedSymbol
987
+ ]
988
+ )
989
+ end
990
+ def self.values
991
+ end
992
+ end
869
993
  end
870
994
  end
871
995
  end
@@ -0,0 +1,35 @@
1
+ # typed: strong
2
+
3
+ module Lithic
4
+ module Models
5
+ class CardRetrieveSignalsParams < Lithic::Internal::Type::BaseModel
6
+ extend Lithic::Internal::Type::RequestParameters::Converter
7
+ include Lithic::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Lithic::CardRetrieveSignalsParams, Lithic::Internal::AnyHash)
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :card_token
16
+
17
+ sig do
18
+ params(
19
+ card_token: String,
20
+ request_options: Lithic::RequestOptions::OrHash
21
+ ).returns(T.attached_class)
22
+ end
23
+ def self.new(card_token:, request_options: {})
24
+ end
25
+
26
+ sig do
27
+ override.returns(
28
+ { card_token: String, request_options: Lithic::RequestOptions }
29
+ )
30
+ end
31
+ def to_hash
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,352 @@
1
+ # typed: strong
2
+
3
+ module Lithic
4
+ module Models
5
+ class SignalsResponse < Lithic::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Lithic::SignalsResponse, Lithic::Internal::AnyHash)
9
+ end
10
+
11
+ # The Welford M2 accumulator for lifetime approved transaction amounts. Used
12
+ # together with `avg_transaction_amount` and `approved_txn_count` to compute the
13
+ # z-score of a new transaction amount (variance = M2 / (count - 1)).
14
+ sig { returns(T.nilable(Float)) }
15
+ attr_accessor :approved_txn_amount_m2
16
+
17
+ # The Welford M2 accumulator for approved transaction amounts over the last 30
18
+ # days.
19
+ sig { returns(T.nilable(Float)) }
20
+ attr_accessor :approved_txn_amount_m2_30d
21
+
22
+ # The Welford M2 accumulator for approved transaction amounts over the last 7
23
+ # days.
24
+ sig { returns(T.nilable(Float)) }
25
+ attr_accessor :approved_txn_amount_m2_7d
26
+
27
+ # The Welford M2 accumulator for approved transaction amounts over the last 90
28
+ # days.
29
+ sig { returns(T.nilable(Float)) }
30
+ attr_accessor :approved_txn_amount_m2_90d
31
+
32
+ # The total number of approved transactions over the entity's lifetime.
33
+ sig { returns(T.nilable(Integer)) }
34
+ attr_accessor :approved_txn_count
35
+
36
+ # The number of approved transactions in the last 30 days.
37
+ sig { returns(T.nilable(Integer)) }
38
+ attr_accessor :approved_txn_count_30d
39
+
40
+ # The number of approved transactions in the last 7 days.
41
+ sig { returns(T.nilable(Integer)) }
42
+ attr_accessor :approved_txn_count_7d
43
+
44
+ # The number of approved transactions in the last 90 days.
45
+ sig { returns(T.nilable(Integer)) }
46
+ attr_accessor :approved_txn_count_90d
47
+
48
+ # The average approved transaction amount over the entity's lifetime, in cents.
49
+ # Null if fewer than 5 approved transactions have been recorded.
50
+ sig { returns(T.nilable(Float)) }
51
+ attr_accessor :avg_transaction_amount
52
+
53
+ # The average approved transaction amount over the last 30 days, in cents. Null if
54
+ # fewer than 5 approved transactions in window.
55
+ sig { returns(T.nilable(Float)) }
56
+ attr_accessor :avg_transaction_amount_30d
57
+
58
+ # The average approved transaction amount over the last 7 days, in cents. Null if
59
+ # fewer than 5 approved transactions in window.
60
+ sig { returns(T.nilable(Float)) }
61
+ attr_accessor :avg_transaction_amount_7d
62
+
63
+ # The average approved transaction amount over the last 90 days, in cents. Null if
64
+ # fewer than 5 approved transactions in window.
65
+ sig { returns(T.nilable(Float)) }
66
+ attr_accessor :avg_transaction_amount_90d
67
+
68
+ # The number of distinct merchant countries seen in the entity's transaction
69
+ # history.
70
+ sig { returns(T.nilable(Integer)) }
71
+ attr_accessor :distinct_country_count
72
+
73
+ # The number of distinct MCCs seen in the entity's transaction history.
74
+ sig { returns(T.nilable(Integer)) }
75
+ attr_accessor :distinct_mcc_count
76
+
77
+ # The timestamp of the first approved transaction for the entity, in ISO 8601
78
+ # format.
79
+ sig { returns(T.nilable(Time)) }
80
+ attr_accessor :first_txn_at
81
+
82
+ # Whether the entity has no prior transaction history. Returns true if no history
83
+ # is found. Null if transaction history exists but a first transaction timestamp
84
+ # is unavailable.
85
+ sig { returns(T.nilable(T::Boolean)) }
86
+ attr_accessor :is_first_transaction
87
+
88
+ # The merchant country of the last card-present transaction.
89
+ sig { returns(T.nilable(String)) }
90
+ attr_accessor :last_cp_country
91
+
92
+ # The merchant postal code of the last card-present transaction.
93
+ sig { returns(T.nilable(String)) }
94
+ attr_accessor :last_cp_postal_code
95
+
96
+ # The timestamp of the last card-present transaction, in ISO 8601 format.
97
+ sig { returns(T.nilable(Time)) }
98
+ attr_accessor :last_cp_timestamp
99
+
100
+ # The timestamp of the most recent approved transaction for the entity, in ISO
101
+ # 8601 format.
102
+ sig { returns(T.nilable(Time)) }
103
+ attr_accessor :last_txn_approved_at
104
+
105
+ # The set of merchant countries seen in the entity's transaction history. Clients
106
+ # can use this to determine whether a new transaction's country is novel (i.e.
107
+ # compute `is_new_country`).
108
+ sig { returns(T.nilable(T::Array[String])) }
109
+ attr_accessor :seen_countries
110
+
111
+ # The set of MCCs seen in the entity's transaction history. Clients can use this
112
+ # to determine whether a new transaction's MCC is novel (i.e. compute
113
+ # `is_new_mcc`).
114
+ sig { returns(T.nilable(T::Array[String])) }
115
+ attr_accessor :seen_mccs
116
+
117
+ # The set of card acceptor IDs seen in the card's approved transaction history,
118
+ # capped at the 1000 most recently seen. Null for account responses. Clients can
119
+ # use this to determine whether a new transaction's merchant is novel (i.e.
120
+ # compute `is_new_merchant`).
121
+ sig { returns(T.nilable(T::Array[String])) }
122
+ attr_accessor :seen_merchants
123
+
124
+ # The standard deviation of approved transaction amounts over the entity's
125
+ # lifetime, in cents. Null if fewer than 30 approved transactions have been
126
+ # recorded.
127
+ sig { returns(T.nilable(Float)) }
128
+ attr_accessor :stdev_transaction_amount
129
+
130
+ # The standard deviation of approved transaction amounts over the last 30 days, in
131
+ # cents. Null if fewer than 30 approved transactions in window.
132
+ sig { returns(T.nilable(Float)) }
133
+ attr_accessor :stdev_transaction_amount_30d
134
+
135
+ # The standard deviation of approved transaction amounts over the last 7 days, in
136
+ # cents. Null if fewer than 30 approved transactions in window.
137
+ sig { returns(T.nilable(Float)) }
138
+ attr_accessor :stdev_transaction_amount_7d
139
+
140
+ # The standard deviation of approved transaction amounts over the last 90 days, in
141
+ # cents. Null if fewer than 30 approved transactions in window.
142
+ sig { returns(T.nilable(Float)) }
143
+ attr_accessor :stdev_transaction_amount_90d
144
+
145
+ # The number of successful 3DS authentications for the card. Null for account
146
+ # responses.
147
+ sig { returns(T.nilable(Integer)) }
148
+ attr_accessor :three_ds_success_count
149
+
150
+ # The 3DS authentication success rate for the card, as a percentage from 0.0 to
151
+ # 100.0. Null for account responses.
152
+ sig { returns(T.nilable(Float)) }
153
+ attr_accessor :three_ds_success_rate
154
+
155
+ # The total number of 3DS authentication attempts for the card. Null for account
156
+ # responses.
157
+ sig { returns(T.nilable(Integer)) }
158
+ attr_accessor :three_ds_total_count
159
+
160
+ # The number of days since the last approved transaction on the entity.
161
+ sig { returns(T.nilable(Float)) }
162
+ attr_accessor :time_since_last_transaction_days
163
+
164
+ # Behavioral feature state for a card or account derived from its transaction
165
+ # history.
166
+ #
167
+ # Derived statistical features (averages, standard deviations, z-scores) are
168
+ # computed using Welford's online algorithm over approved transactions. Average
169
+ # fields are null when fewer than 5 approved transactions have been recorded.
170
+ # Standard deviation fields are null when fewer than 30 approved transactions have
171
+ # been recorded.
172
+ #
173
+ # 3DS fields (`three_ds_success_rate`, `three_ds_success_count`,
174
+ # `three_ds_total_count`) are card-scoped and will be null for account responses.
175
+ #
176
+ # Raw fields (`seen_countries`, `seen_mccs`, `approved_txn_amount_m2`, etc.) are
177
+ # included so clients can compute their own transaction-specific derivations, such
178
+ # as checking whether a new transaction's country is in `seen_countries` to
179
+ # determine `is_new_country`, or computing a z-score using the raw mean and M2
180
+ # values.
181
+ sig do
182
+ params(
183
+ approved_txn_amount_m2: T.nilable(Float),
184
+ approved_txn_amount_m2_30d: T.nilable(Float),
185
+ approved_txn_amount_m2_7d: T.nilable(Float),
186
+ approved_txn_amount_m2_90d: T.nilable(Float),
187
+ approved_txn_count: T.nilable(Integer),
188
+ approved_txn_count_30d: T.nilable(Integer),
189
+ approved_txn_count_7d: T.nilable(Integer),
190
+ approved_txn_count_90d: T.nilable(Integer),
191
+ avg_transaction_amount: T.nilable(Float),
192
+ avg_transaction_amount_30d: T.nilable(Float),
193
+ avg_transaction_amount_7d: T.nilable(Float),
194
+ avg_transaction_amount_90d: T.nilable(Float),
195
+ distinct_country_count: T.nilable(Integer),
196
+ distinct_mcc_count: T.nilable(Integer),
197
+ first_txn_at: T.nilable(Time),
198
+ is_first_transaction: T.nilable(T::Boolean),
199
+ last_cp_country: T.nilable(String),
200
+ last_cp_postal_code: T.nilable(String),
201
+ last_cp_timestamp: T.nilable(Time),
202
+ last_txn_approved_at: T.nilable(Time),
203
+ seen_countries: T.nilable(T::Array[String]),
204
+ seen_mccs: T.nilable(T::Array[String]),
205
+ seen_merchants: T.nilable(T::Array[String]),
206
+ stdev_transaction_amount: T.nilable(Float),
207
+ stdev_transaction_amount_30d: T.nilable(Float),
208
+ stdev_transaction_amount_7d: T.nilable(Float),
209
+ stdev_transaction_amount_90d: T.nilable(Float),
210
+ three_ds_success_count: T.nilable(Integer),
211
+ three_ds_success_rate: T.nilable(Float),
212
+ three_ds_total_count: T.nilable(Integer),
213
+ time_since_last_transaction_days: T.nilable(Float)
214
+ ).returns(T.attached_class)
215
+ end
216
+ def self.new(
217
+ # The Welford M2 accumulator for lifetime approved transaction amounts. Used
218
+ # together with `avg_transaction_amount` and `approved_txn_count` to compute the
219
+ # z-score of a new transaction amount (variance = M2 / (count - 1)).
220
+ approved_txn_amount_m2:,
221
+ # The Welford M2 accumulator for approved transaction amounts over the last 30
222
+ # days.
223
+ approved_txn_amount_m2_30d:,
224
+ # The Welford M2 accumulator for approved transaction amounts over the last 7
225
+ # days.
226
+ approved_txn_amount_m2_7d:,
227
+ # The Welford M2 accumulator for approved transaction amounts over the last 90
228
+ # days.
229
+ approved_txn_amount_m2_90d:,
230
+ # The total number of approved transactions over the entity's lifetime.
231
+ approved_txn_count:,
232
+ # The number of approved transactions in the last 30 days.
233
+ approved_txn_count_30d:,
234
+ # The number of approved transactions in the last 7 days.
235
+ approved_txn_count_7d:,
236
+ # The number of approved transactions in the last 90 days.
237
+ approved_txn_count_90d:,
238
+ # The average approved transaction amount over the entity's lifetime, in cents.
239
+ # Null if fewer than 5 approved transactions have been recorded.
240
+ avg_transaction_amount:,
241
+ # The average approved transaction amount over the last 30 days, in cents. Null if
242
+ # fewer than 5 approved transactions in window.
243
+ avg_transaction_amount_30d:,
244
+ # The average approved transaction amount over the last 7 days, in cents. Null if
245
+ # fewer than 5 approved transactions in window.
246
+ avg_transaction_amount_7d:,
247
+ # The average approved transaction amount over the last 90 days, in cents. Null if
248
+ # fewer than 5 approved transactions in window.
249
+ avg_transaction_amount_90d:,
250
+ # The number of distinct merchant countries seen in the entity's transaction
251
+ # history.
252
+ distinct_country_count:,
253
+ # The number of distinct MCCs seen in the entity's transaction history.
254
+ distinct_mcc_count:,
255
+ # The timestamp of the first approved transaction for the entity, in ISO 8601
256
+ # format.
257
+ first_txn_at:,
258
+ # Whether the entity has no prior transaction history. Returns true if no history
259
+ # is found. Null if transaction history exists but a first transaction timestamp
260
+ # is unavailable.
261
+ is_first_transaction:,
262
+ # The merchant country of the last card-present transaction.
263
+ last_cp_country:,
264
+ # The merchant postal code of the last card-present transaction.
265
+ last_cp_postal_code:,
266
+ # The timestamp of the last card-present transaction, in ISO 8601 format.
267
+ last_cp_timestamp:,
268
+ # The timestamp of the most recent approved transaction for the entity, in ISO
269
+ # 8601 format.
270
+ last_txn_approved_at:,
271
+ # The set of merchant countries seen in the entity's transaction history. Clients
272
+ # can use this to determine whether a new transaction's country is novel (i.e.
273
+ # compute `is_new_country`).
274
+ seen_countries:,
275
+ # The set of MCCs seen in the entity's transaction history. Clients can use this
276
+ # to determine whether a new transaction's MCC is novel (i.e. compute
277
+ # `is_new_mcc`).
278
+ seen_mccs:,
279
+ # The set of card acceptor IDs seen in the card's approved transaction history,
280
+ # capped at the 1000 most recently seen. Null for account responses. Clients can
281
+ # use this to determine whether a new transaction's merchant is novel (i.e.
282
+ # compute `is_new_merchant`).
283
+ seen_merchants:,
284
+ # The standard deviation of approved transaction amounts over the entity's
285
+ # lifetime, in cents. Null if fewer than 30 approved transactions have been
286
+ # recorded.
287
+ stdev_transaction_amount:,
288
+ # The standard deviation of approved transaction amounts over the last 30 days, in
289
+ # cents. Null if fewer than 30 approved transactions in window.
290
+ stdev_transaction_amount_30d:,
291
+ # The standard deviation of approved transaction amounts over the last 7 days, in
292
+ # cents. Null if fewer than 30 approved transactions in window.
293
+ stdev_transaction_amount_7d:,
294
+ # The standard deviation of approved transaction amounts over the last 90 days, in
295
+ # cents. Null if fewer than 30 approved transactions in window.
296
+ stdev_transaction_amount_90d:,
297
+ # The number of successful 3DS authentications for the card. Null for account
298
+ # responses.
299
+ three_ds_success_count:,
300
+ # The 3DS authentication success rate for the card, as a percentage from 0.0 to
301
+ # 100.0. Null for account responses.
302
+ three_ds_success_rate:,
303
+ # The total number of 3DS authentication attempts for the card. Null for account
304
+ # responses.
305
+ three_ds_total_count:,
306
+ # The number of days since the last approved transaction on the entity.
307
+ time_since_last_transaction_days:
308
+ )
309
+ end
310
+
311
+ sig do
312
+ override.returns(
313
+ {
314
+ approved_txn_amount_m2: T.nilable(Float),
315
+ approved_txn_amount_m2_30d: T.nilable(Float),
316
+ approved_txn_amount_m2_7d: T.nilable(Float),
317
+ approved_txn_amount_m2_90d: T.nilable(Float),
318
+ approved_txn_count: T.nilable(Integer),
319
+ approved_txn_count_30d: T.nilable(Integer),
320
+ approved_txn_count_7d: T.nilable(Integer),
321
+ approved_txn_count_90d: T.nilable(Integer),
322
+ avg_transaction_amount: T.nilable(Float),
323
+ avg_transaction_amount_30d: T.nilable(Float),
324
+ avg_transaction_amount_7d: T.nilable(Float),
325
+ avg_transaction_amount_90d: T.nilable(Float),
326
+ distinct_country_count: T.nilable(Integer),
327
+ distinct_mcc_count: T.nilable(Integer),
328
+ first_txn_at: T.nilable(Time),
329
+ is_first_transaction: T.nilable(T::Boolean),
330
+ last_cp_country: T.nilable(String),
331
+ last_cp_postal_code: T.nilable(String),
332
+ last_cp_timestamp: T.nilable(Time),
333
+ last_txn_approved_at: T.nilable(Time),
334
+ seen_countries: T.nilable(T::Array[String]),
335
+ seen_mccs: T.nilable(T::Array[String]),
336
+ seen_merchants: T.nilable(T::Array[String]),
337
+ stdev_transaction_amount: T.nilable(Float),
338
+ stdev_transaction_amount_30d: T.nilable(Float),
339
+ stdev_transaction_amount_7d: T.nilable(Float),
340
+ stdev_transaction_amount_90d: T.nilable(Float),
341
+ three_ds_success_count: T.nilable(Integer),
342
+ three_ds_success_rate: T.nilable(Float),
343
+ three_ds_total_count: T.nilable(Integer),
344
+ time_since_last_transaction_days: T.nilable(Float)
345
+ }
346
+ )
347
+ end
348
+ def to_hash
349
+ end
350
+ end
351
+ end
352
+ end
@@ -53,6 +53,8 @@ module Lithic
53
53
 
54
54
  AccountRetrieveParams = Lithic::Models::AccountRetrieveParams
55
55
 
56
+ AccountRetrieveSignalsParams = Lithic::Models::AccountRetrieveSignalsParams
57
+
56
58
  AccountRetrieveSpendLimitsParams =
57
59
  Lithic::Models::AccountRetrieveSpendLimitsParams
58
60
 
@@ -153,6 +155,8 @@ module Lithic
153
155
 
154
156
  CardRetrieveParams = Lithic::Models::CardRetrieveParams
155
157
 
158
+ CardRetrieveSignalsParams = Lithic::Models::CardRetrieveSignalsParams
159
+
156
160
  CardRetrieveSpendLimitsParams = Lithic::Models::CardRetrieveSpendLimitsParams
157
161
 
158
162
  Cards = Lithic::Models::Cards
@@ -501,6 +505,8 @@ module Lithic
501
505
 
502
506
  ShippingAddress = Lithic::Models::ShippingAddress
503
507
 
508
+ SignalsResponse = Lithic::Models::SignalsResponse
509
+
504
510
  SpendLimitDuration = Lithic::Models::SpendLimitDuration
505
511
 
506
512
  StatementsCreatedWebhookEvent = Lithic::Models::StatementsCreatedWebhookEvent