| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._stripe_service import StripeService |
| 4 |
from stripe._util import sanitize_id |
| 5 |
from typing import Optional, cast |
| 6 |
from typing_extensions import TYPE_CHECKING |
| 7 |
|
| 8 |
if TYPE_CHECKING: |
| 9 |
from stripe._request_options import RequestOptions |
| 10 |
from stripe.issuing._transaction import Transaction |
| 11 |
from stripe.params.test_helpers.issuing._transaction_create_force_capture_params import ( |
| 12 |
TransactionCreateForceCaptureParams, |
| 13 |
) |
| 14 |
from stripe.params.test_helpers.issuing._transaction_create_unlinked_refund_params import ( |
| 15 |
TransactionCreateUnlinkedRefundParams, |
| 16 |
) |
| 17 |
from stripe.params.test_helpers.issuing._transaction_refund_params import ( |
| 18 |
TransactionRefundParams, |
| 19 |
) |
| 20 |
|
| 21 |
|
| 22 |
class TransactionService(StripeService): |
| 23 |
def refund( |
| 24 |
self, |
| 25 |
transaction: str, |
| 26 |
params: Optional["TransactionRefundParams"] = None, |
| 27 |
options: Optional["RequestOptions"] = None, |
| 28 |
) -> "Transaction": |
| 29 |
""" |
| 30 |
Refund a test-mode Transaction. |
| 31 |
""" |
| 32 |
return cast( |
| 33 |
"Transaction", |
| 34 |
self._request( |
| 35 |
"post", |
| 36 |
"/v1/test_helpers/issuing/transactions/{transaction}/refund".format( |
| 37 |
transaction=sanitize_id(transaction), |
| 38 |
), |
| 39 |
base_address="api", |
| 40 |
params=params, |
| 41 |
options=options, |
| 42 |
), |
| 43 |
) |
| 44 |
|
| 45 |
async def refund_async( |
| 46 |
self, |
| 47 |
transaction: str, |
| 48 |
params: Optional["TransactionRefundParams"] = None, |
| 49 |
options: Optional["RequestOptions"] = None, |
| 50 |
) -> "Transaction": |
| 51 |
""" |
| 52 |
Refund a test-mode Transaction. |
| 53 |
""" |
| 54 |
return cast( |
| 55 |
"Transaction", |
| 56 |
await self._request_async( |
| 57 |
"post", |
| 58 |
"/v1/test_helpers/issuing/transactions/{transaction}/refund".format( |
| 59 |
transaction=sanitize_id(transaction), |
| 60 |
), |
| 61 |
base_address="api", |
| 62 |
params=params, |
| 63 |
options=options, |
| 64 |
), |
| 65 |
) |
| 66 |
|
| 67 |
def create_force_capture( |
| 68 |
self, |
| 69 |
params: "TransactionCreateForceCaptureParams", |
| 70 |
options: Optional["RequestOptions"] = None, |
| 71 |
) -> "Transaction": |
| 72 |
""" |
| 73 |
Allows the user to capture an arbitrary amount, also known as a forced capture. |
| 74 |
""" |
| 75 |
return cast( |
| 76 |
"Transaction", |
| 77 |
self._request( |
| 78 |
"post", |
| 79 |
"/v1/test_helpers/issuing/transactions/create_force_capture", |
| 80 |
base_address="api", |
| 81 |
params=params, |
| 82 |
options=options, |
| 83 |
), |
| 84 |
) |
| 85 |
|
| 86 |
async def create_force_capture_async( |
| 87 |
self, |
| 88 |
params: "TransactionCreateForceCaptureParams", |
| 89 |
options: Optional["RequestOptions"] = None, |
| 90 |
) -> "Transaction": |
| 91 |
""" |
| 92 |
Allows the user to capture an arbitrary amount, also known as a forced capture. |
| 93 |
""" |
| 94 |
return cast( |
| 95 |
"Transaction", |
| 96 |
await self._request_async( |
| 97 |
"post", |
| 98 |
"/v1/test_helpers/issuing/transactions/create_force_capture", |
| 99 |
base_address="api", |
| 100 |
params=params, |
| 101 |
options=options, |
| 102 |
), |
| 103 |
) |
| 104 |
|
| 105 |
def create_unlinked_refund( |
| 106 |
self, |
| 107 |
params: "TransactionCreateUnlinkedRefundParams", |
| 108 |
options: Optional["RequestOptions"] = None, |
| 109 |
) -> "Transaction": |
| 110 |
""" |
| 111 |
Allows the user to refund an arbitrary amount, also known as a unlinked refund. |
| 112 |
""" |
| 113 |
return cast( |
| 114 |
"Transaction", |
| 115 |
self._request( |
| 116 |
"post", |
| 117 |
"/v1/test_helpers/issuing/transactions/create_unlinked_refund", |
| 118 |
base_address="api", |
| 119 |
params=params, |
| 120 |
options=options, |
| 121 |
), |
| 122 |
) |
| 123 |
|
| 124 |
async def create_unlinked_refund_async( |
| 125 |
self, |
| 126 |
params: "TransactionCreateUnlinkedRefundParams", |
| 127 |
options: Optional["RequestOptions"] = None, |
| 128 |
) -> "Transaction": |
| 129 |
""" |
| 130 |
Allows the user to refund an arbitrary amount, also known as a unlinked refund. |
| 131 |
""" |
| 132 |
return cast( |
| 133 |
"Transaction", |
| 134 |
await self._request_async( |
| 135 |
"post", |
| 136 |
"/v1/test_helpers/issuing/transactions/create_unlinked_refund", |
| 137 |
base_address="api", |
| 138 |
params=params, |
| 139 |
options=options, |
| 140 |
), |
| 141 |
) |