|
| 1 | +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +from typing import List, Optional |
| 4 | +from typing_extensions import Literal |
| 5 | + |
| 6 | +from ..._models import BaseModel |
| 7 | +from .conditional_value import ConditionalValue |
| 8 | +from .conditional_operation import ConditionalOperation |
| 9 | + |
| 10 | +__all__ = ["ConditionalAuthorizationAdjustmentParameters", "Adjustment", "Condition", "ConditionParameters"] |
| 11 | + |
| 12 | + |
| 13 | +class Adjustment(BaseModel): |
| 14 | + """The hold adjustment to apply if the conditions are met""" |
| 15 | + |
| 16 | + mode: Literal["REPLACE_WITH_AMOUNT", "ADD_PERCENTAGE", "ADD_AMOUNT"] |
| 17 | + """The mode of the hold adjustment, determining how the value is interpreted: |
| 18 | +
|
| 19 | + - `REPLACE_WITH_AMOUNT`: The value is the approved hold amount in cents. |
| 20 | + - `ADD_PERCENTAGE`: The value adjusts the hold amount by a percentage. 1000 |
| 21 | + represents a 10% increase, 0 represents no change. |
| 22 | + - `ADD_AMOUNT`: The value is added to the hold amount in cents. |
| 23 | + """ |
| 24 | + |
| 25 | + type: Literal["HOLD_ADJUSTMENT"] |
| 26 | + """The type of adjustment to apply""" |
| 27 | + |
| 28 | + value: int |
| 29 | + """The value used for the hold adjustment, interpreted based on the mode""" |
| 30 | + |
| 31 | + |
| 32 | +class ConditionParameters(BaseModel): |
| 33 | + """Additional parameters for certain attributes. |
| 34 | +
|
| 35 | + Required when `attribute` is one of |
| 36 | + `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`, |
| 37 | + `IS_NEW_COUNTRY`, `IS_NEW_MCC`, `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, |
| 38 | + `TIME_SINCE_LAST_TRANSACTION`, or `DISTINCT_COUNTRY_COUNT` (require `scope`); |
| 39 | + or `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION` (require `unit`). |
| 40 | + Not used for other attributes. |
| 41 | + """ |
| 42 | + |
| 43 | + interval: Optional[Literal["LIFETIME", "7D", "30D", "90D"]] = None |
| 44 | + """ |
| 45 | + The time window for statistical attributes (`AMOUNT_Z_SCORE`, |
| 46 | + `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`). Use `LIFETIME` for |
| 47 | + all-time history or a specific window (`7D`, `30D`, `90D`). |
| 48 | + """ |
| 49 | + |
| 50 | + scope: Optional[Literal["CARD", "ACCOUNT", "BUSINESS_ACCOUNT"]] = None |
| 51 | + """The entity scope to evaluate the attribute against.""" |
| 52 | + |
| 53 | + unit: Optional[Literal["MPH", "KPH", "MILES", "KILOMETERS"]] = None |
| 54 | + """The unit for impossible travel attributes. |
| 55 | +
|
| 56 | + Required when `attribute` is `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION`. |
| 57 | +
|
| 58 | + For `TRAVEL_SPEED`: `MPH` (miles per hour) or `KPH` (kilometers per hour). |
| 59 | +
|
| 60 | + For `DISTANCE_FROM_LAST_TRANSACTION`: `MILES` or `KILOMETERS`. |
| 61 | + """ |
| 62 | + |
| 63 | + |
| 64 | +class Condition(BaseModel): |
| 65 | + attribute: Literal[ |
| 66 | + "MCC", |
| 67 | + "COUNTRY", |
| 68 | + "CURRENCY", |
| 69 | + "MERCHANT_ID", |
| 70 | + "DESCRIPTOR", |
| 71 | + "LIABILITY_SHIFT", |
| 72 | + "PAN_ENTRY_MODE", |
| 73 | + "TRANSACTION_AMOUNT", |
| 74 | + "CASH_AMOUNT", |
| 75 | + "RISK_SCORE", |
| 76 | + "CARD_TRANSACTION_COUNT_15M", |
| 77 | + "CARD_TRANSACTION_COUNT_1H", |
| 78 | + "CARD_TRANSACTION_COUNT_24H", |
| 79 | + "CARD_DECLINE_COUNT_15M", |
| 80 | + "CARD_DECLINE_COUNT_1H", |
| 81 | + "CARD_DECLINE_COUNT_24H", |
| 82 | + "CARD_STATE", |
| 83 | + "PIN_ENTERED", |
| 84 | + "PIN_STATUS", |
| 85 | + "WALLET_TYPE", |
| 86 | + "TRANSACTION_INITIATOR", |
| 87 | + "ADDRESS_MATCH", |
| 88 | + "SERVICE_LOCATION_STATE", |
| 89 | + "SERVICE_LOCATION_POSTAL_CODE", |
| 90 | + "CARD_AGE", |
| 91 | + "ACCOUNT_AGE", |
| 92 | + "AMOUNT_Z_SCORE", |
| 93 | + "AVG_TRANSACTION_AMOUNT", |
| 94 | + "STDEV_TRANSACTION_AMOUNT", |
| 95 | + "IS_NEW_COUNTRY", |
| 96 | + "IS_NEW_MCC", |
| 97 | + "IS_FIRST_TRANSACTION", |
| 98 | + "CONSECUTIVE_DECLINES", |
| 99 | + "TIME_SINCE_LAST_TRANSACTION", |
| 100 | + "DISTINCT_COUNTRY_COUNT", |
| 101 | + "IS_NEW_MERCHANT", |
| 102 | + "THREE_DS_SUCCESS_RATE", |
| 103 | + "TRAVEL_SPEED", |
| 104 | + "DISTANCE_FROM_LAST_TRANSACTION", |
| 105 | + ] |
| 106 | + """The attribute to target. |
| 107 | +
|
| 108 | + The following attributes may be targeted: |
| 109 | +
|
| 110 | + - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a |
| 111 | + business by the types of goods or services it provides. |
| 112 | + - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all |
| 113 | + ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for |
| 114 | + Netherlands Antilles. |
| 115 | + - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of |
| 116 | + the transaction. |
| 117 | + - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor |
| 118 | + (merchant). |
| 119 | + - `DESCRIPTOR`: Short description of card acceptor. |
| 120 | + - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer |
| 121 | + applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or |
| 122 | + `TOKEN_AUTHENTICATED`. |
| 123 | + - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number |
| 124 | + (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, |
| 125 | + `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, |
| 126 | + `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, |
| 127 | + `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. |
| 128 | + - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer |
| 129 | + fee field in the settlement/cardholder billing currency. This is the amount |
| 130 | + the issuer should authorize against unless the issuer is paying the acquirer |
| 131 | + fee on behalf of the cardholder. Use an integer value. |
| 132 | + - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This |
| 133 | + represents the amount of cash being withdrawn or advanced. Use an integer |
| 134 | + value. |
| 135 | + - `RISK_SCORE`: Network-provided score assessing risk level associated with a |
| 136 | + given authorization. Scores are on a range of 0-999, with 0 representing the |
| 137 | + lowest risk and 999 representing the highest risk. For Visa transactions, |
| 138 | + where the raw score has a range of 0-99, Lithic will normalize the score by |
| 139 | + multiplying the raw score by 10x. Use an integer value. |
| 140 | + - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the |
| 141 | + trailing 15 minutes before the authorization. Use an integer value. |
| 142 | + - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the |
| 143 | + trailing hour up and until the authorization. Use an integer value. |
| 144 | + - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the |
| 145 | + trailing 24 hours up and until the authorization. Use an integer value. |
| 146 | + - `CARD_DECLINE_COUNT_15M`: The number of declined transactions on the card in |
| 147 | + the trailing 15 minutes before the authorization. Use an integer value. |
| 148 | + - `CARD_DECLINE_COUNT_1H`: The number of declined transactions on the card in |
| 149 | + the trailing hour up and until the authorization. Use an integer value. |
| 150 | + - `CARD_DECLINE_COUNT_24H`: The number of declined transactions on the card in |
| 151 | + the trailing 24 hours up and until the authorization. Use an integer value. |
| 152 | + - `CARD_STATE`: The current state of the card associated with the transaction. |
| 153 | + Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, |
| 154 | + `PENDING_FULFILLMENT`. |
| 155 | + - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. |
| 156 | + Valid values are `TRUE`, `FALSE`. |
| 157 | + - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, |
| 158 | + `OK`, `BLOCKED`. |
| 159 | + - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the |
| 160 | + source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, |
| 161 | + `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. |
| 162 | + - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates |
| 163 | + the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. |
| 164 | + - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address |
| 165 | + data with the cardholder KYC data if it exists. Valid values are `MATCH`, |
| 166 | + `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. |
| 167 | + - `SERVICE_LOCATION_STATE`: The state/province code (ISO 3166-2) where the |
| 168 | + cardholder received the service, e.g. "NY". When a service location is present |
| 169 | + in the network data, the service location state is used. Otherwise, falls back |
| 170 | + to the card acceptor state. |
| 171 | + - `SERVICE_LOCATION_POSTAL_CODE`: The postal code where the cardholder received |
| 172 | + the service, e.g. "10001". When a service location is present in the network |
| 173 | + data, the service location postal code is used. Otherwise, falls back to the |
| 174 | + card acceptor postal code. |
| 175 | + - `CARD_AGE`: The age of the card in seconds at the time of the authorization. |
| 176 | + Use an integer value. |
| 177 | + - `ACCOUNT_AGE`: The age of the account holder's account in seconds at the time |
| 178 | + of the authorization. Use an integer value. For programs where Lithic does not |
| 179 | + manage or retain account holder data, this attribute does not evaluate. |
| 180 | + - `AMOUNT_Z_SCORE`: The z-score of the transaction amount relative to the |
| 181 | + entity's transaction history. Null if fewer than 30 approved transactions in |
| 182 | + the specified window. Requires `parameters.scope` and `parameters.interval`. |
| 183 | + Use a decimal value. |
| 184 | + - `AVG_TRANSACTION_AMOUNT`: The average approved transaction amount for the |
| 185 | + entity over the specified window, in cents. Requires `parameters.scope` and |
| 186 | + `parameters.interval`. Use a decimal value. |
| 187 | + - `STDEV_TRANSACTION_AMOUNT`: The standard deviation of approved transaction |
| 188 | + amounts for the entity over the specified window, in cents. Null if fewer than |
| 189 | + 30 approved transactions in the specified window. Requires `parameters.scope` |
| 190 | + and `parameters.interval`. Use a decimal value. |
| 191 | + - `IS_NEW_COUNTRY`: Whether the transaction's merchant country has not been seen |
| 192 | + in the entity's transaction history. Valid values are `TRUE`, `FALSE`. |
| 193 | + Requires `parameters.scope`. |
| 194 | + - `IS_NEW_MCC`: Whether the transaction's MCC has not been seen in the entity's |
| 195 | + transaction history. Valid values are `TRUE`, `FALSE`. Requires |
| 196 | + `parameters.scope`. |
| 197 | + - `IS_FIRST_TRANSACTION`: Whether this is the first transaction for the entity. |
| 198 | + Valid values are `TRUE`, `FALSE`. Requires `parameters.scope`. |
| 199 | + - `CONSECUTIVE_DECLINES`: The number of consecutive declined transactions for |
| 200 | + the entity over the last 30 days (rolling). Requires `parameters.scope`. Not |
| 201 | + supported for `BUSINESS_ACCOUNT` scope. Use an integer value. |
| 202 | + - `TIME_SINCE_LAST_TRANSACTION`: The number of days since the last approved |
| 203 | + transaction for the entity, rounded to the nearest whole day. Requires |
| 204 | + `parameters.scope`. Use an integer value. |
| 205 | + - `DISTINCT_COUNTRY_COUNT`: The number of distinct merchant countries seen in |
| 206 | + the entity's transaction history. Requires `parameters.scope`. Use an integer |
| 207 | + value. |
| 208 | + - `IS_NEW_MERCHANT`: Whether the card acceptor ID has not been seen in the |
| 209 | + card's approved transaction history (capped at the 1000 most recently seen |
| 210 | + merchants). Valid values are `TRUE`, `FALSE`. Card-scoped only; no |
| 211 | + `parameters` required. |
| 212 | + - `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as |
| 213 | + a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required. |
| 214 | + Use a decimal value. |
| 215 | + - `TRAVEL_SPEED`: The estimated speed of travel derived from the distance |
| 216 | + between the postal code centers of the last card-present transaction and the |
| 217 | + current transaction, divided by the elapsed time. Null if there is no prior |
| 218 | + card-present transaction, if either postal code cannot be geocoded, or if |
| 219 | + elapsed time is zero. Requires `parameters.unit` set to `MPH` or `KPH`. Use a |
| 220 | + decimal value. |
| 221 | + - `DISTANCE_FROM_LAST_TRANSACTION`: The estimated distance between the postal |
| 222 | + code centers of the last card-present transaction and the current transaction. |
| 223 | + Null if there is no prior card-present transaction or if either postal code |
| 224 | + cannot be geocoded. Requires `parameters.unit` set to `MILES` or `KILOMETERS`. |
| 225 | + Use a decimal value. |
| 226 | + """ |
| 227 | + |
| 228 | + operation: ConditionalOperation |
| 229 | + """The operation to apply to the attribute""" |
| 230 | + |
| 231 | + value: ConditionalValue |
| 232 | + """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" |
| 233 | + |
| 234 | + parameters: Optional[ConditionParameters] = None |
| 235 | + """Additional parameters for certain attributes. |
| 236 | +
|
| 237 | + Required when `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`, |
| 238 | + `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`, |
| 239 | + `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`, |
| 240 | + or `DISTINCT_COUNTRY_COUNT` (require `scope`); or `TRAVEL_SPEED` or |
| 241 | + `DISTANCE_FROM_LAST_TRANSACTION` (require `unit`). Not used for other |
| 242 | + attributes. |
| 243 | + """ |
| 244 | + |
| 245 | + |
| 246 | +class ConditionalAuthorizationAdjustmentParameters(BaseModel): |
| 247 | + adjustment: Adjustment |
| 248 | + """The hold adjustment to apply if the conditions are met""" |
| 249 | + |
| 250 | + conditions: List[Condition] |
0 commit comments