lithic 0.10.0 → 0.12.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 (104) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +49 -0
  3. data/README.md +1 -1
  4. data/lib/lithic/internal/util.rb +22 -7
  5. data/lib/lithic/models/auth_rules/backtest_stats.rb +9 -1
  6. data/lib/lithic/models/auth_rules/conditional_authorization_action_parameters.rb +158 -1
  7. data/lib/lithic/models/auth_rules/report_stats.rb +46 -81
  8. data/lib/lithic/models/auth_rules/rule_feature.rb +47 -1
  9. data/lib/lithic/models/auth_rules/typescript_code_parameters.rb +2 -2
  10. data/lib/lithic/models/auth_rules/v2_list_results_response.rb +36 -4
  11. data/lib/lithic/models/auth_rules/v2_retrieve_report_response.rb +4 -531
  12. data/lib/lithic/models/card_authorization_approval_request_webhook_event.rb +17 -26
  13. data/lib/lithic/models/card_authorization_challenge_response_webhook_event.rb +103 -0
  14. data/lib/lithic/models/card_bulk_order.rb +8 -3
  15. data/lib/lithic/models/card_bulk_order_create_params.rb +8 -3
  16. data/lib/lithic/models/card_convert_physical_params.rb +5 -3
  17. data/lib/lithic/models/card_create_params.rb +5 -3
  18. data/lib/lithic/models/card_reissue_params.rb +5 -3
  19. data/lib/lithic/models/card_renew_params.rb +5 -3
  20. data/lib/lithic/models/event.rb +5 -0
  21. data/lib/lithic/models/event_list_params.rb +3 -0
  22. data/lib/lithic/models/event_subscription.rb +3 -0
  23. data/lib/lithic/models/events/subscription_create_params.rb +3 -0
  24. data/lib/lithic/models/events/subscription_send_simulated_example_params.rb +1 -0
  25. data/lib/lithic/models/events/subscription_update_params.rb +3 -0
  26. data/lib/lithic/models/external_bank_account_set_verification_method_params.rb +55 -0
  27. data/lib/lithic/models/financial_account.rb +1 -0
  28. data/lib/lithic/models/financial_account_update_status_params.rb +1 -0
  29. data/lib/lithic/models/financial_accounts/statement.rb +11 -4
  30. data/lib/lithic/models/instance_financial_account_type.rb +1 -0
  31. data/lib/lithic/models/parsed_webhook_event.rb +3 -1
  32. data/lib/lithic/models/payment_create_params.rb +13 -1
  33. data/lib/lithic/models.rb +6 -0
  34. data/lib/lithic/resources/card_bulk_orders.rb +10 -11
  35. data/lib/lithic/resources/external_bank_accounts.rb +31 -0
  36. data/lib/lithic/resources/webhooks.rb +1 -1
  37. data/lib/lithic/version.rb +1 -1
  38. data/lib/lithic.rb +2 -0
  39. data/rbi/lithic/internal/util.rbi +8 -0
  40. data/rbi/lithic/models/auth_rules/backtest_stats.rbi +11 -3
  41. data/rbi/lithic/models/auth_rules/conditional_authorization_action_parameters.rbi +370 -3
  42. data/rbi/lithic/models/auth_rules/report_stats.rbi +73 -177
  43. data/rbi/lithic/models/auth_rules/rule_feature.rbi +104 -1
  44. data/rbi/lithic/models/auth_rules/typescript_code_parameters.rbi +6 -3
  45. data/rbi/lithic/models/auth_rules/v2_list_results_response.rbi +38 -6
  46. data/rbi/lithic/models/auth_rules/v2_retrieve_report_response.rbi +3 -1721
  47. data/rbi/lithic/models/card_authorization_approval_request_webhook_event.rbi +23 -78
  48. data/rbi/lithic/models/card_authorization_challenge_response_webhook_event.rbi +175 -0
  49. data/rbi/lithic/models/card_bulk_order.rbi +21 -3
  50. data/rbi/lithic/models/card_bulk_order_create_params.rbi +21 -3
  51. data/rbi/lithic/models/card_convert_physical_params.rbi +8 -5
  52. data/rbi/lithic/models/card_create_params.rbi +8 -8
  53. data/rbi/lithic/models/card_reissue_params.rbi +8 -8
  54. data/rbi/lithic/models/card_renew_params.rbi +8 -8
  55. data/rbi/lithic/models/event.rbi +11 -0
  56. data/rbi/lithic/models/event_list_params.rbi +7 -0
  57. data/rbi/lithic/models/event_subscription.rbi +7 -0
  58. data/rbi/lithic/models/events/subscription_create_params.rbi +7 -0
  59. data/rbi/lithic/models/events/subscription_send_simulated_example_params.rbi +5 -0
  60. data/rbi/lithic/models/events/subscription_update_params.rbi +7 -0
  61. data/rbi/lithic/models/external_bank_account_set_verification_method_params.rbi +111 -0
  62. data/rbi/lithic/models/financial_account.rbi +5 -0
  63. data/rbi/lithic/models/financial_account_update_status_params.rbi +5 -0
  64. data/rbi/lithic/models/financial_accounts/statement.rbi +15 -6
  65. data/rbi/lithic/models/instance_financial_account_type.rbi +5 -0
  66. data/rbi/lithic/models/parsed_webhook_event.rbi +1 -0
  67. data/rbi/lithic/models/payment_create_params.rbi +13 -3
  68. data/rbi/lithic/models.rbi +6 -0
  69. data/rbi/lithic/resources/card_bulk_orders.rbi +11 -11
  70. data/rbi/lithic/resources/cards.rbi +8 -4
  71. data/rbi/lithic/resources/external_bank_accounts.rbi +22 -0
  72. data/rbi/lithic/resources/webhooks.rbi +1 -0
  73. data/sig/lithic/internal/util.rbs +4 -0
  74. data/sig/lithic/models/auth_rules/backtest_stats.rbs +8 -3
  75. data/sig/lithic/models/auth_rules/conditional_authorization_action_parameters.rbs +93 -3
  76. data/sig/lithic/models/auth_rules/report_stats.rbs +34 -70
  77. data/sig/lithic/models/auth_rules/rule_feature.rbs +42 -0
  78. data/sig/lithic/models/auth_rules/v2_list_results_response.rbs +29 -9
  79. data/sig/lithic/models/auth_rules/v2_retrieve_report_response.rbs +4 -667
  80. data/sig/lithic/models/card_authorization_approval_request_webhook_event.rbs +14 -41
  81. data/sig/lithic/models/card_authorization_challenge_response_webhook_event.rbs +76 -0
  82. data/sig/lithic/models/card_bulk_order.rbs +5 -1
  83. data/sig/lithic/models/card_bulk_order_create_params.rbs +5 -1
  84. data/sig/lithic/models/card_convert_physical_params.rbs +2 -2
  85. data/sig/lithic/models/card_create_params.rbs +2 -2
  86. data/sig/lithic/models/card_reissue_params.rbs +2 -2
  87. data/sig/lithic/models/card_renew_params.rbs +2 -2
  88. data/sig/lithic/models/event.rbs +2 -0
  89. data/sig/lithic/models/event_list_params.rbs +2 -0
  90. data/sig/lithic/models/event_subscription.rbs +2 -0
  91. data/sig/lithic/models/events/subscription_create_params.rbs +2 -0
  92. data/sig/lithic/models/events/subscription_send_simulated_example_params.rbs +2 -0
  93. data/sig/lithic/models/events/subscription_update_params.rbs +2 -0
  94. data/sig/lithic/models/external_bank_account_set_verification_method_params.rbs +51 -0
  95. data/sig/lithic/models/financial_account.rbs +2 -0
  96. data/sig/lithic/models/financial_account_update_status_params.rbs +2 -0
  97. data/sig/lithic/models/financial_accounts/statement.rbs +16 -7
  98. data/sig/lithic/models/instance_financial_account_type.rbs +2 -0
  99. data/sig/lithic/models/parsed_webhook_event.rbs +1 -0
  100. data/sig/lithic/models/payment_create_params.rbs +8 -3
  101. data/sig/lithic/models.rbs +4 -0
  102. data/sig/lithic/resources/external_bank_accounts.rbs +7 -0
  103. data/sig/lithic/resources/webhooks.rbs +1 -0
  104. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11e88e82fcc0153f5cdb72e8c89059d80322983cad5a04f21f7ee8cb58652a86
4
- data.tar.gz: 326182c35442ef57d523b917d1f561302916593e64d9be3e72c4d8c47607ffd5
3
+ metadata.gz: f0ee91f9eb716880267ff8f0ceec1c0c1a68c030864826cdd077802e802c7b07
4
+ data.tar.gz: a43b4db3e1c7c2084c6bc79c8b6ab6f9776ce1402f3380e997e977ac6c15a6f2
5
5
  SHA512:
6
- metadata.gz: da808cf2213f4fb880952816609649f93de70b6b4c544820d0bc3a86c93644f63bafb3a78debe42c0ba3c42bc5c9b62fdef755353f79234f6081990c72be9478
7
- data.tar.gz: 29c1e2e9d8dbecf4f4fe2d20942afc6b625935627fe15deffc3b49ab03722f07aadd0eacf5c2146920feb50d6c6ab57f5e18544517dc6ca076c536fbbf890c13
6
+ metadata.gz: 9bc92ae6b2aed386110d68ee7bc6f423fe5e8c34b16e923b97efeb004c5c1699bab929e41f0af80a7733d32e25d42fd19a09bb22323e2fe3801c10e21ce3da9d
7
+ data.tar.gz: 7b4c1ecbb2902bc7ecb06e55f730f9db3e25536179e7042ef013de2fc126d8b413a0834f2878824cec583c065c50fc57e0f228a75dcade4f2d5130bf6b7e85b0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.0 (2026-04-20)
4
+
5
+ Full Changelog: [v0.11.0...v0.12.0](https://github.com/lithic-com/lithic-ruby/compare/v0.11.0...v0.12.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** Add card_authorization.challenge_response webhook ([8abc734](https://github.com/lithic-com/lithic-ruby/commit/8abc7348e6ed248c532058d68388fc357e54f65f))
10
+ * **api:** Add card/account/business account signals endpoints and behavioral rule attributes ([76de3de](https://github.com/lithic-com/lithic-ruby/commit/76de3de7a510e54712be632789e90457b7486f3d))
11
+ * **api:** add set_verification_method to external_bank_accounts ([3878cb3](https://github.com/lithic-com/lithic-ruby/commit/3878cb30db9f591d2070bed948cc40da07dd3f0e))
12
+
13
+ ## 0.11.0 (2026-04-13)
14
+
15
+ Full Changelog: [v0.10.0...v0.11.0](https://github.com/lithic-com/lithic-ruby/compare/v0.10.0...v0.11.0)
16
+
17
+ ### Features
18
+
19
+ * **api:** add card decline count attributes to auth_rules conditional authorization ([d8d98d9](https://github.com/lithic-com/lithic-ruby/commit/d8d98d927f33b011b1a28c37df6b971ab7c895a0))
20
+ * **api:** add DELINQUENT substatus to financial account update status ([6a49f69](https://github.com/lithic-com/lithic-ruby/commit/6a49f690f00b7c261e22201aaac8521db124e4dc))
21
+ * **api:** add interchange/chargeback/provisional_credit_account to financial account type enums ([3d54444](https://github.com/lithic-com/lithic-ruby/commit/3d544442bb1ecfc4c69c806fb72cf8a1b0564c8d))
22
+ * **api:** add override_company_name field to payment create parameters ([7e916b6](https://github.com/lithic-com/lithic-ruby/commit/7e916b6bb6e41494aab381d5a30bb83f9ea6ca23))
23
+ * **api:** add statement_totals field to financial accounts statement ([1fa7586](https://github.com/lithic-com/lithic-ruby/commit/1fa758668e1caf7beefca72abe384c99d112ae85))
24
+ * **api:** add transaction_token field to auth_rules examples ([4729281](https://github.com/lithic-com/lithic-ruby/commit/47292818b9afc96e2ac358235012b4deb8987016))
25
+ * **api:** add transaction_token field to auth_rules v2 results response ([acca757](https://github.com/lithic-com/lithic-ruby/commit/acca757780ead14f428e035409c3b7cb815d9d83))
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * align path encoding with RFC 3986 section 3.3 ([5624e72](https://github.com/lithic-com/lithic-ruby/commit/5624e7234a615d0de2ecc92e007be91a54a90c98))
31
+ * **internal:** correct multipart form field name encoding ([abfc1fd](https://github.com/lithic-com/lithic-ruby/commit/abfc1fdd7c78682932979e362448f95bca347d43))
32
+ * multipart encoding for file arrays ([5a0bdeb](https://github.com/lithic-com/lithic-ruby/commit/5a0bdeb87640bd6340039f86a366886894e9991a))
33
+ * **types:** [breaking] remove deprecated fields from auth_rules report_stats ([f3089b7](https://github.com/lithic-com/lithic-ruby/commit/f3089b7a510244d7c566bc69cc68d4564b899bec))
34
+ * **types:** make credit_product_token optional in financial_accounts statement ([a0fa401](https://github.com/lithic-com/lithic-ruby/commit/a0fa40166b98f3d7e91878d5ea948027c72ea440))
35
+ * **types:** remove INTERCHANGE/CHARGEBACK from FinancialAccount/InstanceFinancialAccountType ([6077d32](https://github.com/lithic-com/lithic-ruby/commit/6077d32ca7a8bc77204000d9c2e0cf7f28569c4b))
36
+ * **types:** require Card fields, remove hostname in authorization approval webhook ([fb4f7d9](https://github.com/lithic-com/lithic-ruby/commit/fb4f7d98735f400ca090a07b7fe59373e8eb9ef1))
37
+ * variable name typo ([0156ca5](https://github.com/lithic-com/lithic-ruby/commit/0156ca5e46b58cdfb25fdbcd293d16778e762c2a))
38
+
39
+
40
+ ### Chores
41
+
42
+ * **ci:** skip lint on metadata-only changes ([810ca31](https://github.com/lithic-com/lithic-ruby/commit/810ca31d3deeb0fd04c5843496dc601187076633))
43
+ * **ci:** support opting out of skipping builds on metadata-only commits ([40b20fb](https://github.com/lithic-com/lithic-ruby/commit/40b20fb0c3c2c31e2870ee2df86d4a55fac67a04))
44
+
45
+
46
+ ### Documentation
47
+
48
+ * **api:** update nature_of_business and qr_code_url field descriptions ([b11902d](https://github.com/lithic-com/lithic-ruby/commit/b11902d30b4b337e7ffc05358df51c18e6ea6648))
49
+ * improve examples ([a7a4a69](https://github.com/lithic-com/lithic-ruby/commit/a7a4a69c9c6930cb8fb3b6bfe4b10e32d1a49213))
50
+ * update examples ([985e1f5](https://github.com/lithic-com/lithic-ruby/commit/985e1f5f0e12517dce490224aaf82021875c8101))
51
+
3
52
  ## 0.10.0 (2026-03-23)
4
53
 
5
54
  Full Changelog: [v0.9.0...v0.10.0](https://github.com/lithic-com/lithic-ruby/compare/v0.9.0...v0.10.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.10.0"
27
+ gem "lithic", "~> 0.12.0"
28
28
  ```
29
29
 
30
30
  <!-- x-release-please-end -->
@@ -157,7 +157,7 @@ module Lithic
157
157
  in Hash | nil => coerced
158
158
  coerced
159
159
  else
160
- message = "Expected a #{Hash} or #{Lithic::Internal::Type::BaseModel}, got #{data.inspect}"
160
+ message = "Expected a #{Hash} or #{Lithic::Internal::Type::BaseModel}, got #{input.inspect}"
161
161
  raise ArgumentError.new(message)
162
162
  end
163
163
  end
@@ -237,6 +237,11 @@ module Lithic
237
237
  end
238
238
  end
239
239
 
240
+ # @type [Regexp]
241
+ #
242
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
243
+ RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/
244
+
240
245
  class << self
241
246
  # @api private
242
247
  #
@@ -247,6 +252,15 @@ module Lithic
247
252
  "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
248
253
  end
249
254
 
255
+ # @api private
256
+ #
257
+ # @param path [String, Integer]
258
+ #
259
+ # @return [String]
260
+ def encode_path(path)
261
+ path.to_s.gsub(Lithic::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
262
+ end
263
+
250
264
  # @api private
251
265
  #
252
266
  # @param path [String, Array<String>]
@@ -259,7 +273,7 @@ module Lithic
259
273
  in []
260
274
  ""
261
275
  in [String => p, *interpolations]
262
- encoded = interpolations.map { ERB::Util.url_encode(_1) }
276
+ encoded = interpolations.map { encode_path(_1) }
263
277
  format(p, *encoded)
264
278
  end
265
279
  end
@@ -571,16 +585,15 @@ module Lithic
571
585
  y << "Content-Disposition: form-data"
572
586
 
573
587
  unless key.nil?
574
- name = ERB::Util.url_encode(key.to_s)
575
- y << "; name=\"#{name}\""
588
+ y << "; name=\"#{key}\""
576
589
  end
577
590
 
578
591
  case val
579
592
  in Lithic::FilePart unless val.filename.nil?
580
- filename = ERB::Util.url_encode(val.filename)
593
+ filename = encode_path(val.filename)
581
594
  y << "; filename=\"#{filename}\""
582
595
  in Pathname | IO
583
- filename = ERB::Util.url_encode(::File.basename(val.to_path))
596
+ filename = encode_path(::File.basename(val.to_path))
584
597
  y << "; filename=\"#{filename}\""
585
598
  else
586
599
  end
@@ -597,6 +610,7 @@ module Lithic
597
610
  #
598
611
  # @return [Array(String, Enumerable<String>)]
599
612
  private def encode_multipart_streaming(body)
613
+ # rubocop:disable Style/CaseEquality
600
614
  # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
601
615
  boundary = SecureRandom.urlsafe_base64(46)
602
616
 
@@ -606,7 +620,7 @@ module Lithic
606
620
  in Hash
607
621
  body.each do |key, val|
608
622
  case val
609
- in Array if val.all? { primitive?(_1) }
623
+ in Array if val.all? { primitive?(_1) || Lithic::Internal::Type::FileInput === _1 }
610
624
  val.each do |v|
611
625
  write_multipart_chunk(y, boundary: boundary, key: key, val: v, closing: closing)
612
626
  end
@@ -622,6 +636,7 @@ module Lithic
622
636
 
623
637
  fused_io = fused_enum(strio) { closing.each(&:call) }
624
638
  [boundary, fused_io]
639
+ # rubocop:enable Style/CaseEquality
625
640
  end
626
641
 
627
642
  # @api private
@@ -77,12 +77,20 @@ module Lithic
77
77
  # @return [Time, nil]
78
78
  optional :timestamp, Time
79
79
 
80
- # @!method initialize(decision: nil, event_token: nil, timestamp: nil)
80
+ # @!attribute transaction_token
81
+ # The token of the transaction associated with the event
82
+ #
83
+ # @return [String, nil]
84
+ optional :transaction_token, String, nil?: true
85
+
86
+ # @!method initialize(decision: nil, event_token: nil, timestamp: nil, transaction_token: nil)
81
87
  # @param decision [Symbol, Lithic::Models::AuthRules::BacktestStats::Example::Decision] The decision made by the rule for this event.
82
88
  #
83
89
  # @param event_token [String] The event token.
84
90
  #
85
91
  # @param timestamp [Time] The timestamp of the event.
92
+ #
93
+ # @param transaction_token [String, nil] The token of the transaction associated with the event
86
94
 
87
95
  # The decision made by the rule for this event.
88
96
  #
@@ -75,6 +75,12 @@ module Lithic
75
75
  # trailing hour up and until the authorization.
76
76
  # - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the
77
77
  # trailing 24 hours up and until the authorization.
78
+ # - `CARD_DECLINE_COUNT_15M`: The number of declined transactions on the card in
79
+ # the trailing 15 minutes before the authorization.
80
+ # - `CARD_DECLINE_COUNT_1H`: The number of declined transactions on the card in
81
+ # the trailing hour up and until the authorization.
82
+ # - `CARD_DECLINE_COUNT_24H`: The number of declined transactions on the card in
83
+ # the trailing 24 hours up and until the authorization.
78
84
  # - `CARD_STATE`: The current state of the card associated with the transaction.
79
85
  # Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`,
80
86
  # `PENDING_FULFILLMENT`.
@@ -101,6 +107,33 @@ module Lithic
101
107
  # - `CARD_AGE`: The age of the card in seconds at the time of the authorization.
102
108
  # - `ACCOUNT_AGE`: The age of the account holder's account in seconds at the time
103
109
  # of the authorization.
110
+ # - `AMOUNT_Z_SCORE`: The z-score of the transaction amount relative to the
111
+ # entity's transaction history. Null if fewer than 30 approved transactions in
112
+ # the specified window. Requires `parameters.scope` and `parameters.interval`.
113
+ # - `AVG_TRANSACTION_AMOUNT`: The average approved transaction amount for the
114
+ # entity over the specified window, in cents. Requires `parameters.scope` and
115
+ # `parameters.interval`.
116
+ # - `STDEV_TRANSACTION_AMOUNT`: The standard deviation of approved transaction
117
+ # amounts for the entity over the specified window, in cents. Null if fewer than
118
+ # 30 approved transactions in the specified window. Requires `parameters.scope`
119
+ # and `parameters.interval`.
120
+ # - `IS_NEW_COUNTRY`: Whether the transaction's merchant country has not been seen
121
+ # in the entity's transaction history. Valid values are `TRUE`, `FALSE`.
122
+ # Requires `parameters.scope`.
123
+ # - `IS_NEW_MCC`: Whether the transaction's MCC has not been seen in the entity's
124
+ # transaction history. Valid values are `TRUE`, `FALSE`. Requires
125
+ # `parameters.scope`.
126
+ # - `IS_FIRST_TRANSACTION`: Whether this is the first transaction for the entity.
127
+ # Valid values are `TRUE`, `FALSE`. Requires `parameters.scope`.
128
+ # - `CONSECUTIVE_DECLINES`: The number of consecutive declined transactions for
129
+ # the entity over the last 30 days (rolling). Requires `parameters.scope`. Not
130
+ # supported for `BUSINESS_ACCOUNT` scope.
131
+ # - `TIME_SINCE_LAST_TRANSACTION`: The number of days since the last approved
132
+ # transaction for the entity. Requires `parameters.scope`.
133
+ # - `DISTINCT_COUNTRY_COUNT`: The number of distinct merchant countries seen in
134
+ # the entity's transaction history. Requires `parameters.scope`.
135
+ # - `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
136
+ # a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
104
137
  #
105
138
  # @return [Symbol, Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Attribute]
106
139
  required :attribute,
@@ -118,7 +151,18 @@ module Lithic
118
151
  # @return [String, Integer, Array<String>, Time]
119
152
  required :value, union: -> { Lithic::AuthRules::ConditionalValue }
120
153
 
121
- # @!method initialize(attribute:, operation:, value:)
154
+ # @!attribute parameters
155
+ # Additional parameters required for transaction history signal attributes.
156
+ # Required when `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
157
+ # `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
158
+ # `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
159
+ # or `DISTINCT_COUNTRY_COUNT`. Not used for other attributes.
160
+ #
161
+ # @return [Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters, nil]
162
+ optional :parameters,
163
+ -> { Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters }
164
+
165
+ # @!method initialize(attribute:, operation:, value:, parameters: nil)
122
166
  # Some parameter documentations has been truncated, see
123
167
  # {Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition}
124
168
  # for more details.
@@ -128,6 +172,8 @@ module Lithic
128
172
  # @param operation [Symbol, Lithic::Models::AuthRules::ConditionalOperation] The operation to apply to the attribute
129
173
  #
130
174
  # @param value [String, Integer, Array<String>, Time] A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
175
+ #
176
+ # @param parameters [Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters] Additional parameters required for transaction history signal attributes. Requir
131
177
 
132
178
  # The attribute to target.
133
179
  #
@@ -168,6 +214,12 @@ module Lithic
168
214
  # trailing hour up and until the authorization.
169
215
  # - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the
170
216
  # trailing 24 hours up and until the authorization.
217
+ # - `CARD_DECLINE_COUNT_15M`: The number of declined transactions on the card in
218
+ # the trailing 15 minutes before the authorization.
219
+ # - `CARD_DECLINE_COUNT_1H`: The number of declined transactions on the card in
220
+ # the trailing hour up and until the authorization.
221
+ # - `CARD_DECLINE_COUNT_24H`: The number of declined transactions on the card in
222
+ # the trailing 24 hours up and until the authorization.
171
223
  # - `CARD_STATE`: The current state of the card associated with the transaction.
172
224
  # Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`,
173
225
  # `PENDING_FULFILLMENT`.
@@ -194,6 +246,33 @@ module Lithic
194
246
  # - `CARD_AGE`: The age of the card in seconds at the time of the authorization.
195
247
  # - `ACCOUNT_AGE`: The age of the account holder's account in seconds at the time
196
248
  # of the authorization.
249
+ # - `AMOUNT_Z_SCORE`: The z-score of the transaction amount relative to the
250
+ # entity's transaction history. Null if fewer than 30 approved transactions in
251
+ # the specified window. Requires `parameters.scope` and `parameters.interval`.
252
+ # - `AVG_TRANSACTION_AMOUNT`: The average approved transaction amount for the
253
+ # entity over the specified window, in cents. Requires `parameters.scope` and
254
+ # `parameters.interval`.
255
+ # - `STDEV_TRANSACTION_AMOUNT`: The standard deviation of approved transaction
256
+ # amounts for the entity over the specified window, in cents. Null if fewer than
257
+ # 30 approved transactions in the specified window. Requires `parameters.scope`
258
+ # and `parameters.interval`.
259
+ # - `IS_NEW_COUNTRY`: Whether the transaction's merchant country has not been seen
260
+ # in the entity's transaction history. Valid values are `TRUE`, `FALSE`.
261
+ # Requires `parameters.scope`.
262
+ # - `IS_NEW_MCC`: Whether the transaction's MCC has not been seen in the entity's
263
+ # transaction history. Valid values are `TRUE`, `FALSE`. Requires
264
+ # `parameters.scope`.
265
+ # - `IS_FIRST_TRANSACTION`: Whether this is the first transaction for the entity.
266
+ # Valid values are `TRUE`, `FALSE`. Requires `parameters.scope`.
267
+ # - `CONSECUTIVE_DECLINES`: The number of consecutive declined transactions for
268
+ # the entity over the last 30 days (rolling). Requires `parameters.scope`. Not
269
+ # supported for `BUSINESS_ACCOUNT` scope.
270
+ # - `TIME_SINCE_LAST_TRANSACTION`: The number of days since the last approved
271
+ # transaction for the entity. Requires `parameters.scope`.
272
+ # - `DISTINCT_COUNTRY_COUNT`: The number of distinct merchant countries seen in
273
+ # the entity's transaction history. Requires `parameters.scope`.
274
+ # - `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
275
+ # a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
197
276
  #
198
277
  # @see Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition#attribute
199
278
  module Attribute
@@ -212,6 +291,9 @@ module Lithic
212
291
  CARD_TRANSACTION_COUNT_15_M = :CARD_TRANSACTION_COUNT_15M
213
292
  CARD_TRANSACTION_COUNT_1_H = :CARD_TRANSACTION_COUNT_1H
214
293
  CARD_TRANSACTION_COUNT_24_H = :CARD_TRANSACTION_COUNT_24H
294
+ CARD_DECLINE_COUNT_15_M = :CARD_DECLINE_COUNT_15M
295
+ CARD_DECLINE_COUNT_1_H = :CARD_DECLINE_COUNT_1H
296
+ CARD_DECLINE_COUNT_24_H = :CARD_DECLINE_COUNT_24H
215
297
  CARD_STATE = :CARD_STATE
216
298
  PIN_ENTERED = :PIN_ENTERED
217
299
  PIN_STATUS = :PIN_STATUS
@@ -222,10 +304,85 @@ module Lithic
222
304
  SERVICE_LOCATION_POSTAL_CODE = :SERVICE_LOCATION_POSTAL_CODE
223
305
  CARD_AGE = :CARD_AGE
224
306
  ACCOUNT_AGE = :ACCOUNT_AGE
307
+ AMOUNT_Z_SCORE = :AMOUNT_Z_SCORE
308
+ AVG_TRANSACTION_AMOUNT = :AVG_TRANSACTION_AMOUNT
309
+ STDEV_TRANSACTION_AMOUNT = :STDEV_TRANSACTION_AMOUNT
310
+ IS_NEW_COUNTRY = :IS_NEW_COUNTRY
311
+ IS_NEW_MCC = :IS_NEW_MCC
312
+ IS_FIRST_TRANSACTION = :IS_FIRST_TRANSACTION
313
+ CONSECUTIVE_DECLINES = :CONSECUTIVE_DECLINES
314
+ TIME_SINCE_LAST_TRANSACTION = :TIME_SINCE_LAST_TRANSACTION
315
+ DISTINCT_COUNTRY_COUNT = :DISTINCT_COUNTRY_COUNT
316
+ THREE_DS_SUCCESS_RATE = :THREE_DS_SUCCESS_RATE
225
317
 
226
318
  # @!method self.values
227
319
  # @return [Array<Symbol>]
228
320
  end
321
+
322
+ # @see Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition#parameters
323
+ class Parameters < Lithic::Internal::Type::BaseModel
324
+ # @!attribute interval
325
+ # The time window for statistical attributes (`AMOUNT_Z_SCORE`,
326
+ # `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`). Use `LIFETIME` for
327
+ # all-time history or a specific window (`7D`, `30D`, `90D`).
328
+ #
329
+ # @return [Symbol, Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Interval, nil]
330
+ optional :interval,
331
+ enum: -> { Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Interval }
332
+
333
+ # @!attribute scope
334
+ # The entity scope to evaluate the attribute against.
335
+ #
336
+ # @return [Symbol, Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Scope, nil]
337
+ optional :scope,
338
+ enum: -> { Lithic::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Scope }
339
+
340
+ # @!method initialize(interval: nil, scope: nil)
341
+ # Some parameter documentations has been truncated, see
342
+ # {Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters}
343
+ # for more details.
344
+ #
345
+ # Additional parameters required for transaction history signal attributes.
346
+ # Required when `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
347
+ # `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
348
+ # `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
349
+ # or `DISTINCT_COUNTRY_COUNT`. Not used for other attributes.
350
+ #
351
+ # @param interval [Symbol, Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Interval] The time window for statistical attributes (`AMOUNT_Z_SCORE`, `AVG_TRANSACTION_A
352
+ #
353
+ # @param scope [Symbol, Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters::Scope] The entity scope to evaluate the attribute against.
354
+
355
+ # The time window for statistical attributes (`AMOUNT_Z_SCORE`,
356
+ # `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`). Use `LIFETIME` for
357
+ # all-time history or a specific window (`7D`, `30D`, `90D`).
358
+ #
359
+ # @see Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters#interval
360
+ module Interval
361
+ extend Lithic::Internal::Type::Enum
362
+
363
+ LIFETIME = :LIFETIME
364
+ INTERVAL_7_D = :"7D"
365
+ INTERVAL_30_D = :"30D"
366
+ INTERVAL_90_D = :"90D"
367
+
368
+ # @!method self.values
369
+ # @return [Array<Symbol>]
370
+ end
371
+
372
+ # The entity scope to evaluate the attribute against.
373
+ #
374
+ # @see Lithic::Models::AuthRules::ConditionalAuthorizationActionParameters::Condition::Parameters#scope
375
+ module Scope
376
+ extend Lithic::Internal::Type::Enum
377
+
378
+ CARD = :CARD
379
+ ACCOUNT = :ACCOUNT
380
+ BUSINESS_ACCOUNT = :BUSINESS_ACCOUNT
381
+
382
+ # @!method self.values
383
+ # @return [Array<Symbol>]
384
+ end
385
+ end
229
386
  end
230
387
  end
231
388
  end
@@ -6,110 +6,77 @@ module Lithic
6
6
  class ReportStats < Lithic::Internal::Type::BaseModel
7
7
  # @!attribute action_counts
8
8
  # A mapping of action types to the number of times that action was returned by
9
- # this rule during the relevant period. Actions are the possible outcomes of a
9
+ # this version during the relevant period. Actions are the possible outcomes of a
10
10
  # rule evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule
11
11
  # didn't trigger any action, it's counted under NO_ACTION key.
12
12
  #
13
- # @return [Hash{Symbol=>Integer}, nil]
14
- optional :action_counts, Lithic::Internal::Type::HashOf[Integer]
13
+ # @return [Hash{Symbol=>Integer}]
14
+ required :action_counts, Lithic::Internal::Type::HashOf[Integer]
15
15
 
16
- # @!attribute approved
17
- # @deprecated
18
- #
19
- # The total number of historical transactions approved by this rule during the
20
- # relevant period, or the number of transactions that would have been approved if
21
- # the rule was evaluated in shadow mode.
22
- #
23
- # @return [Integer, nil]
24
- optional :approved, Integer
25
-
26
- # @!attribute challenged
27
- # @deprecated
28
- #
29
- # The total number of historical transactions challenged by this rule during the
30
- # relevant period, or the number of transactions that would have been challenged
31
- # if the rule was evaluated in shadow mode. Currently applicable only for 3DS Auth
32
- # Rules.
16
+ # @!attribute examples
17
+ # Example events and their outcomes for this version.
33
18
  #
34
- # @return [Integer, nil]
35
- optional :challenged, Integer
19
+ # @return [Array<Lithic::Models::AuthRules::ReportStats::Example>]
20
+ required :examples, -> { Lithic::Internal::Type::ArrayOf[Lithic::AuthRules::ReportStats::Example] }
36
21
 
37
- # @!attribute declined
38
- # @deprecated
39
- #
40
- # The total number of historical transactions declined by this rule during the
41
- # relevant period, or the number of transactions that would have been declined if
42
- # the rule was evaluated in shadow mode.
22
+ # @!attribute state
23
+ # The evaluation mode of this version during the reported period.
43
24
  #
44
- # @return [Integer, nil]
45
- optional :declined, Integer
25
+ # @return [Symbol, Lithic::Models::AuthRules::ReportStats::State]
26
+ required :state, enum: -> { Lithic::AuthRules::ReportStats::State }
46
27
 
47
- # @!attribute examples
48
- # Example events and their outcomes.
28
+ # @!attribute version
29
+ # The rule version number.
49
30
  #
50
- # @return [Array<Lithic::Models::AuthRules::ReportStats::Example>, nil]
51
- optional :examples, -> { Lithic::Internal::Type::ArrayOf[Lithic::AuthRules::ReportStats::Example] }
31
+ # @return [Integer]
32
+ required :version, Integer
52
33
 
53
- # @!method initialize(action_counts: nil, approved: nil, challenged: nil, declined: nil, examples: nil)
34
+ # @!method initialize(action_counts:, examples:, state:, version:)
54
35
  # Some parameter documentations has been truncated, see
55
36
  # {Lithic::Models::AuthRules::ReportStats} for more details.
56
37
  #
57
38
  # @param action_counts [Hash{Symbol=>Integer}] A mapping of action types to the number of times that action was returned by thi
58
39
  #
59
- # @param approved [Integer] The total number of historical transactions approved by this rule during the rel
60
- #
61
- # @param challenged [Integer] The total number of historical transactions challenged by this rule during the r
40
+ # @param examples [Array<Lithic::Models::AuthRules::ReportStats::Example>] Example events and their outcomes for this version.
62
41
  #
63
- # @param declined [Integer] The total number of historical transactions declined by this rule during the rel
42
+ # @param state [Symbol, Lithic::Models::AuthRules::ReportStats::State] The evaluation mode of this version during the reported period.
64
43
  #
65
- # @param examples [Array<Lithic::Models::AuthRules::ReportStats::Example>] Example events and their outcomes.
44
+ # @param version [Integer] The rule version number.
66
45
 
67
46
  class Example < Lithic::Internal::Type::BaseModel
68
47
  # @!attribute actions
69
- # The actions taken by the rule for this event.
48
+ # The actions taken by this version for this event.
70
49
  #
71
- # @return [Array<Lithic::Models::AuthRules::ReportStats::Example::Action::DeclineActionAuthorization, Lithic::Models::AuthRules::ReportStats::Example::Action::ChallengeActionAuthorization, Lithic::Models::AuthRules::ReportStats::Example::Action::ResultAuthentication3DSAction, Lithic::Models::AuthRules::ReportStats::Example::Action::DeclineActionTokenization, Lithic::Models::AuthRules::ReportStats::Example::Action::RequireTfaAction, Lithic::Models::AuthRules::ReportStats::Example::Action::ApproveActionACH, Lithic::Models::AuthRules::ReportStats::Example::Action::ReturnAction>, nil]
72
- optional :actions,
50
+ # @return [Array<Lithic::Models::AuthRules::ReportStats::Example::Action::DeclineActionAuthorization, Lithic::Models::AuthRules::ReportStats::Example::Action::ChallengeActionAuthorization, Lithic::Models::AuthRules::ReportStats::Example::Action::ResultAuthentication3DSAction, Lithic::Models::AuthRules::ReportStats::Example::Action::DeclineActionTokenization, Lithic::Models::AuthRules::ReportStats::Example::Action::RequireTfaAction, Lithic::Models::AuthRules::ReportStats::Example::Action::ApproveActionACH, Lithic::Models::AuthRules::ReportStats::Example::Action::ReturnAction>]
51
+ required :actions,
73
52
  -> { Lithic::Internal::Type::ArrayOf[union: Lithic::AuthRules::ReportStats::Example::Action] }
74
53
 
75
- # @!attribute approved
76
- # @deprecated
77
- #
78
- # Whether the rule would have approved the request.
79
- #
80
- # @return [Boolean, nil]
81
- optional :approved, Lithic::Internal::Type::Boolean
82
-
83
- # @!attribute decision
84
- # @deprecated
85
- #
86
- # The decision made by the rule for this event.
87
- #
88
- # @return [Symbol, Lithic::Models::AuthRules::ReportStats::Example::Decision, nil]
89
- optional :decision, enum: -> { Lithic::AuthRules::ReportStats::Example::Decision }
90
-
91
54
  # @!attribute event_token
92
55
  # The event token.
93
56
  #
94
- # @return [String, nil]
95
- optional :event_token, String
57
+ # @return [String]
58
+ required :event_token, String
96
59
 
97
60
  # @!attribute timestamp
98
61
  # The timestamp of the event.
99
62
  #
100
- # @return [Time, nil]
101
- optional :timestamp, Time
63
+ # @return [Time]
64
+ required :timestamp, Time
102
65
 
103
- # @!method initialize(actions: nil, approved: nil, decision: nil, event_token: nil, timestamp: nil)
104
- # @param actions [Array<Lithic::Models::AuthRules::ReportStats::Example::Action::DeclineActionAuthorization, Lithic::Models::AuthRules::ReportStats::Example::Action::ChallengeActionAuthorization, Lithic::Models::AuthRules::ReportStats::Example::Action::ResultAuthentication3DSAction, Lithic::Models::AuthRules::ReportStats::Example::Action::DeclineActionTokenization, Lithic::Models::AuthRules::ReportStats::Example::Action::RequireTfaAction, Lithic::Models::AuthRules::ReportStats::Example::Action::ApproveActionACH, Lithic::Models::AuthRules::ReportStats::Example::Action::ReturnAction>] The actions taken by the rule for this event.
66
+ # @!attribute transaction_token
67
+ # The token of the transaction associated with the event
105
68
  #
106
- # @param approved [Boolean] Whether the rule would have approved the request.
107
- #
108
- # @param decision [Symbol, Lithic::Models::AuthRules::ReportStats::Example::Decision] The decision made by the rule for this event.
69
+ # @return [String, nil]
70
+ optional :transaction_token, String, nil?: true
71
+
72
+ # @!method initialize(actions:, event_token:, timestamp:, transaction_token: nil)
73
+ # @param actions [Array<Lithic::Models::AuthRules::ReportStats::Example::Action::DeclineActionAuthorization, Lithic::Models::AuthRules::ReportStats::Example::Action::ChallengeActionAuthorization, Lithic::Models::AuthRules::ReportStats::Example::Action::ResultAuthentication3DSAction, Lithic::Models::AuthRules::ReportStats::Example::Action::DeclineActionTokenization, Lithic::Models::AuthRules::ReportStats::Example::Action::RequireTfaAction, Lithic::Models::AuthRules::ReportStats::Example::Action::ApproveActionACH, Lithic::Models::AuthRules::ReportStats::Example::Action::ReturnAction>] The actions taken by this version for this event.
109
74
  #
110
75
  # @param event_token [String] The event token.
111
76
  #
112
77
  # @param timestamp [Time] The timestamp of the event.
78
+ #
79
+ # @param transaction_token [String, nil] The token of the transaction associated with the event
113
80
 
114
81
  module Action
115
82
  extend Lithic::Internal::Type::Union
@@ -529,22 +496,20 @@ module Lithic
529
496
  # @!method self.variants
530
497
  # @return [Array(Lithic::Models::AuthRules::ReportStats::Example::Action::DeclineActionAuthorization, Lithic::Models::AuthRules::ReportStats::Example::Action::ChallengeActionAuthorization, Lithic::Models::AuthRules::ReportStats::Example::Action::ResultAuthentication3DSAction, Lithic::Models::AuthRules::ReportStats::Example::Action::DeclineActionTokenization, Lithic::Models::AuthRules::ReportStats::Example::Action::RequireTfaAction, Lithic::Models::AuthRules::ReportStats::Example::Action::ApproveActionACH, Lithic::Models::AuthRules::ReportStats::Example::Action::ReturnAction)]
531
498
  end
499
+ end
532
500
 
533
- # @deprecated
534
- #
535
- # The decision made by the rule for this event.
536
- #
537
- # @see Lithic::Models::AuthRules::ReportStats::Example#decision
538
- module Decision
539
- extend Lithic::Internal::Type::Enum
501
+ # The evaluation mode of this version during the reported period.
502
+ #
503
+ # @see Lithic::Models::AuthRules::ReportStats#state
504
+ module State
505
+ extend Lithic::Internal::Type::Enum
540
506
 
541
- APPROVED = :APPROVED
542
- DECLINED = :DECLINED
543
- CHALLENGED = :CHALLENGED
507
+ ACTIVE = :ACTIVE
508
+ SHADOW = :SHADOW
509
+ INACTIVE = :INACTIVE
544
510
 
545
- # @!method self.values
546
- # @return [Array<Symbol>]
547
- end
511
+ # @!method self.values
512
+ # @return [Array<Symbol>]
548
513
  end
549
514
  end
550
515
  end