|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
| 5 | +import typing_extensions |
5 | 6 | from typing import Union |
6 | 7 | from datetime import datetime |
7 | 8 | from typing_extensions import Literal |
|
18 | 19 | transaction_simulate_return_reversal_params, |
19 | 20 | transaction_simulate_authorization_advice_params, |
20 | 21 | transaction_simulate_credit_authorization_params, |
| 22 | + transaction_simulate_credit_authorization_advice_params, |
21 | 23 | ) |
22 | 24 | from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven |
23 | 25 | from ..._utils import maybe_transform, async_maybe_transform |
|
50 | 52 | from ...types.transaction_simulate_return_reversal_response import TransactionSimulateReturnReversalResponse |
51 | 53 | from ...types.transaction_simulate_authorization_advice_response import TransactionSimulateAuthorizationAdviceResponse |
52 | 54 | from ...types.transaction_simulate_credit_authorization_response import TransactionSimulateCreditAuthorizationResponse |
| 55 | +from ...types.transaction_simulate_credit_authorization_advice_response import ( |
| 56 | + TransactionSimulateCreditAuthorizationAdviceResponse, |
| 57 | +) |
53 | 58 |
|
54 | 59 | __all__ = ["Transactions", "AsyncTransactions"] |
55 | 60 |
|
@@ -449,6 +454,7 @@ def simulate_clearing( |
449 | 454 | cast_to=TransactionSimulateClearingResponse, |
450 | 455 | ) |
451 | 456 |
|
| 457 | + @typing_extensions.deprecated("use `simulate_credit_authorization_advice` instead") |
452 | 458 | def simulate_credit_authorization( |
453 | 459 | self, |
454 | 460 | *, |
@@ -510,6 +516,67 @@ def simulate_credit_authorization( |
510 | 516 | cast_to=TransactionSimulateCreditAuthorizationResponse, |
511 | 517 | ) |
512 | 518 |
|
| 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 | + |
513 | 580 | def simulate_return( |
514 | 581 | self, |
515 | 582 | *, |
@@ -1051,6 +1118,7 @@ async def simulate_clearing( |
1051 | 1118 | cast_to=TransactionSimulateClearingResponse, |
1052 | 1119 | ) |
1053 | 1120 |
|
| 1121 | + @typing_extensions.deprecated("use `simulate_credit_authorization_advice` instead") |
1054 | 1122 | async def simulate_credit_authorization( |
1055 | 1123 | self, |
1056 | 1124 | *, |
@@ -1112,6 +1180,67 @@ async def simulate_credit_authorization( |
1112 | 1180 | cast_to=TransactionSimulateCreditAuthorizationResponse, |
1113 | 1181 | ) |
1114 | 1182 |
|
| 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 | + |
1115 | 1244 | async def simulate_return( |
1116 | 1245 | self, |
1117 | 1246 | *, |
@@ -1280,8 +1409,13 @@ def __init__(self, transactions: Transactions) -> None: |
1280 | 1409 | self.simulate_clearing = _legacy_response.to_raw_response_wrapper( |
1281 | 1410 | transactions.simulate_clearing, |
1282 | 1411 | ) |
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, |
1285 | 1419 | ) |
1286 | 1420 | self.simulate_return = _legacy_response.to_raw_response_wrapper( |
1287 | 1421 | transactions.simulate_return, |
@@ -1324,8 +1458,13 @@ def __init__(self, transactions: AsyncTransactions) -> None: |
1324 | 1458 | self.simulate_clearing = _legacy_response.async_to_raw_response_wrapper( |
1325 | 1459 | transactions.simulate_clearing, |
1326 | 1460 | ) |
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, |
1329 | 1468 | ) |
1330 | 1469 | self.simulate_return = _legacy_response.async_to_raw_response_wrapper( |
1331 | 1470 | transactions.simulate_return, |
@@ -1368,8 +1507,13 @@ def __init__(self, transactions: Transactions) -> None: |
1368 | 1507 | self.simulate_clearing = to_streamed_response_wrapper( |
1369 | 1508 | transactions.simulate_clearing, |
1370 | 1509 | ) |
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, |
1373 | 1517 | ) |
1374 | 1518 | self.simulate_return = to_streamed_response_wrapper( |
1375 | 1519 | transactions.simulate_return, |
@@ -1412,8 +1556,13 @@ def __init__(self, transactions: AsyncTransactions) -> None: |
1412 | 1556 | self.simulate_clearing = async_to_streamed_response_wrapper( |
1413 | 1557 | transactions.simulate_clearing, |
1414 | 1558 | ) |
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, |
1417 | 1566 | ) |
1418 | 1567 | self.simulate_return = async_to_streamed_response_wrapper( |
1419 | 1568 | transactions.simulate_return, |
|
0 commit comments