lithic 0.13.0 → 0.15.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.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +1 -1
  4. data/lib/lithic/client.rb +4 -0
  5. data/lib/lithic/internal/transport/base_client.rb +2 -0
  6. data/lib/lithic/models/account_holder_simulate_enrollment_review_response.rb +4 -4
  7. data/lib/lithic/models/account_retrieve_signals_params.rb +20 -0
  8. data/lib/lithic/models/auth_rules/auth_rule.rb +10 -6
  9. data/lib/lithic/models/auth_rules/auth_rule_condition.rb +2 -2
  10. data/lib/lithic/models/auth_rules/auth_rule_version.rb +5 -3
  11. data/lib/lithic/models/auth_rules/conditional_3ds_action_parameters.rb +8 -6
  12. data/lib/lithic/models/auth_rules/conditional_ach_action_parameters.rb +4 -4
  13. data/lib/lithic/models/auth_rules/conditional_authorization_action_parameters.rb +119 -44
  14. data/lib/lithic/models/auth_rules/conditional_authorization_adjustment_parameters.rb +533 -0
  15. data/lib/lithic/models/auth_rules/conditional_card_transaction_update_action_parameters.rb +18 -14
  16. data/lib/lithic/models/auth_rules/conditional_tokenization_action_parameters.rb +6 -6
  17. data/lib/lithic/models/auth_rules/conditional_value.rb +3 -2
  18. data/lib/lithic/models/auth_rules/v2_create_params.rb +15 -9
  19. data/lib/lithic/models/auth_rules/v2_draft_params.rb +5 -3
  20. data/lib/lithic/models/balance.rb +8 -6
  21. data/lib/lithic/models/card_authorization.rb +1266 -0
  22. data/lib/lithic/models/card_authorization_approval_request_webhook_event.rb +3 -1253
  23. data/lib/lithic/models/card_authorization_challenge_response_params.rb +40 -0
  24. data/lib/lithic/models/card_authorization_challenge_response_webhook_event.rb +1 -0
  25. data/lib/lithic/models/card_authorization_challenge_webhook_event.rb +67 -0
  26. data/lib/lithic/models/card_program.rb +2 -2
  27. data/lib/lithic/models/card_retrieve_signals_params.rb +20 -0
  28. data/lib/lithic/models/event.rb +13 -4
  29. data/lib/lithic/models/event_list_params.rb +7 -2
  30. data/lib/lithic/models/event_subscription.rb +7 -2
  31. data/lib/lithic/models/events/subscription_create_params.rb +7 -2
  32. data/lib/lithic/models/events/subscription_send_simulated_example_params.rb +1 -0
  33. data/lib/lithic/models/events/subscription_update_params.rb +7 -2
  34. data/lib/lithic/models/external_bank_account.rb +1 -1
  35. data/lib/lithic/models/external_bank_account_pause_params.rb +20 -0
  36. data/lib/lithic/models/financial_accounts/statement.rb +4 -4
  37. data/lib/lithic/models/financial_accounts/statements/statement_line_items.rb +3 -2
  38. data/lib/lithic/models/financial_event.rb +1 -0
  39. data/lib/lithic/models/kyb_business_entity.rb +2 -2
  40. data/lib/lithic/models/parsed_webhook_event.rb +4 -1
  41. data/lib/lithic/models/settlement_detail.rb +14 -14
  42. data/lib/lithic/models/signals_response.rb +306 -0
  43. data/lib/lithic/models/statement_totals.rb +6 -6
  44. data/lib/lithic/models/tokenization_decline_reason.rb +1 -0
  45. data/lib/lithic/models/transaction.rb +2 -2
  46. data/lib/lithic/models/transfer_limits_response.rb +12 -12
  47. data/lib/lithic/models.rb +14 -0
  48. data/lib/lithic/resources/accounts.rb +27 -0
  49. data/lib/lithic/resources/auth_rules/v2.rb +1 -1
  50. data/lib/lithic/resources/card_authorizations.rb +45 -0
  51. data/lib/lithic/resources/cards.rb +25 -0
  52. data/lib/lithic/resources/external_bank_accounts.rb +19 -0
  53. data/lib/lithic/resources/webhooks.rb +1 -1
  54. data/lib/lithic/version.rb +1 -1
  55. data/lib/lithic.rb +9 -0
  56. data/rbi/lithic/client.rbi +3 -0
  57. data/rbi/lithic/models/account_holder_simulate_enrollment_review_response.rbi +6 -12
  58. data/rbi/lithic/models/account_retrieve_signals_params.rbi +35 -0
  59. data/rbi/lithic/models/auth_rules/auth_rule.rbi +8 -4
  60. data/rbi/lithic/models/auth_rules/auth_rule_version.rbi +4 -2
  61. data/rbi/lithic/models/auth_rules/conditional_3ds_action_parameters.rbi +9 -6
  62. data/rbi/lithic/models/auth_rules/conditional_ach_action_parameters.rbi +3 -3
  63. data/rbi/lithic/models/auth_rules/conditional_authorization_action_parameters.rbi +214 -63
  64. data/rbi/lithic/models/auth_rules/conditional_authorization_adjustment_parameters.rbi +1147 -0
  65. data/rbi/lithic/models/auth_rules/conditional_card_transaction_update_action_parameters.rbi +24 -18
  66. data/rbi/lithic/models/auth_rules/conditional_tokenization_action_parameters.rbi +6 -6
  67. data/rbi/lithic/models/auth_rules/conditional_value.rbi +1 -1
  68. data/rbi/lithic/models/auth_rules/v2_create_params.rbi +24 -12
  69. data/rbi/lithic/models/auth_rules/v2_draft_params.rbi +8 -4
  70. data/rbi/lithic/models/balance.rbi +12 -6
  71. data/rbi/lithic/models/card_authorization.rbi +2540 -0
  72. data/rbi/lithic/models/card_authorization_approval_request_webhook_event.rbi +5 -2758
  73. data/rbi/lithic/models/card_authorization_challenge_response_params.rbi +93 -0
  74. data/rbi/lithic/models/card_authorization_challenge_response_webhook_event.rbi +5 -0
  75. data/rbi/lithic/models/card_authorization_challenge_webhook_event.rbi +119 -0
  76. data/rbi/lithic/models/card_program.rbi +3 -6
  77. data/rbi/lithic/models/card_retrieve_signals_params.rbi +35 -0
  78. data/rbi/lithic/models/event.rbi +23 -6
  79. data/rbi/lithic/models/event_list_params.rbi +11 -2
  80. data/rbi/lithic/models/event_subscription.rbi +11 -2
  81. data/rbi/lithic/models/events/subscription_create_params.rbi +11 -2
  82. data/rbi/lithic/models/events/subscription_send_simulated_example_params.rbi +5 -0
  83. data/rbi/lithic/models/events/subscription_update_params.rbi +11 -2
  84. data/rbi/lithic/models/external_bank_account_pause_params.rbi +41 -0
  85. data/rbi/lithic/models/financial_accounts/statement.rbi +6 -12
  86. data/rbi/lithic/models/financial_accounts/statements/statement_line_items.rbi +8 -6
  87. data/rbi/lithic/models/financial_event.rbi +2 -0
  88. data/rbi/lithic/models/kyb_business_entity.rbi +3 -6
  89. data/rbi/lithic/models/parsed_webhook_event.rbi +1 -0
  90. data/rbi/lithic/models/settlement_detail.rbi +15 -15
  91. data/rbi/lithic/models/signals_response.rbi +352 -0
  92. data/rbi/lithic/models/statement_totals.rbi +9 -18
  93. data/rbi/lithic/models/tokenization_decline_reason.rbi +2 -0
  94. data/rbi/lithic/models/transaction.rbi +3 -3
  95. data/rbi/lithic/models/transfer_limits_response.rbi +48 -48
  96. data/rbi/lithic/models.rbi +17 -0
  97. data/rbi/lithic/resources/accounts.rbi +21 -0
  98. data/rbi/lithic/resources/auth_rules/v2.rbi +2 -1
  99. data/rbi/lithic/resources/card_authorizations.rbi +35 -0
  100. data/rbi/lithic/resources/cards.rbi +19 -0
  101. data/rbi/lithic/resources/external_bank_accounts.rbi +10 -0
  102. data/rbi/lithic/resources/webhooks.rbi +4 -1
  103. data/sig/lithic/client.rbs +2 -0
  104. data/sig/lithic/models/account_holder_simulate_enrollment_review_response.rbs +8 -12
  105. data/sig/lithic/models/account_retrieve_signals_params.rbs +23 -0
  106. data/sig/lithic/models/auth_rules/auth_rule.rbs +2 -0
  107. data/sig/lithic/models/auth_rules/auth_rule_version.rbs +1 -0
  108. data/sig/lithic/models/auth_rules/conditional_authorization_action_parameters.rbs +29 -3
  109. data/sig/lithic/models/auth_rules/conditional_authorization_adjustment_parameters.rbs +276 -0
  110. data/sig/lithic/models/auth_rules/conditional_value.rbs +1 -1
  111. data/sig/lithic/models/auth_rules/v2_create_params.rbs +3 -0
  112. data/sig/lithic/models/auth_rules/v2_draft_params.rbs +1 -0
  113. data/sig/lithic/models/balance.rbs +17 -9
  114. data/sig/lithic/models/card_authorization.rbs +1038 -0
  115. data/sig/lithic/models/card_authorization_approval_request_webhook_event.rbs +7 -1013
  116. data/sig/lithic/models/card_authorization_challenge_response_params.rbs +42 -0
  117. data/sig/lithic/models/card_authorization_challenge_response_webhook_event.rbs +2 -1
  118. data/sig/lithic/models/card_authorization_challenge_webhook_event.rbs +53 -0
  119. data/sig/lithic/models/card_program.rbs +4 -6
  120. data/sig/lithic/models/card_retrieve_signals_params.rbs +23 -0
  121. data/sig/lithic/models/event.rbs +2 -0
  122. data/sig/lithic/models/event_list_params.rbs +2 -0
  123. data/sig/lithic/models/event_subscription.rbs +2 -0
  124. data/sig/lithic/models/events/subscription_create_params.rbs +2 -0
  125. data/sig/lithic/models/events/subscription_send_simulated_example_params.rbs +2 -0
  126. data/sig/lithic/models/events/subscription_update_params.rbs +2 -0
  127. data/sig/lithic/models/external_bank_account_pause_params.rbs +24 -0
  128. data/sig/lithic/models/financial_accounts/statement.rbs +8 -12
  129. data/sig/lithic/models/financial_accounts/statements/statement_line_items.rbs +6 -6
  130. data/sig/lithic/models/financial_event.rbs +2 -0
  131. data/sig/lithic/models/kyb_business_entity.rbs +4 -6
  132. data/sig/lithic/models/parsed_webhook_event.rbs +1 -0
  133. data/sig/lithic/models/settlement_detail.rbs +18 -18
  134. data/sig/lithic/models/signals_response.rbs +170 -0
  135. data/sig/lithic/models/statement_totals.rbs +12 -18
  136. data/sig/lithic/models/tokenization_decline_reason.rbs +2 -0
  137. data/sig/lithic/models/transaction.rbs +4 -8
  138. data/sig/lithic/models/transfer_limits_response.rbs +24 -36
  139. data/sig/lithic/models.rbs +14 -0
  140. data/sig/lithic/resources/accounts.rbs +5 -0
  141. data/sig/lithic/resources/card_authorizations.rbs +13 -0
  142. data/sig/lithic/resources/cards.rbs +5 -0
  143. data/sig/lithic/resources/external_bank_accounts.rbs +5 -0
  144. data/sig/lithic/resources/webhooks.rbs +1 -0
  145. metadata +29 -2
@@ -14,17 +14,17 @@ module Lithic
14
14
 
15
15
  # Globally unique identifier denoting the account that the associated transaction
16
16
  # occurred on.
17
- sig { returns(String) }
17
+ sig { returns(T.nilable(String)) }
18
18
  attr_accessor :account_token
19
19
 
20
20
  # Globally unique identifier denoting the card program that the associated
21
21
  # transaction occurred on.
22
- sig { returns(String) }
22
+ sig { returns(T.nilable(String)) }
23
23
  attr_accessor :card_program_token
24
24
 
25
25
  # Globally unique identifier denoting the card that the associated transaction
26
26
  # occurred on.
27
- sig { returns(String) }
27
+ sig { returns(T.nilable(String)) }
28
28
  attr_accessor :card_token
29
29
 
30
30
  # Date and time when the transaction first occurred. UTC time zone.
@@ -87,12 +87,12 @@ module Lithic
87
87
  attr_accessor :settlement_date
88
88
 
89
89
  # Globally unique identifier denoting the associated transaction. For settlement
90
- # records with type `CLEARING`, `FINANCIAL`, or `NON-FINANCIAL`, this references a
90
+ # records with type `CLEARING`, `FINANCIAL`, or `NON_FINANCIAL`, this references a
91
91
  # card transaction token. For settlement records with type `CHARGEBACK`,
92
92
  # `REPRESENTMENT`, `PREARBITRATION`, `ARBITRATION`, or `COLLABORATION`, this
93
93
  # references the dispute transaction token. May be null for certain settlement
94
94
  # types.
95
- sig { returns(String) }
95
+ sig { returns(T.nilable(String)) }
96
96
  attr_accessor :transaction_token
97
97
 
98
98
  # The total amount of settlement impacting transactions (excluding interchange,
@@ -118,9 +118,9 @@ module Lithic
118
118
  sig do
119
119
  params(
120
120
  token: String,
121
- account_token: String,
122
- card_program_token: String,
123
- card_token: String,
121
+ account_token: T.nilable(String),
122
+ card_program_token: T.nilable(String),
123
+ card_token: T.nilable(String),
124
124
  created: Time,
125
125
  currency: String,
126
126
  disputes_gross_amount: Integer,
@@ -134,7 +134,7 @@ module Lithic
134
134
  other_fees_gross_amount: Integer,
135
135
  report_date: String,
136
136
  settlement_date: String,
137
- transaction_token: String,
137
+ transaction_token: T.nilable(String),
138
138
  transactions_gross_amount: Integer,
139
139
  type: Lithic::SettlementDetail::Type::OrSymbol,
140
140
  updated: Time,
@@ -182,7 +182,7 @@ module Lithic
182
182
  # advisement date, which is distinct from the date of money movement.
183
183
  settlement_date:,
184
184
  # Globally unique identifier denoting the associated transaction. For settlement
185
- # records with type `CLEARING`, `FINANCIAL`, or `NON-FINANCIAL`, this references a
185
+ # records with type `CLEARING`, `FINANCIAL`, or `NON_FINANCIAL`, this references a
186
186
  # card transaction token. For settlement records with type `CHARGEBACK`,
187
187
  # `REPRESENTMENT`, `PREARBITRATION`, `ARBITRATION`, or `COLLABORATION`, this
188
188
  # references the dispute transaction token. May be null for certain settlement
@@ -204,9 +204,9 @@ module Lithic
204
204
  override.returns(
205
205
  {
206
206
  token: String,
207
- account_token: String,
208
- card_program_token: String,
209
- card_token: String,
207
+ account_token: T.nilable(String),
208
+ card_program_token: T.nilable(String),
209
+ card_token: T.nilable(String),
210
210
  created: Time,
211
211
  currency: String,
212
212
  disputes_gross_amount: Integer,
@@ -219,7 +219,7 @@ module Lithic
219
219
  other_fees_gross_amount: Integer,
220
220
  report_date: String,
221
221
  settlement_date: String,
222
- transaction_token: String,
222
+ transaction_token: T.nilable(String),
223
223
  transactions_gross_amount: Integer,
224
224
  type: Lithic::SettlementDetail::Type::TaggedSymbol,
225
225
  updated: Time,
@@ -305,7 +305,7 @@ module Lithic
305
305
  FINANCIAL =
306
306
  T.let(:FINANCIAL, Lithic::SettlementDetail::Type::TaggedSymbol)
307
307
  NON_FINANCIAL =
308
- T.let(:"NON-FINANCIAL", Lithic::SettlementDetail::Type::TaggedSymbol)
308
+ T.let(:NON_FINANCIAL, Lithic::SettlementDetail::Type::TaggedSymbol)
309
309
  PREARBITRATION =
310
310
  T.let(:PREARBITRATION, Lithic::SettlementDetail::Type::TaggedSymbol)
311
311
  REPRESENTMENT =
@@ -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
@@ -43,24 +43,15 @@ module Lithic
43
43
 
44
44
  # Breakdown of credits
45
45
  sig { returns(T.nilable(T.anything)) }
46
- attr_reader :credit_details
47
-
48
- sig { params(credit_details: T.anything).void }
49
- attr_writer :credit_details
46
+ attr_accessor :credit_details
50
47
 
51
48
  # Breakdown of debits
52
49
  sig { returns(T.nilable(T.anything)) }
53
- attr_reader :debit_details
54
-
55
- sig { params(debit_details: T.anything).void }
56
- attr_writer :debit_details
50
+ attr_accessor :debit_details
57
51
 
58
52
  # Breakdown of payments
59
53
  sig { returns(T.nilable(T.anything)) }
60
- attr_reader :payment_details
61
-
62
- sig { params(payment_details: T.anything).void }
63
- attr_writer :payment_details
54
+ attr_accessor :payment_details
64
55
 
65
56
  sig do
66
57
  params(
@@ -72,9 +63,9 @@ module Lithic
72
63
  interest: Integer,
73
64
  payments: Integer,
74
65
  purchases: Integer,
75
- credit_details: T.anything,
76
- debit_details: T.anything,
77
- payment_details: T.anything
66
+ credit_details: T.nilable(T.anything),
67
+ debit_details: T.nilable(T.anything),
68
+ payment_details: T.nilable(T.anything)
78
69
  ).returns(T.attached_class)
79
70
  end
80
71
  def self.new(
@@ -115,9 +106,9 @@ module Lithic
115
106
  interest: Integer,
116
107
  payments: Integer,
117
108
  purchases: Integer,
118
- credit_details: T.anything,
119
- debit_details: T.anything,
120
- payment_details: T.anything
109
+ credit_details: T.nilable(T.anything),
110
+ debit_details: T.nilable(T.anything),
111
+ payment_details: T.nilable(T.anything)
121
112
  }
122
113
  )
123
114
  end
@@ -60,6 +60,8 @@ module Lithic
60
60
  :DIGITAL_CARD_ART_REQUIRED,
61
61
  Lithic::TokenizationDeclineReason::TaggedSymbol
62
62
  )
63
+ INVALID_PAN =
64
+ T.let(:INVALID_PAN, Lithic::TokenizationDeclineReason::TaggedSymbol)
63
65
 
64
66
  sig do
65
67
  override.returns(
@@ -1551,7 +1551,7 @@ module Lithic
1551
1551
  sig do
1552
1552
  params(
1553
1553
  network_specific_data:
1554
- Lithic::Transaction::Event::NetworkSpecificData::OrHash
1554
+ T.nilable(Lithic::Transaction::Event::NetworkSpecificData::OrHash)
1555
1555
  ).void
1556
1556
  end
1557
1557
  attr_writer :network_specific_data
@@ -1574,7 +1574,7 @@ module Lithic
1574
1574
  type: Lithic::Transaction::Event::Type::OrSymbol,
1575
1575
  account_type: Lithic::Transaction::Event::AccountType::OrSymbol,
1576
1576
  network_specific_data:
1577
- Lithic::Transaction::Event::NetworkSpecificData::OrHash
1577
+ T.nilable(Lithic::Transaction::Event::NetworkSpecificData::OrHash)
1578
1578
  ).returns(T.attached_class)
1579
1579
  end
1580
1580
  def self.new(
@@ -1627,7 +1627,7 @@ module Lithic
1627
1627
  account_type:
1628
1628
  Lithic::Transaction::Event::AccountType::TaggedSymbol,
1629
1629
  network_specific_data:
1630
- Lithic::Transaction::Event::NetworkSpecificData
1630
+ T.nilable(Lithic::Transaction::Event::NetworkSpecificData)
1631
1631
  }
1632
1632
  )
1633
1633
  end