Skip to content

Commit 3e71dc6

Browse files
feat(api): rename endpoint
deprecate simulate_credit_authorization in favor of simulate_credit_authorization_advice
1 parent 946cc59 commit 3e71dc6

File tree

7 files changed

+348
-31
lines changed

7 files changed

+348
-31
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 168
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-1d44bb7fad99487af1161eb24dfd5369440eda7e80ed237cbc1acc6802a7d212.yml
33
openapi_spec_hash: 1b6b6215b60094b76b91c56b925a251a
4-
config_hash: ac676e77c8ca051c7aad978c26e96345
4+
config_hash: e68a052fd109c0885732114753abc739

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ from lithic.types import (
426426
TransactionSimulateAuthorizationAdviceResponse,
427427
TransactionSimulateClearingResponse,
428428
TransactionSimulateCreditAuthorizationResponse,
429+
TransactionSimulateCreditAuthorizationAdviceResponse,
429430
TransactionSimulateReturnResponse,
430431
TransactionSimulateReturnReversalResponse,
431432
TransactionSimulateVoidResponse,
@@ -441,6 +442,7 @@ Methods:
441442
- <code title="post /v1/simulate/authorization_advice">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">simulate_authorization_advice</a>(\*\*<a href="src/lithic/types/transaction_simulate_authorization_advice_params.py">params</a>) -> <a href="./src/lithic/types/transaction_simulate_authorization_advice_response.py">TransactionSimulateAuthorizationAdviceResponse</a></code>
442443
- <code title="post /v1/simulate/clearing">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">simulate_clearing</a>(\*\*<a href="src/lithic/types/transaction_simulate_clearing_params.py">params</a>) -> <a href="./src/lithic/types/transaction_simulate_clearing_response.py">TransactionSimulateClearingResponse</a></code>
443444
- <code title="post /v1/simulate/credit_authorization_advice">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">simulate_credit_authorization</a>(\*\*<a href="src/lithic/types/transaction_simulate_credit_authorization_params.py">params</a>) -> <a href="./src/lithic/types/transaction_simulate_credit_authorization_response.py">TransactionSimulateCreditAuthorizationResponse</a></code>
445+
- <code title="post /v1/simulate/credit_authorization_advice">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">simulate_credit_authorization_advice</a>(\*\*<a href="src/lithic/types/transaction_simulate_credit_authorization_advice_params.py">params</a>) -> <a href="./src/lithic/types/transaction_simulate_credit_authorization_advice_response.py">TransactionSimulateCreditAuthorizationAdviceResponse</a></code>
444446
- <code title="post /v1/simulate/return">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">simulate_return</a>(\*\*<a href="src/lithic/types/transaction_simulate_return_params.py">params</a>) -> <a href="./src/lithic/types/transaction_simulate_return_response.py">TransactionSimulateReturnResponse</a></code>
445447
- <code title="post /v1/simulate/return_reversal">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">simulate_return_reversal</a>(\*\*<a href="src/lithic/types/transaction_simulate_return_reversal_params.py">params</a>) -> <a href="./src/lithic/types/transaction_simulate_return_reversal_response.py">TransactionSimulateReturnReversalResponse</a></code>
446448
- <code title="post /v1/simulate/void">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">simulate_void</a>(\*\*<a href="src/lithic/types/transaction_simulate_void_params.py">params</a>) -> <a href="./src/lithic/types/transaction_simulate_void_response.py">TransactionSimulateVoidResponse</a></code>

src/lithic/resources/transactions/transactions.py

Lines changed: 157 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import typing_extensions
56
from typing import Union
67
from datetime import datetime
78
from typing_extensions import Literal
@@ -18,6 +19,7 @@
1819
transaction_simulate_return_reversal_params,
1920
transaction_simulate_authorization_advice_params,
2021
transaction_simulate_credit_authorization_params,
22+
transaction_simulate_credit_authorization_advice_params,
2123
)
2224
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
2325
from ..._utils import maybe_transform, async_maybe_transform
@@ -50,6 +52,9 @@
5052
from ...types.transaction_simulate_return_reversal_response import TransactionSimulateReturnReversalResponse
5153
from ...types.transaction_simulate_authorization_advice_response import TransactionSimulateAuthorizationAdviceResponse
5254
from ...types.transaction_simulate_credit_authorization_response import TransactionSimulateCreditAuthorizationResponse
55+
from ...types.transaction_simulate_credit_authorization_advice_response import (
56+
TransactionSimulateCreditAuthorizationAdviceResponse,
57+
)
5358

5459
__all__ = ["Transactions", "AsyncTransactions"]
5560

@@ -449,6 +454,7 @@ def simulate_clearing(
449454
cast_to=TransactionSimulateClearingResponse,
450455
)
451456

457+
@typing_extensions.deprecated("use `simulate_credit_authorization_advice` instead")
452458
def simulate_credit_authorization(
453459
self,
454460
*,
@@ -510,6 +516,67 @@ def simulate_credit_authorization(
510516
cast_to=TransactionSimulateCreditAuthorizationResponse,
511517
)
512518

519+
def simulate_credit_authorization_advice(
520+
self,
521+
*,
522+
amount: int,
523+
descriptor: str,
524+
pan: str,
525+
mcc: str | NotGiven = NOT_GIVEN,
526+
merchant_acceptor_id: str | NotGiven = NOT_GIVEN,
527+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
528+
# The extra values given here take precedence over values defined on the client or passed to this method.
529+
extra_headers: Headers | None = None,
530+
extra_query: Query | None = None,
531+
extra_body: Body | None = None,
532+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
533+
) -> TransactionSimulateCreditAuthorizationAdviceResponse:
534+
"""Simulates a credit authorization advice from the card network.
535+
536+
This message
537+
indicates that the network approved a credit authorization on your behalf.
538+
539+
Args:
540+
amount: Amount (in cents). Any value entered will be converted into a negative amount in
541+
the simulated transaction. For example, entering 100 in this field will appear
542+
as a -100 amount in the transaction.
543+
544+
descriptor: Merchant descriptor.
545+
546+
pan: Sixteen digit card number.
547+
548+
mcc: Merchant category code for the transaction to be simulated. A four-digit number
549+
listed in ISO 18245. Supported merchant category codes can be found
550+
[here](https://docs.lithic.com/docs/transactions#merchant-category-codes-mccs).
551+
552+
merchant_acceptor_id: Unique identifier to identify the payment card acceptor.
553+
554+
extra_headers: Send extra headers
555+
556+
extra_query: Add additional query parameters to the request
557+
558+
extra_body: Add additional JSON properties to the request
559+
560+
timeout: Override the client-level default timeout for this request, in seconds
561+
"""
562+
return self._post(
563+
"/v1/simulate/credit_authorization_advice",
564+
body=maybe_transform(
565+
{
566+
"amount": amount,
567+
"descriptor": descriptor,
568+
"pan": pan,
569+
"mcc": mcc,
570+
"merchant_acceptor_id": merchant_acceptor_id,
571+
},
572+
transaction_simulate_credit_authorization_advice_params.TransactionSimulateCreditAuthorizationAdviceParams,
573+
),
574+
options=make_request_options(
575+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
576+
),
577+
cast_to=TransactionSimulateCreditAuthorizationAdviceResponse,
578+
)
579+
513580
def simulate_return(
514581
self,
515582
*,
@@ -1051,6 +1118,7 @@ async def simulate_clearing(
10511118
cast_to=TransactionSimulateClearingResponse,
10521119
)
10531120

1121+
@typing_extensions.deprecated("use `simulate_credit_authorization_advice` instead")
10541122
async def simulate_credit_authorization(
10551123
self,
10561124
*,
@@ -1112,6 +1180,67 @@ async def simulate_credit_authorization(
11121180
cast_to=TransactionSimulateCreditAuthorizationResponse,
11131181
)
11141182

1183+
async def simulate_credit_authorization_advice(
1184+
self,
1185+
*,
1186+
amount: int,
1187+
descriptor: str,
1188+
pan: str,
1189+
mcc: str | NotGiven = NOT_GIVEN,
1190+
merchant_acceptor_id: str | NotGiven = NOT_GIVEN,
1191+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1192+
# The extra values given here take precedence over values defined on the client or passed to this method.
1193+
extra_headers: Headers | None = None,
1194+
extra_query: Query | None = None,
1195+
extra_body: Body | None = None,
1196+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1197+
) -> TransactionSimulateCreditAuthorizationAdviceResponse:
1198+
"""Simulates a credit authorization advice from the card network.
1199+
1200+
This message
1201+
indicates that the network approved a credit authorization on your behalf.
1202+
1203+
Args:
1204+
amount: Amount (in cents). Any value entered will be converted into a negative amount in
1205+
the simulated transaction. For example, entering 100 in this field will appear
1206+
as a -100 amount in the transaction.
1207+
1208+
descriptor: Merchant descriptor.
1209+
1210+
pan: Sixteen digit card number.
1211+
1212+
mcc: Merchant category code for the transaction to be simulated. A four-digit number
1213+
listed in ISO 18245. Supported merchant category codes can be found
1214+
[here](https://docs.lithic.com/docs/transactions#merchant-category-codes-mccs).
1215+
1216+
merchant_acceptor_id: Unique identifier to identify the payment card acceptor.
1217+
1218+
extra_headers: Send extra headers
1219+
1220+
extra_query: Add additional query parameters to the request
1221+
1222+
extra_body: Add additional JSON properties to the request
1223+
1224+
timeout: Override the client-level default timeout for this request, in seconds
1225+
"""
1226+
return await self._post(
1227+
"/v1/simulate/credit_authorization_advice",
1228+
body=await async_maybe_transform(
1229+
{
1230+
"amount": amount,
1231+
"descriptor": descriptor,
1232+
"pan": pan,
1233+
"mcc": mcc,
1234+
"merchant_acceptor_id": merchant_acceptor_id,
1235+
},
1236+
transaction_simulate_credit_authorization_advice_params.TransactionSimulateCreditAuthorizationAdviceParams,
1237+
),
1238+
options=make_request_options(
1239+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1240+
),
1241+
cast_to=TransactionSimulateCreditAuthorizationAdviceResponse,
1242+
)
1243+
11151244
async def simulate_return(
11161245
self,
11171246
*,
@@ -1280,8 +1409,13 @@ def __init__(self, transactions: Transactions) -> None:
12801409
self.simulate_clearing = _legacy_response.to_raw_response_wrapper(
12811410
transactions.simulate_clearing,
12821411
)
1283-
self.simulate_credit_authorization = _legacy_response.to_raw_response_wrapper(
1284-
transactions.simulate_credit_authorization,
1412+
self.simulate_credit_authorization = ( # pyright: ignore[reportDeprecated]
1413+
_legacy_response.to_raw_response_wrapper(
1414+
transactions.simulate_credit_authorization, # pyright: ignore[reportDeprecated],
1415+
)
1416+
)
1417+
self.simulate_credit_authorization_advice = _legacy_response.to_raw_response_wrapper(
1418+
transactions.simulate_credit_authorization_advice,
12851419
)
12861420
self.simulate_return = _legacy_response.to_raw_response_wrapper(
12871421
transactions.simulate_return,
@@ -1324,8 +1458,13 @@ def __init__(self, transactions: AsyncTransactions) -> None:
13241458
self.simulate_clearing = _legacy_response.async_to_raw_response_wrapper(
13251459
transactions.simulate_clearing,
13261460
)
1327-
self.simulate_credit_authorization = _legacy_response.async_to_raw_response_wrapper(
1328-
transactions.simulate_credit_authorization,
1461+
self.simulate_credit_authorization = ( # pyright: ignore[reportDeprecated]
1462+
_legacy_response.async_to_raw_response_wrapper(
1463+
transactions.simulate_credit_authorization, # pyright: ignore[reportDeprecated],
1464+
)
1465+
)
1466+
self.simulate_credit_authorization_advice = _legacy_response.async_to_raw_response_wrapper(
1467+
transactions.simulate_credit_authorization_advice,
13291468
)
13301469
self.simulate_return = _legacy_response.async_to_raw_response_wrapper(
13311470
transactions.simulate_return,
@@ -1368,8 +1507,13 @@ def __init__(self, transactions: Transactions) -> None:
13681507
self.simulate_clearing = to_streamed_response_wrapper(
13691508
transactions.simulate_clearing,
13701509
)
1371-
self.simulate_credit_authorization = to_streamed_response_wrapper(
1372-
transactions.simulate_credit_authorization,
1510+
self.simulate_credit_authorization = ( # pyright: ignore[reportDeprecated]
1511+
to_streamed_response_wrapper(
1512+
transactions.simulate_credit_authorization, # pyright: ignore[reportDeprecated],
1513+
)
1514+
)
1515+
self.simulate_credit_authorization_advice = to_streamed_response_wrapper(
1516+
transactions.simulate_credit_authorization_advice,
13731517
)
13741518
self.simulate_return = to_streamed_response_wrapper(
13751519
transactions.simulate_return,
@@ -1412,8 +1556,13 @@ def __init__(self, transactions: AsyncTransactions) -> None:
14121556
self.simulate_clearing = async_to_streamed_response_wrapper(
14131557
transactions.simulate_clearing,
14141558
)
1415-
self.simulate_credit_authorization = async_to_streamed_response_wrapper(
1416-
transactions.simulate_credit_authorization,
1559+
self.simulate_credit_authorization = ( # pyright: ignore[reportDeprecated]
1560+
async_to_streamed_response_wrapper(
1561+
transactions.simulate_credit_authorization, # pyright: ignore[reportDeprecated],
1562+
)
1563+
)
1564+
self.simulate_credit_authorization_advice = async_to_streamed_response_wrapper(
1565+
transactions.simulate_credit_authorization_advice,
14171566
)
14181567
self.simulate_return = async_to_streamed_response_wrapper(
14191568
transactions.simulate_return,

src/lithic/types/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@
228228
from .external_bank_account_retry_micro_deposits_response import (
229229
ExternalBankAccountRetryMicroDepositsResponse as ExternalBankAccountRetryMicroDepositsResponse,
230230
)
231+
from .transaction_simulate_credit_authorization_advice_params import (
232+
TransactionSimulateCreditAuthorizationAdviceParams as TransactionSimulateCreditAuthorizationAdviceParams,
233+
)
231234
from .account_holder_simulate_enrollment_document_review_params import (
232235
AccountHolderSimulateEnrollmentDocumentReviewParams as AccountHolderSimulateEnrollmentDocumentReviewParams,
233236
)
237+
from .transaction_simulate_credit_authorization_advice_response import (
238+
TransactionSimulateCreditAuthorizationAdviceResponse as TransactionSimulateCreditAuthorizationAdviceResponse,
239+
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Required, TypedDict
6+
7+
__all__ = ["TransactionSimulateCreditAuthorizationAdviceParams"]
8+
9+
10+
class TransactionSimulateCreditAuthorizationAdviceParams(TypedDict, total=False):
11+
amount: Required[int]
12+
"""Amount (in cents).
13+
14+
Any value entered will be converted into a negative amount in the simulated
15+
transaction. For example, entering 100 in this field will appear as a -100
16+
amount in the transaction.
17+
"""
18+
19+
descriptor: Required[str]
20+
"""Merchant descriptor."""
21+
22+
pan: Required[str]
23+
"""Sixteen digit card number."""
24+
25+
mcc: str
26+
"""Merchant category code for the transaction to be simulated.
27+
28+
A four-digit number listed in ISO 18245. Supported merchant category codes can
29+
be found
30+
[here](https://docs.lithic.com/docs/transactions#merchant-category-codes-mccs).
31+
"""
32+
33+
merchant_acceptor_id: str
34+
"""Unique identifier to identify the payment card acceptor."""
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
5+
from .._models import BaseModel
6+
7+
__all__ = ["TransactionSimulateCreditAuthorizationAdviceResponse"]
8+
9+
10+
class TransactionSimulateCreditAuthorizationAdviceResponse(BaseModel):
11+
token: Optional[str] = None
12+
"""A unique token to reference this transaction."""
13+
14+
debugging_request_id: Optional[str] = None
15+
"""Debugging request ID to share with Lithic Support team."""

0 commit comments

Comments
 (0)