From 6436634a1a0ccc9b6ec070c2553bdb45ab656dd6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 21:20:46 +0000 Subject: [PATCH] feat(api): updates to Auth Rules numeric types, new Card Types and Authorization Rule Backtests (#637) - Specifies numeric types on Auth Rules to be integers - adds `replacement_for` field to Card create requests - improvements to documentation - adds Authorization Rules Backtests --- src/lithic/resources/cards/cards.py | 12 +- .../resources/transactions/transactions.py | 192 +++++++++--------- .../types/auth_rules/v2_apply_response.py | 5 +- .../types/auth_rules/v2_create_params.py | 6 +- .../types/auth_rules/v2_create_response.py | 5 +- .../types/auth_rules/v2_draft_params.py | 2 +- .../types/auth_rules/v2_draft_response.py | 5 +- .../types/auth_rules/v2_list_response.py | 5 +- .../types/auth_rules/v2_promote_response.py | 5 +- .../types/auth_rules/v2_retrieve_response.py | 5 +- .../types/auth_rules/v2_update_response.py | 5 +- src/lithic/types/card.py | 12 +- src/lithic/types/card_create_params.py | 6 +- .../types/shared/velocity_limit_params.py | 6 +- .../shared_params/velocity_limit_params.py | 6 +- .../authentication_retrieve_response.py | 6 +- src/lithic/types/transaction.py | 33 +-- ...on_simulate_authorization_advice_params.py | 2 +- ...ansaction_simulate_authorization_params.py | 12 +- .../transaction_simulate_clearing_params.py | 14 +- .../types/transaction_simulate_void_params.py | 3 +- 21 files changed, 196 insertions(+), 151 deletions(-) diff --git a/src/lithic/resources/cards/cards.py b/src/lithic/resources/cards/cards.py index 69f559f0..1139d633 100644 --- a/src/lithic/resources/cards/cards.py +++ b/src/lithic/resources/cards/cards.py @@ -113,7 +113,7 @@ def with_streaming_response(self) -> CardsWithStreamingResponse: def create( self, *, - type: Literal["MERCHANT_LOCKED", "PHYSICAL", "SINGLE_USE", "VIRTUAL"], + type: Literal["MERCHANT_LOCKED", "PHYSICAL", "SINGLE_USE", "VIRTUAL", "UNLOCKED", "DIGITAL_WALLET"], account_token: str | NotGiven = NOT_GIVEN, card_program_token: str | NotGiven = NOT_GIVEN, carrier: Carrier | NotGiven = NOT_GIVEN, @@ -157,6 +157,10 @@ def create( - `SINGLE_USE` - Card is closed upon first successful authorization. - `MERCHANT_LOCKED` - _[Deprecated]_ Card is locked to the first merchant that successfully authorizes the card. + - `UNLOCKED` - _[Deprecated]_ Similar behavior to VIRTUAL cards, please use + VIRTUAL instead. + - `DIGITAL_WALLET` - _[Deprecated]_ Similar behavior to VIRTUAL cards, please + use VIRTUAL instead. account_token: Globally unique identifier for the account that the card will be associated with. Required for programs enrolling users using the @@ -1006,7 +1010,7 @@ def with_streaming_response(self) -> AsyncCardsWithStreamingResponse: async def create( self, *, - type: Literal["MERCHANT_LOCKED", "PHYSICAL", "SINGLE_USE", "VIRTUAL"], + type: Literal["MERCHANT_LOCKED", "PHYSICAL", "SINGLE_USE", "VIRTUAL", "UNLOCKED", "DIGITAL_WALLET"], account_token: str | NotGiven = NOT_GIVEN, card_program_token: str | NotGiven = NOT_GIVEN, carrier: Carrier | NotGiven = NOT_GIVEN, @@ -1050,6 +1054,10 @@ async def create( - `SINGLE_USE` - Card is closed upon first successful authorization. - `MERCHANT_LOCKED` - _[Deprecated]_ Card is locked to the first merchant that successfully authorizes the card. + - `UNLOCKED` - _[Deprecated]_ Similar behavior to VIRTUAL cards, please use + VIRTUAL instead. + - `DIGITAL_WALLET` - _[Deprecated]_ Similar behavior to VIRTUAL cards, please + use VIRTUAL instead. account_token: Globally unique identifier for the account that the card will be associated with. Required for programs enrolling users using the diff --git a/src/lithic/resources/transactions/transactions.py b/src/lithic/resources/transactions/transactions.py index 6e94ec8a..eebb2a7c 100644 --- a/src/lithic/resources/transactions/transactions.py +++ b/src/lithic/resources/transactions/transactions.py @@ -226,19 +226,20 @@ def simulate_authorization( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateAuthorizationResponse: """ - Simulates an authorization request from the payment network as if it came from a - merchant acquirer. If you're configured for ASA, simulating auths requires your - ASA client to be set up properly (respond with a valid JSON to the ASA request). - For users that are not configured for ASA, a daily transaction limit of $5000 - USD is applied by default. This limit can be modified via the + Simulates an authorization request from the card network as if it came from a + merchant acquirer. If you are configured for ASA, simulating authorizations + requires your ASA client to be set up properly, i.e. be able to respond to the + ASA request with a valid JSON. For users that are not configured for ASA, a + daily transaction limit of $5000 USD is applied by default. You can update this + limit via the [update account](https://docs.lithic.com/reference/patchaccountbytoken) endpoint. Args: amount: Amount (in cents) to authorize. For credit authorizations and financial credit authorizations, any value entered will be converted into a negative amount in - the simulated transaction. For example, entering 100 in this field will appear - as a -100 amount in the transaction. For balance inquiries, this field must be + the simulated transaction. For example, entering 100 in this field will result + in a -100 amount in the transaction. For balance inquiries, this field must be set to 0. descriptor: Merchant descriptor. @@ -265,12 +266,12 @@ def simulate_authorization( - `AUTHORIZATION` is a dual message purchase authorization, meaning a subsequent clearing step is required to settle the transaction. - - `BALANCE_INQUIRY` is a $0 authorization that includes a request for the - balance held on the card, and is most typically seen when a cardholder - requests to view a card's balance at an ATM. + - `BALANCE_INQUIRY` is a $0 authorization requesting the balance held on the + card, and is most often observed when a cardholder requests to view a card's + balance at an ATM. - `CREDIT_AUTHORIZATION` is a dual message request from a merchant to authorize - a refund or credit, meaning a subsequent clearing step is required to settle - the transaction. + a refund, meaning a subsequent clearing step is required to settle the + transaction. - `FINANCIAL_AUTHORIZATION` is a single message request from a merchant to debit funds immediately (such as an ATM withdrawal), and no subsequent clearing is required to settle the transaction. @@ -321,12 +322,12 @@ def simulate_authorization_advice( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateAuthorizationAdviceResponse: """ - Simulates an authorization advice request from the payment network as if it came - from a merchant acquirer. An authorization advice request changes the amount of - the transaction. + Simulates an authorization advice from the card network as if it came from a + merchant acquirer. An authorization advice changes the pending amount of the + transaction. Args: - token: The transaction token returned from the /v1/simulate/authorize response. + token: The transaction token returned from the /v1/simulate/authorize. response. amount: Amount (in cents) to authorize. This amount will override the transaction's amount that was originally set by /v1/simulate/authorize. @@ -366,24 +367,27 @@ def simulate_clearing( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateClearingResponse: - """Clears an existing authorization. + """Clears an existing authorization, either debit or credit. - After this event, the transaction is no longer - pending. + After this event, the + transaction transitions from `PENDING` to `SETTLED` status. - If no `amount` is supplied to this endpoint, the amount of the transaction will - be captured. Any transaction that has any amount completed at all do not have - access to this behavior. + If `amount` is not set, the full amount of the transaction will be cleared. + Transactions that have already cleared, either partially or fully, cannot be + cleared again using this endpoint. Args: token: The transaction token returned from the /v1/simulate/authorize response. - amount: Amount (in cents) to complete. Typically this will match the original - authorization, but may be more or less. + amount: Amount (in cents) to clear. Typically this will match the amount in the original + authorization, but can be higher or lower. The sign of this amount will + automatically match the sign of the original authorization's amount. For + example, entering 100 in this field will result in a -100 amount in the + transaction, if the original authorization is a credit authorization. - If no amount is supplied to this endpoint, the amount of the transaction will be - captured. Any transaction that has any amount completed at all do not have - access to this behavior. + If `amount` is not set, the full amount of the transaction will be cleared. + Transactions that have already cleared, either partially or fully, cannot be + cleared again using this endpoint. extra_headers: Send extra headers @@ -423,11 +427,10 @@ def simulate_credit_authorization( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateCreditAuthorizationResponse: - """Simulates a credit authorization advice message from the payment network. + """Simulates a credit authorization advice from the card network. - This - message indicates that a credit authorization was approved on your behalf by the - network. + This message + indicates that the network approved a credit authorization on your behalf. Args: amount: Amount (in cents). Any value entered will be converted into a negative amount in @@ -483,10 +486,11 @@ def simulate_return( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateReturnResponse: - """Returns (aka refunds) an amount back to a card. + """Returns, or refunds, an amount back to a card. - Returns are cleared immediately - and do not spend time in a `PENDING` state. + Returns simulated via this + endpoint clear immediately, without prior authorization, and result in a + `SETTLED` transaction status. Args: amount: Amount (in cents) to authorize. @@ -530,10 +534,11 @@ def simulate_return_reversal( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateReturnReversalResponse: - """ - Voids a settled credit transaction – i.e., a transaction with a negative amount - and `SETTLED` status. These can be credit authorizations that have already - cleared or financial credit authorizations. + """Reverses a return, i.e. + + a credit transaction with a `SETTLED` status. Returns + can be financial credit authorizations, or credit authorizations that have + cleared. Args: token: The transaction token returned from the /v1/simulate/authorize response. @@ -570,19 +575,18 @@ def simulate_void( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateVoidResponse: - """Voids an existing, uncleared (aka pending) authorization. + """Voids a pending authorization. - If amount is not sent - the full amount will be voided. Cannot be used on partially completed - transactions, but can be used on partially voided transactions. _Note that - simulating an authorization expiry on credit authorizations or credit - authorization advice is not currently supported but will be added soon._ + If `amount` is not set, the full amount will be + voided. Can be used on partially voided transactions but not partially cleared + transactions. _Simulating an authorization expiry on credit authorizations or + credit authorization advice is not currently supported but will be added soon._ Args: token: The transaction token returned from the /v1/simulate/authorize response. - amount: Amount (in cents) to void. Typically this will match the original authorization, - but may be less. + amount: Amount (in cents) to void. Typically this will match the amount in the original + authorization, but can be less. type: Type of event to simulate. Defaults to `AUTHORIZATION_REVERSAL`. @@ -783,19 +787,20 @@ async def simulate_authorization( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateAuthorizationResponse: """ - Simulates an authorization request from the payment network as if it came from a - merchant acquirer. If you're configured for ASA, simulating auths requires your - ASA client to be set up properly (respond with a valid JSON to the ASA request). - For users that are not configured for ASA, a daily transaction limit of $5000 - USD is applied by default. This limit can be modified via the + Simulates an authorization request from the card network as if it came from a + merchant acquirer. If you are configured for ASA, simulating authorizations + requires your ASA client to be set up properly, i.e. be able to respond to the + ASA request with a valid JSON. For users that are not configured for ASA, a + daily transaction limit of $5000 USD is applied by default. You can update this + limit via the [update account](https://docs.lithic.com/reference/patchaccountbytoken) endpoint. Args: amount: Amount (in cents) to authorize. For credit authorizations and financial credit authorizations, any value entered will be converted into a negative amount in - the simulated transaction. For example, entering 100 in this field will appear - as a -100 amount in the transaction. For balance inquiries, this field must be + the simulated transaction. For example, entering 100 in this field will result + in a -100 amount in the transaction. For balance inquiries, this field must be set to 0. descriptor: Merchant descriptor. @@ -822,12 +827,12 @@ async def simulate_authorization( - `AUTHORIZATION` is a dual message purchase authorization, meaning a subsequent clearing step is required to settle the transaction. - - `BALANCE_INQUIRY` is a $0 authorization that includes a request for the - balance held on the card, and is most typically seen when a cardholder - requests to view a card's balance at an ATM. + - `BALANCE_INQUIRY` is a $0 authorization requesting the balance held on the + card, and is most often observed when a cardholder requests to view a card's + balance at an ATM. - `CREDIT_AUTHORIZATION` is a dual message request from a merchant to authorize - a refund or credit, meaning a subsequent clearing step is required to settle - the transaction. + a refund, meaning a subsequent clearing step is required to settle the + transaction. - `FINANCIAL_AUTHORIZATION` is a single message request from a merchant to debit funds immediately (such as an ATM withdrawal), and no subsequent clearing is required to settle the transaction. @@ -878,12 +883,12 @@ async def simulate_authorization_advice( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateAuthorizationAdviceResponse: """ - Simulates an authorization advice request from the payment network as if it came - from a merchant acquirer. An authorization advice request changes the amount of - the transaction. + Simulates an authorization advice from the card network as if it came from a + merchant acquirer. An authorization advice changes the pending amount of the + transaction. Args: - token: The transaction token returned from the /v1/simulate/authorize response. + token: The transaction token returned from the /v1/simulate/authorize. response. amount: Amount (in cents) to authorize. This amount will override the transaction's amount that was originally set by /v1/simulate/authorize. @@ -923,24 +928,27 @@ async def simulate_clearing( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateClearingResponse: - """Clears an existing authorization. + """Clears an existing authorization, either debit or credit. - After this event, the transaction is no longer - pending. + After this event, the + transaction transitions from `PENDING` to `SETTLED` status. - If no `amount` is supplied to this endpoint, the amount of the transaction will - be captured. Any transaction that has any amount completed at all do not have - access to this behavior. + If `amount` is not set, the full amount of the transaction will be cleared. + Transactions that have already cleared, either partially or fully, cannot be + cleared again using this endpoint. Args: token: The transaction token returned from the /v1/simulate/authorize response. - amount: Amount (in cents) to complete. Typically this will match the original - authorization, but may be more or less. + amount: Amount (in cents) to clear. Typically this will match the amount in the original + authorization, but can be higher or lower. The sign of this amount will + automatically match the sign of the original authorization's amount. For + example, entering 100 in this field will result in a -100 amount in the + transaction, if the original authorization is a credit authorization. - If no amount is supplied to this endpoint, the amount of the transaction will be - captured. Any transaction that has any amount completed at all do not have - access to this behavior. + If `amount` is not set, the full amount of the transaction will be cleared. + Transactions that have already cleared, either partially or fully, cannot be + cleared again using this endpoint. extra_headers: Send extra headers @@ -980,11 +988,10 @@ async def simulate_credit_authorization( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateCreditAuthorizationResponse: - """Simulates a credit authorization advice message from the payment network. + """Simulates a credit authorization advice from the card network. - This - message indicates that a credit authorization was approved on your behalf by the - network. + This message + indicates that the network approved a credit authorization on your behalf. Args: amount: Amount (in cents). Any value entered will be converted into a negative amount in @@ -1040,10 +1047,11 @@ async def simulate_return( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateReturnResponse: - """Returns (aka refunds) an amount back to a card. + """Returns, or refunds, an amount back to a card. - Returns are cleared immediately - and do not spend time in a `PENDING` state. + Returns simulated via this + endpoint clear immediately, without prior authorization, and result in a + `SETTLED` transaction status. Args: amount: Amount (in cents) to authorize. @@ -1087,10 +1095,11 @@ async def simulate_return_reversal( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateReturnReversalResponse: - """ - Voids a settled credit transaction – i.e., a transaction with a negative amount - and `SETTLED` status. These can be credit authorizations that have already - cleared or financial credit authorizations. + """Reverses a return, i.e. + + a credit transaction with a `SETTLED` status. Returns + can be financial credit authorizations, or credit authorizations that have + cleared. Args: token: The transaction token returned from the /v1/simulate/authorize response. @@ -1127,19 +1136,18 @@ async def simulate_void( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TransactionSimulateVoidResponse: - """Voids an existing, uncleared (aka pending) authorization. + """Voids a pending authorization. - If amount is not sent - the full amount will be voided. Cannot be used on partially completed - transactions, but can be used on partially voided transactions. _Note that - simulating an authorization expiry on credit authorizations or credit - authorization advice is not currently supported but will be added soon._ + If `amount` is not set, the full amount will be + voided. Can be used on partially voided transactions but not partially cleared + transactions. _Simulating an authorization expiry on credit authorizations or + credit authorization advice is not currently supported but will be added soon._ Args: token: The transaction token returned from the /v1/simulate/authorize response. - amount: Amount (in cents) to void. Typically this will match the original authorization, - but may be less. + amount: Amount (in cents) to void. Typically this will match the amount in the original + authorization, but can be less. type: Type of event to simulate. Defaults to `AUTHORIZATION_REVERSAL`. diff --git a/src/lithic/types/auth_rules/v2_apply_response.py b/src/lithic/types/auth_rules/v2_apply_response.py index 970dfa0a..4a0aac7a 100644 --- a/src/lithic/types/auth_rules/v2_apply_response.py +++ b/src/lithic/types/auth_rules/v2_apply_response.py @@ -71,7 +71,7 @@ class CurrentVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -145,7 +145,7 @@ class DraftVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -169,6 +169,7 @@ class DraftVersion(BaseModel): class V2ApplyResponse(BaseModel): token: str + """Auth Rule Token""" account_tokens: List[str] """Account tokens to which the Auth Rule applies.""" diff --git a/src/lithic/types/auth_rules/v2_create_params.py b/src/lithic/types/auth_rules/v2_create_params.py index b749e726..a6be31a1 100644 --- a/src/lithic/types/auth_rules/v2_create_params.py +++ b/src/lithic/types/auth_rules/v2_create_params.py @@ -83,7 +83,7 @@ class CreateAuthRuleRequestAccountTokensParametersConditionalBlockParametersCond operation: Literal["IS_ONE_OF", "IS_NOT_ONE_OF", "MATCHES", "DOES_NOT_MATCH", "IS_GREATER_THAN", "IS_LESS_THAN"] """The operation to apply to the attribute""" - value: Union[str, float, List[str]] + value: Union[str, int, List[str]] """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -155,7 +155,7 @@ class CreateAuthRuleRequestCardTokensParametersConditionalBlockParametersConditi operation: Literal["IS_ONE_OF", "IS_NOT_ONE_OF", "MATCHES", "DOES_NOT_MATCH", "IS_GREATER_THAN", "IS_LESS_THAN"] """The operation to apply to the attribute""" - value: Union[str, float, List[str]] + value: Union[str, int, List[str]] """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -227,7 +227,7 @@ class CreateAuthRuleRequestProgramLevelParametersConditionalBlockParametersCondi operation: Literal["IS_ONE_OF", "IS_NOT_ONE_OF", "MATCHES", "DOES_NOT_MATCH", "IS_GREATER_THAN", "IS_LESS_THAN"] """The operation to apply to the attribute""" - value: Union[str, float, List[str]] + value: Union[str, int, List[str]] """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" diff --git a/src/lithic/types/auth_rules/v2_create_response.py b/src/lithic/types/auth_rules/v2_create_response.py index 6ee72e59..976aeb4d 100644 --- a/src/lithic/types/auth_rules/v2_create_response.py +++ b/src/lithic/types/auth_rules/v2_create_response.py @@ -71,7 +71,7 @@ class CurrentVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -145,7 +145,7 @@ class DraftVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -169,6 +169,7 @@ class DraftVersion(BaseModel): class V2CreateResponse(BaseModel): token: str + """Auth Rule Token""" account_tokens: List[str] """Account tokens to which the Auth Rule applies.""" diff --git a/src/lithic/types/auth_rules/v2_draft_params.py b/src/lithic/types/auth_rules/v2_draft_params.py index a22e7038..382c7f72 100644 --- a/src/lithic/types/auth_rules/v2_draft_params.py +++ b/src/lithic/types/auth_rules/v2_draft_params.py @@ -68,7 +68,7 @@ class ParametersConditionalBlockParametersCondition(TypedDict, total=False): operation: Literal["IS_ONE_OF", "IS_NOT_ONE_OF", "MATCHES", "DOES_NOT_MATCH", "IS_GREATER_THAN", "IS_LESS_THAN"] """The operation to apply to the attribute""" - value: Union[str, float, List[str]] + value: Union[str, int, List[str]] """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" diff --git a/src/lithic/types/auth_rules/v2_draft_response.py b/src/lithic/types/auth_rules/v2_draft_response.py index fd8be59a..516b2db7 100644 --- a/src/lithic/types/auth_rules/v2_draft_response.py +++ b/src/lithic/types/auth_rules/v2_draft_response.py @@ -71,7 +71,7 @@ class CurrentVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -145,7 +145,7 @@ class DraftVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -169,6 +169,7 @@ class DraftVersion(BaseModel): class V2DraftResponse(BaseModel): token: str + """Auth Rule Token""" account_tokens: List[str] """Account tokens to which the Auth Rule applies.""" diff --git a/src/lithic/types/auth_rules/v2_list_response.py b/src/lithic/types/auth_rules/v2_list_response.py index 648ce243..b1ac2cc3 100644 --- a/src/lithic/types/auth_rules/v2_list_response.py +++ b/src/lithic/types/auth_rules/v2_list_response.py @@ -71,7 +71,7 @@ class CurrentVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -145,7 +145,7 @@ class DraftVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -169,6 +169,7 @@ class DraftVersion(BaseModel): class V2ListResponse(BaseModel): token: str + """Auth Rule Token""" account_tokens: List[str] """Account tokens to which the Auth Rule applies.""" diff --git a/src/lithic/types/auth_rules/v2_promote_response.py b/src/lithic/types/auth_rules/v2_promote_response.py index 645ebb9d..1ec1e7e3 100644 --- a/src/lithic/types/auth_rules/v2_promote_response.py +++ b/src/lithic/types/auth_rules/v2_promote_response.py @@ -71,7 +71,7 @@ class CurrentVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -145,7 +145,7 @@ class DraftVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -169,6 +169,7 @@ class DraftVersion(BaseModel): class V2PromoteResponse(BaseModel): token: str + """Auth Rule Token""" account_tokens: List[str] """Account tokens to which the Auth Rule applies.""" diff --git a/src/lithic/types/auth_rules/v2_retrieve_response.py b/src/lithic/types/auth_rules/v2_retrieve_response.py index cb834d9b..9f1e3ffb 100644 --- a/src/lithic/types/auth_rules/v2_retrieve_response.py +++ b/src/lithic/types/auth_rules/v2_retrieve_response.py @@ -71,7 +71,7 @@ class CurrentVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -145,7 +145,7 @@ class DraftVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -169,6 +169,7 @@ class DraftVersion(BaseModel): class V2RetrieveResponse(BaseModel): token: str + """Auth Rule Token""" account_tokens: List[str] """Account tokens to which the Auth Rule applies.""" diff --git a/src/lithic/types/auth_rules/v2_update_response.py b/src/lithic/types/auth_rules/v2_update_response.py index fffb3e9f..967ecd99 100644 --- a/src/lithic/types/auth_rules/v2_update_response.py +++ b/src/lithic/types/auth_rules/v2_update_response.py @@ -71,7 +71,7 @@ class CurrentVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -145,7 +145,7 @@ class DraftVersionParametersConditionalBlockParametersCondition(BaseModel): ] = None """The operation to apply to the attribute""" - value: Union[str, float, List[str], None] = None + value: Union[str, int, List[str], None] = None """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" @@ -169,6 +169,7 @@ class DraftVersion(BaseModel): class V2UpdateResponse(BaseModel): token: str + """Auth Rule Token""" account_tokens: List[str] """Account tokens to which the Auth Rule applies.""" diff --git a/src/lithic/types/card.py b/src/lithic/types/card.py index 5ff38920..a31ff96a 100644 --- a/src/lithic/types/card.py +++ b/src/lithic/types/card.py @@ -121,7 +121,7 @@ class Card(BaseModel): manufactured. """ - type: Literal["MERCHANT_LOCKED", "PHYSICAL", "SINGLE_USE", "VIRTUAL"] + type: Literal["MERCHANT_LOCKED", "PHYSICAL", "SINGLE_USE", "VIRTUAL", "UNLOCKED", "DIGITAL_WALLET"] """Card types: - `VIRTUAL` - Card will authorize at any merchant and can be added to a digital @@ -134,6 +134,10 @@ class Card(BaseModel): - `SINGLE_USE` - Card is closed upon first successful authorization. - `MERCHANT_LOCKED` - _[Deprecated]_ Card is locked to the first merchant that successfully authorizes the card. + - `UNLOCKED` - _[Deprecated]_ Similar behavior to VIRTUAL cards, please use + VIRTUAL instead. + - `DIGITAL_WALLET` - _[Deprecated]_ Similar behavior to VIRTUAL cards, please + use VIRTUAL instead. """ auth_rule_tokens: Optional[List[str]] = None @@ -191,3 +195,9 @@ class Card(BaseModel): This must be configured with Lithic before use. Specifies the configuration (i.e., physical card art) that the card should be manufactured with. """ + + replacement_for: Optional[str] = None + """ + If the card is a replacement for another card, the globally unique identifier + for the card that was replaced. + """ diff --git a/src/lithic/types/card_create_params.py b/src/lithic/types/card_create_params.py index bcd5d2f5..01c5e9a1 100644 --- a/src/lithic/types/card_create_params.py +++ b/src/lithic/types/card_create_params.py @@ -12,7 +12,7 @@ class CardCreateParams(TypedDict, total=False): - type: Required[Literal["MERCHANT_LOCKED", "PHYSICAL", "SINGLE_USE", "VIRTUAL"]] + type: Required[Literal["MERCHANT_LOCKED", "PHYSICAL", "SINGLE_USE", "VIRTUAL", "UNLOCKED", "DIGITAL_WALLET"]] """Card types: - `VIRTUAL` - Card will authorize at any merchant and can be added to a digital @@ -25,6 +25,10 @@ class CardCreateParams(TypedDict, total=False): - `SINGLE_USE` - Card is closed upon first successful authorization. - `MERCHANT_LOCKED` - _[Deprecated]_ Card is locked to the first merchant that successfully authorizes the card. + - `UNLOCKED` - _[Deprecated]_ Similar behavior to VIRTUAL cards, please use + VIRTUAL instead. + - `DIGITAL_WALLET` - _[Deprecated]_ Similar behavior to VIRTUAL cards, please + use VIRTUAL instead. """ account_token: str diff --git a/src/lithic/types/shared/velocity_limit_params.py b/src/lithic/types/shared/velocity_limit_params.py index 7bac9b17..413a34e2 100644 --- a/src/lithic/types/shared/velocity_limit_params.py +++ b/src/lithic/types/shared/velocity_limit_params.py @@ -28,7 +28,7 @@ class Filters(BaseModel): class VelocityLimitParams(BaseModel): filters: Filters - period: Union[float, VelocityLimitParamsPeriodWindow] + period: Union[int, VelocityLimitParamsPeriodWindow] """The size of the trailing window to calculate Spend Velocity over in seconds. The minimum value is 10 seconds, and the maximum value is 2678400 seconds. @@ -36,14 +36,14 @@ class VelocityLimitParams(BaseModel): scope: Literal["CARD", "ACCOUNT"] - limit_amount: Optional[float] = None + limit_amount: Optional[int] = None """ The maximum amount of spend velocity allowed in the period in minor units (the smallest unit of a currency, e.g. cents for USD). Transactions exceeding this limit will be declined. """ - limit_count: Optional[float] = None + limit_count: Optional[int] = None """ The number of spend velocity impacting transactions may not exceed this limit in the period. Transactions exceeding this limit will be declined. A spend velocity diff --git a/src/lithic/types/shared_params/velocity_limit_params.py b/src/lithic/types/shared_params/velocity_limit_params.py index 531c4f3d..45d56ff3 100644 --- a/src/lithic/types/shared_params/velocity_limit_params.py +++ b/src/lithic/types/shared_params/velocity_limit_params.py @@ -29,7 +29,7 @@ class Filters(TypedDict, total=False): class VelocityLimitParams(TypedDict, total=False): filters: Required[Filters] - period: Required[Union[float, VelocityLimitParamsPeriodWindow]] + period: Required[Union[int, VelocityLimitParamsPeriodWindow]] """The size of the trailing window to calculate Spend Velocity over in seconds. The minimum value is 10 seconds, and the maximum value is 2678400 seconds. @@ -37,14 +37,14 @@ class VelocityLimitParams(TypedDict, total=False): scope: Required[Literal["CARD", "ACCOUNT"]] - limit_amount: Optional[float] + limit_amount: Optional[int] """ The maximum amount of spend velocity allowed in the period in minor units (the smallest unit of a currency, e.g. cents for USD). Transactions exceeding this limit will be declined. """ - limit_count: Optional[float] + limit_count: Optional[int] """ The number of spend velocity impacting transactions may not exceed this limit in the period. Transactions exceeding this limit will be declined. A spend velocity diff --git a/src/lithic/types/three_ds/authentication_retrieve_response.py b/src/lithic/types/three_ds/authentication_retrieve_response.py index 515570dd..3b5a068e 100644 --- a/src/lithic/types/three_ds/authentication_retrieve_response.py +++ b/src/lithic/types/three_ds/authentication_retrieve_response.py @@ -124,14 +124,14 @@ class MerchantRiskIndicator(BaseModel): Maps to EMV 3DS field deliveryTimeframe. """ - gift_card_amount: Optional[float] = None + gift_card_amount: Optional[int] = None """ In prepaid or gift card purchase transactions, purchase amount total in major units (e.g., a purchase of USD $205.10 would be 205). Maps to EMV 3DS field giftCardAmount. """ - gift_card_count: Optional[float] = None + gift_card_count: Optional[int] = None """ In prepaid or gift card purchase transactions, count of individual prepaid or gift cards/codes purchased. Maps to EMV 3DS field giftCardCount. @@ -218,7 +218,7 @@ class AdditionalData(BaseModel): authentication request to be low risk or not. """ - network_risk_score: Optional[float] = None + network_risk_score: Optional[int] = None """ Mastercard only: Assessment by the network of the authentication risk level, with a higher value indicating a higher amount of risk. diff --git a/src/lithic/types/transaction.py b/src/lithic/types/transaction.py index d3dfa409..6f6c3797 100644 --- a/src/lithic/types/transaction.py +++ b/src/lithic/types/transaction.py @@ -33,12 +33,15 @@ class AmountsCardholder(BaseModel): amount: int - """The aggregate settled amount in the cardholder billing currency.""" + """ + The estimated settled amount of the transaction in the cardholder billing + currency. + """ conversion_rate: str """ - The conversion rate used to convert the merchant amount to the cardholder - billing amount. + The exchange rate used to convert the merchant amount to the cardholder billing + amount. """ currency: Currency @@ -51,10 +54,7 @@ class AmountsCardholder(BaseModel): class AmountsHold(BaseModel): amount: int - """ - The aggregate authorization amount of the transaction in the anticipated - settlement currency. - """ + """The pending amount of the transaction in the anticipated settlement currency.""" currency: Currency """ISO 4217 currency. @@ -66,7 +66,7 @@ class AmountsHold(BaseModel): class AmountsMerchant(BaseModel): amount: int - """The aggregate settled amount in the merchant currency.""" + """The settled amount of the transaction in the merchant currency.""" currency: Currency """ISO 4217 currency. @@ -78,7 +78,7 @@ class AmountsMerchant(BaseModel): class AmountsSettlement(BaseModel): amount: int - """The aggregate settled amount in the settlement currency.""" + """The settled amount of the transaction in the settlement currency.""" currency: Currency """ISO 4217 currency. @@ -314,12 +314,12 @@ class TokenInfo(BaseModel): class EventAmountsCardholder(BaseModel): amount: int - """The amount in the cardholder billing currency.""" + """Amount of the event in the cardholder billing currency.""" conversion_rate: str """ - The conversion rate used to convert the merchant amount to the cardholder - billing amount. + Exchange rate used to convert the merchant amount to the cardholder billing + amount. """ currency: Currency @@ -332,7 +332,7 @@ class EventAmountsCardholder(BaseModel): class EventAmountsMerchant(BaseModel): amount: int - """The amount in the merchant currency.""" + """Amount of the event in the merchant currency.""" currency: Currency """ISO 4217 currency. @@ -344,10 +344,13 @@ class EventAmountsMerchant(BaseModel): class EventAmountsSettlement(BaseModel): amount: int - """Amount of the event, if it is financial, in the settlement currency.""" + """Amount of the event, if it is financial, in the settlement currency. + + Non-financial events do not contain this amount because they do not move funds. + """ conversion_rate: str - """Conversion rate used to convert the merchant amount to the settlement amount.""" + """Exchange rate used to convert the merchant amount to the settlement amount.""" currency: Currency """ISO 4217 currency. diff --git a/src/lithic/types/transaction_simulate_authorization_advice_params.py b/src/lithic/types/transaction_simulate_authorization_advice_params.py index 503ec9d5..5e973292 100644 --- a/src/lithic/types/transaction_simulate_authorization_advice_params.py +++ b/src/lithic/types/transaction_simulate_authorization_advice_params.py @@ -9,7 +9,7 @@ class TransactionSimulateAuthorizationAdviceParams(TypedDict, total=False): token: Required[str] - """The transaction token returned from the /v1/simulate/authorize response.""" + """The transaction token returned from the /v1/simulate/authorize. response.""" amount: Required[int] """Amount (in cents) to authorize. diff --git a/src/lithic/types/transaction_simulate_authorization_params.py b/src/lithic/types/transaction_simulate_authorization_params.py index dc48a18c..25cb817d 100644 --- a/src/lithic/types/transaction_simulate_authorization_params.py +++ b/src/lithic/types/transaction_simulate_authorization_params.py @@ -13,7 +13,7 @@ class TransactionSimulateAuthorizationParams(TypedDict, total=False): For credit authorizations and financial credit authorizations, any value entered will be converted into a negative amount in the simulated transaction. For - example, entering 100 in this field will appear as a -100 amount in the + example, entering 100 in this field will result in a -100 amount in the transaction. For balance inquiries, this field must be set to 0. """ @@ -65,12 +65,12 @@ class TransactionSimulateAuthorizationParams(TypedDict, total=False): - `AUTHORIZATION` is a dual message purchase authorization, meaning a subsequent clearing step is required to settle the transaction. - - `BALANCE_INQUIRY` is a $0 authorization that includes a request for the - balance held on the card, and is most typically seen when a cardholder - requests to view a card's balance at an ATM. + - `BALANCE_INQUIRY` is a $0 authorization requesting the balance held on the + card, and is most often observed when a cardholder requests to view a card's + balance at an ATM. - `CREDIT_AUTHORIZATION` is a dual message request from a merchant to authorize - a refund or credit, meaning a subsequent clearing step is required to settle - the transaction. + a refund, meaning a subsequent clearing step is required to settle the + transaction. - `FINANCIAL_AUTHORIZATION` is a single message request from a merchant to debit funds immediately (such as an ATM withdrawal), and no subsequent clearing is required to settle the transaction. diff --git a/src/lithic/types/transaction_simulate_clearing_params.py b/src/lithic/types/transaction_simulate_clearing_params.py index 94475c8e..ab45523f 100644 --- a/src/lithic/types/transaction_simulate_clearing_params.py +++ b/src/lithic/types/transaction_simulate_clearing_params.py @@ -12,11 +12,15 @@ class TransactionSimulateClearingParams(TypedDict, total=False): """The transaction token returned from the /v1/simulate/authorize response.""" amount: int - """Amount (in cents) to complete. + """Amount (in cents) to clear. - Typically this will match the original authorization, but may be more or less. + Typically this will match the amount in the original authorization, but can be + higher or lower. The sign of this amount will automatically match the sign of + the original authorization's amount. For example, entering 100 in this field + will result in a -100 amount in the transaction, if the original authorization + is a credit authorization. - If no amount is supplied to this endpoint, the amount of the transaction will be - captured. Any transaction that has any amount completed at all do not have - access to this behavior. + If `amount` is not set, the full amount of the transaction will be cleared. + Transactions that have already cleared, either partially or fully, cannot be + cleared again using this endpoint. """ diff --git a/src/lithic/types/transaction_simulate_void_params.py b/src/lithic/types/transaction_simulate_void_params.py index dc796f1f..e5b10ea9 100644 --- a/src/lithic/types/transaction_simulate_void_params.py +++ b/src/lithic/types/transaction_simulate_void_params.py @@ -14,7 +14,8 @@ class TransactionSimulateVoidParams(TypedDict, total=False): amount: int """Amount (in cents) to void. - Typically this will match the original authorization, but may be less. + Typically this will match the amount in the original authorization, but can be + less. """ type: Literal["AUTHORIZATION_EXPIRY", "AUTHORIZATION_REVERSAL"]