Skip to content

Commit 28a4b65

Browse files
feat(api): add condition attributes, interval/unit/scope to auth_rules
1 parent 37af713 commit 28a4b65

4 files changed

Lines changed: 665 additions & 26 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 213
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-65a6644277529a38afcac424d99d87cbfa4d8294423ad618dbbd875634ec1d3c.yml
3-
openapi_spec_hash: 6f3c1bb6a70830afb8af1dacd6352a97
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-42c58dcdae350a8544a75a19ad38aaeb70f3ed98dc642b4a7b47a4b92d8c9c91.yml
3+
openapi_spec_hash: c26c7c8fab1f49977c23bb698ec64e28
44
config_hash: 126e04f676f61e5871a82889336dbf9d

lib/lithic/models/auth_rules/conditional_card_transaction_update_action_parameters.rb

Lines changed: 195 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,52 @@ class Condition < Lithic::Internal::Type::BaseModel
7777
# - `SPEND_VELOCITY_AMOUNT`: The total spend amount (in cents) of transactions
7878
# matching the specified filters within the given period. Requires `parameters`
7979
# with `scope`, `period`, and optional `filters`. Use an integer value.
80+
# - `AMOUNT_Z_SCORE`: The z-score of the transaction amount relative to the
81+
# entity's transaction history. Null if fewer than 30 approved transactions in
82+
# the specified window. Requires `parameters.scope` and `parameters.interval`.
83+
# Use a decimal value.
84+
# - `AVG_TRANSACTION_AMOUNT`: The average approved transaction amount for the
85+
# entity over the specified window, in cents. Requires `parameters.scope` and
86+
# `parameters.interval`. Use a decimal value.
87+
# - `STDEV_TRANSACTION_AMOUNT`: The standard deviation of approved transaction
88+
# amounts for the entity over the specified window, in cents. Null if fewer than
89+
# 30 approved transactions in the specified window. Requires `parameters.scope`
90+
# and `parameters.interval`. Use a decimal value.
91+
# - `IS_NEW_COUNTRY`: Whether the transaction's merchant country has not been seen
92+
# in the entity's transaction history. Valid values are `TRUE`, `FALSE`.
93+
# Requires `parameters.scope`.
94+
# - `IS_NEW_MCC`: Whether the transaction's MCC has not been seen in the entity's
95+
# transaction history. Valid values are `TRUE`, `FALSE`. Requires
96+
# `parameters.scope`.
97+
# - `IS_FIRST_TRANSACTION`: Whether this is the first transaction for the entity.
98+
# Valid values are `TRUE`, `FALSE`. Requires `parameters.scope`.
99+
# - `CONSECUTIVE_DECLINES`: The number of consecutive declined transactions for
100+
# the entity over the last 30 days (rolling). Requires `parameters.scope`. Use
101+
# an integer value.
102+
# - `TIME_SINCE_LAST_TRANSACTION`: The number of days since the last approved
103+
# transaction for the entity, rounded to the nearest whole day. Requires
104+
# `parameters.scope`. Use an integer value.
105+
# - `DISTINCT_COUNTRY_COUNT`: The number of distinct merchant countries seen in
106+
# the entity's transaction history. Requires `parameters.scope`. Use an integer
107+
# value.
108+
# - `IS_NEW_MERCHANT`: Whether the card acceptor ID has not been seen in the
109+
# card's approved transaction history (capped at the 1000 most recently seen
110+
# merchants). Valid values are `TRUE`, `FALSE`. Card-scoped only; no
111+
# `parameters` required.
112+
# - `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
113+
# a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
114+
# Use a decimal value.
115+
# - `TRAVEL_SPEED`: The estimated speed of travel derived from the distance
116+
# between the postal code centers of the last card-present transaction and the
117+
# current transaction, divided by the elapsed time. Null if there is no prior
118+
# card-present transaction, if either postal code cannot be geocoded, or if
119+
# elapsed time is zero. Requires `parameters.unit` set to `MPH` or `KPH`. Use a
120+
# decimal value.
121+
# - `DISTANCE_FROM_LAST_TRANSACTION`: The estimated distance between the postal
122+
# code centers of the last card-present transaction and the current transaction.
123+
# Null if there is no prior card-present transaction or if either postal code
124+
# cannot be geocoded. Requires `parameters.unit` set to `MILES` or `KILOMETERS`.
125+
# Use a decimal value.
80126
#
81127
# @return [Symbol, Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Attribute]
82128
required :attribute,
@@ -95,8 +141,14 @@ class Condition < Lithic::Internal::Type::BaseModel
95141
required :value, union: -> { Lithic::AuthRules::ConditionalValue }
96142

97143
# @!attribute parameters
98-
# Additional parameters for spend velocity attributes. Required when `attribute`
99-
# is `SPEND_VELOCITY_COUNT` or `SPEND_VELOCITY_AMOUNT`. Not used for other
144+
# Additional parameters for certain attributes. Required when `attribute` is
145+
# `SPEND_VELOCITY_COUNT` or `SPEND_VELOCITY_AMOUNT` (require `scope`, `period`,
146+
# and optional `filters`); `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
147+
# `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
148+
# `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
149+
# or `DISTINCT_COUNTRY_COUNT` (require `scope`, and additionally `interval` for
150+
# the statistical attributes); or `TRAVEL_SPEED` or
151+
# `DISTANCE_FROM_LAST_TRANSACTION` (require `unit`). Not used for other
100152
# attributes.
101153
#
102154
# @return [Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters, nil]
@@ -114,7 +166,7 @@ class Condition < Lithic::Internal::Type::BaseModel
114166
#
115167
# @param value [String, Integer, Float, Array<String>, Time] A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
116168
#
117-
# @param parameters [Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters] Additional parameters for spend velocity attributes. Required when `attribute` i
169+
# @param parameters [Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters] Additional parameters for certain attributes. Required when `attribute` is
118170

119171
# The attribute to target.
120172
#
@@ -170,6 +222,52 @@ class Condition < Lithic::Internal::Type::BaseModel
170222
# - `SPEND_VELOCITY_AMOUNT`: The total spend amount (in cents) of transactions
171223
# matching the specified filters within the given period. Requires `parameters`
172224
# with `scope`, `period`, and optional `filters`. Use an integer value.
225+
# - `AMOUNT_Z_SCORE`: The z-score of the transaction amount relative to the
226+
# entity's transaction history. Null if fewer than 30 approved transactions in
227+
# the specified window. Requires `parameters.scope` and `parameters.interval`.
228+
# Use a decimal value.
229+
# - `AVG_TRANSACTION_AMOUNT`: The average approved transaction amount for the
230+
# entity over the specified window, in cents. Requires `parameters.scope` and
231+
# `parameters.interval`. Use a decimal value.
232+
# - `STDEV_TRANSACTION_AMOUNT`: The standard deviation of approved transaction
233+
# amounts for the entity over the specified window, in cents. Null if fewer than
234+
# 30 approved transactions in the specified window. Requires `parameters.scope`
235+
# and `parameters.interval`. Use a decimal value.
236+
# - `IS_NEW_COUNTRY`: Whether the transaction's merchant country has not been seen
237+
# in the entity's transaction history. Valid values are `TRUE`, `FALSE`.
238+
# Requires `parameters.scope`.
239+
# - `IS_NEW_MCC`: Whether the transaction's MCC has not been seen in the entity's
240+
# transaction history. Valid values are `TRUE`, `FALSE`. Requires
241+
# `parameters.scope`.
242+
# - `IS_FIRST_TRANSACTION`: Whether this is the first transaction for the entity.
243+
# Valid values are `TRUE`, `FALSE`. Requires `parameters.scope`.
244+
# - `CONSECUTIVE_DECLINES`: The number of consecutive declined transactions for
245+
# the entity over the last 30 days (rolling). Requires `parameters.scope`. Use
246+
# an integer value.
247+
# - `TIME_SINCE_LAST_TRANSACTION`: The number of days since the last approved
248+
# transaction for the entity, rounded to the nearest whole day. Requires
249+
# `parameters.scope`. Use an integer value.
250+
# - `DISTINCT_COUNTRY_COUNT`: The number of distinct merchant countries seen in
251+
# the entity's transaction history. Requires `parameters.scope`. Use an integer
252+
# value.
253+
# - `IS_NEW_MERCHANT`: Whether the card acceptor ID has not been seen in the
254+
# card's approved transaction history (capped at the 1000 most recently seen
255+
# merchants). Valid values are `TRUE`, `FALSE`. Card-scoped only; no
256+
# `parameters` required.
257+
# - `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
258+
# a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
259+
# Use a decimal value.
260+
# - `TRAVEL_SPEED`: The estimated speed of travel derived from the distance
261+
# between the postal code centers of the last card-present transaction and the
262+
# current transaction, divided by the elapsed time. Null if there is no prior
263+
# card-present transaction, if either postal code cannot be geocoded, or if
264+
# elapsed time is zero. Requires `parameters.unit` set to `MPH` or `KPH`. Use a
265+
# decimal value.
266+
# - `DISTANCE_FROM_LAST_TRANSACTION`: The estimated distance between the postal
267+
# code centers of the last card-present transaction and the current transaction.
268+
# Null if there is no prior card-present transaction or if either postal code
269+
# cannot be geocoded. Requires `parameters.unit` set to `MILES` or `KILOMETERS`.
270+
# Use a decimal value.
173271
#
174272
# @see Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition#attribute
175273
module Attribute
@@ -191,6 +289,19 @@ module Attribute
191289
ACCOUNT_AGE = :ACCOUNT_AGE
192290
SPEND_VELOCITY_COUNT = :SPEND_VELOCITY_COUNT
193291
SPEND_VELOCITY_AMOUNT = :SPEND_VELOCITY_AMOUNT
292+
AMOUNT_Z_SCORE = :AMOUNT_Z_SCORE
293+
AVG_TRANSACTION_AMOUNT = :AVG_TRANSACTION_AMOUNT
294+
STDEV_TRANSACTION_AMOUNT = :STDEV_TRANSACTION_AMOUNT
295+
IS_NEW_COUNTRY = :IS_NEW_COUNTRY
296+
IS_NEW_MCC = :IS_NEW_MCC
297+
IS_FIRST_TRANSACTION = :IS_FIRST_TRANSACTION
298+
CONSECUTIVE_DECLINES = :CONSECUTIVE_DECLINES
299+
TIME_SINCE_LAST_TRANSACTION = :TIME_SINCE_LAST_TRANSACTION
300+
DISTINCT_COUNTRY_COUNT = :DISTINCT_COUNTRY_COUNT
301+
IS_NEW_MERCHANT = :IS_NEW_MERCHANT
302+
THREE_DS_SUCCESS_RATE = :THREE_DS_SUCCESS_RATE
303+
TRAVEL_SPEED = :TRAVEL_SPEED
304+
DISTANCE_FROM_LAST_TRANSACTION = :DISTANCE_FROM_LAST_TRANSACTION
194305

195306
# @!method self.values
196307
# @return [Array<Symbol>]
@@ -203,31 +314,86 @@ class Parameters < Lithic::Internal::Type::BaseModel
203314
# @return [Lithic::Models::AuthRules::SpendVelocityFilters, nil]
204315
optional :filters, -> { Lithic::AuthRules::SpendVelocityFilters }
205316

317+
# @!attribute interval
318+
# The time window for statistical attributes (`AMOUNT_Z_SCORE`,
319+
# `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`). Use `LIFETIME` for
320+
# all-time history or a specific window (`7D`, `30D`, `90D`).
321+
#
322+
# @return [Symbol, Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters::Interval, nil]
323+
optional :interval,
324+
enum: -> { Lithic::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters::Interval }
325+
206326
# @!attribute period
207327
# The time period over which to calculate the spend velocity.
208328
#
209329
# @return [Lithic::Models::AuthRules::VelocityLimitPeriod::TrailingWindowObject, Lithic::Models::AuthRules::VelocityLimitPeriod::FixedWindowDay, Lithic::Models::AuthRules::VelocityLimitPeriod::FixedWindowWeek, Lithic::Models::AuthRules::VelocityLimitPeriod::FixedWindowMonth, Lithic::Models::AuthRules::VelocityLimitPeriod::FixedWindowYear, nil]
210330
optional :period, union: -> { Lithic::AuthRules::VelocityLimitPeriod }
211331

212332
# @!attribute scope
213-
# The entity scope to evaluate the attribute against.
333+
# The entity scope to evaluate the attribute against. `GLOBAL` is only valid for
334+
# spend velocity attributes.
214335
#
215336
# @return [Symbol, Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters::Scope, nil]
216337
optional :scope,
217338
enum: -> { Lithic::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters::Scope }
218339

219-
# @!method initialize(filters: nil, period: nil, scope: nil)
220-
# Additional parameters for spend velocity attributes. Required when `attribute`
221-
# is `SPEND_VELOCITY_COUNT` or `SPEND_VELOCITY_AMOUNT`. Not used for other
340+
# @!attribute unit
341+
# The unit for impossible travel attributes. Required when `attribute` is
342+
# `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION`.
343+
#
344+
# For `TRAVEL_SPEED`: `MPH` (miles per hour) or `KPH` (kilometers per hour).
345+
#
346+
# For `DISTANCE_FROM_LAST_TRANSACTION`: `MILES` or `KILOMETERS`.
347+
#
348+
# @return [Symbol, Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters::Unit, nil]
349+
optional :unit,
350+
enum: -> { Lithic::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters::Unit }
351+
352+
# @!method initialize(filters: nil, interval: nil, period: nil, scope: nil, unit: nil)
353+
# Some parameter documentations has been truncated, see
354+
# {Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters}
355+
# for more details.
356+
#
357+
# Additional parameters for certain attributes. Required when `attribute` is
358+
# `SPEND_VELOCITY_COUNT` or `SPEND_VELOCITY_AMOUNT` (require `scope`, `period`,
359+
# and optional `filters`); `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
360+
# `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
361+
# `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
362+
# or `DISTINCT_COUNTRY_COUNT` (require `scope`, and additionally `interval` for
363+
# the statistical attributes); or `TRAVEL_SPEED` or
364+
# `DISTANCE_FROM_LAST_TRANSACTION` (require `unit`). Not used for other
222365
# attributes.
223366
#
224367
# @param filters [Lithic::Models::AuthRules::SpendVelocityFilters]
225368
#
369+
# @param interval [Symbol, Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters::Interval] The time window for statistical attributes (`AMOUNT_Z_SCORE`, `AVG_TRANSACTION_A
370+
#
226371
# @param period [Lithic::Models::AuthRules::VelocityLimitPeriod::TrailingWindowObject, Lithic::Models::AuthRules::VelocityLimitPeriod::FixedWindowDay, Lithic::Models::AuthRules::VelocityLimitPeriod::FixedWindowWeek, Lithic::Models::AuthRules::VelocityLimitPeriod::FixedWindowMonth, Lithic::Models::AuthRules::VelocityLimitPeriod::FixedWindowYear] The time period over which to calculate the spend velocity.
227372
#
228-
# @param scope [Symbol, Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters::Scope] The entity scope to evaluate the attribute against.
373+
# @param scope [Symbol, Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters::Scope] The entity scope to evaluate the attribute against. `GLOBAL` is only valid for
374+
#
375+
# @param unit [Symbol, Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters::Unit] The unit for impossible travel attributes. Required when `attribute` is
376+
# `TRAVEL\_
229377

230-
# The entity scope to evaluate the attribute against.
378+
# The time window for statistical attributes (`AMOUNT_Z_SCORE`,
379+
# `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`). Use `LIFETIME` for
380+
# all-time history or a specific window (`7D`, `30D`, `90D`).
381+
#
382+
# @see Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters#interval
383+
module Interval
384+
extend Lithic::Internal::Type::Enum
385+
386+
LIFETIME = :LIFETIME
387+
INTERVAL_7_D = :"7D"
388+
INTERVAL_30_D = :"30D"
389+
INTERVAL_90_D = :"90D"
390+
391+
# @!method self.values
392+
# @return [Array<Symbol>]
393+
end
394+
395+
# The entity scope to evaluate the attribute against. `GLOBAL` is only valid for
396+
# spend velocity attributes.
231397
#
232398
# @see Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters#scope
233399
module Scope
@@ -240,6 +406,26 @@ module Scope
240406
# @!method self.values
241407
# @return [Array<Symbol>]
242408
end
409+
410+
# The unit for impossible travel attributes. Required when `attribute` is
411+
# `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION`.
412+
#
413+
# For `TRAVEL_SPEED`: `MPH` (miles per hour) or `KPH` (kilometers per hour).
414+
#
415+
# For `DISTANCE_FROM_LAST_TRANSACTION`: `MILES` or `KILOMETERS`.
416+
#
417+
# @see Lithic::Models::AuthRules::ConditionalCardTransactionUpdateActionParameters::Condition::Parameters#unit
418+
module Unit
419+
extend Lithic::Internal::Type::Enum
420+
421+
MPH = :MPH
422+
KPH = :KPH
423+
MILES = :MILES
424+
KILOMETERS = :KILOMETERS
425+
426+
# @!method self.values
427+
# @return [Array<Symbol>]
428+
end
243429
end
244430
end
245431
end

0 commit comments

Comments
 (0)