gr4vy 1.2.0__py3-none-any.whl → 1.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gr4vy/_version.py +2 -2
- gr4vy/models/__init__.py +22 -0
- gr4vy/models/cancel_transactionop.py +43 -0
- gr4vy/models/cancelstatus.py +8 -0
- gr4vy/models/transactioncancel.py +81 -0
- gr4vy/transactions.py +286 -0
- {gr4vy-1.2.0.dist-info → gr4vy-1.2.1.dist-info}/METADATA +2 -1
- {gr4vy-1.2.0.dist-info → gr4vy-1.2.1.dist-info}/RECORD +9 -6
- {gr4vy-1.2.0.dist-info → gr4vy-1.2.1.dist-info}/WHEEL +0 -0
gr4vy/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "gr4vy"
|
|
6
|
-
__version__: str = "1.2.
|
|
6
|
+
__version__: str = "1.2.1"
|
|
7
7
|
__openapi_doc_version__: str = "1.0.0"
|
|
8
8
|
__gen_version__: str = "2.687.13"
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 1.2.
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 1.2.1 2.687.13 1.0.0 gr4vy"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
gr4vy/models/__init__.py
CHANGED
|
@@ -97,6 +97,13 @@ if TYPE_CHECKING:
|
|
|
97
97
|
from .buyercreate import BuyerCreate, BuyerCreateTypedDict
|
|
98
98
|
from .buyers import Buyers, BuyersTypedDict
|
|
99
99
|
from .buyerupdate import BuyerUpdate, BuyerUpdateTypedDict
|
|
100
|
+
from .cancel_transactionop import (
|
|
101
|
+
CancelTransactionGlobals,
|
|
102
|
+
CancelTransactionGlobalsTypedDict,
|
|
103
|
+
CancelTransactionRequest,
|
|
104
|
+
CancelTransactionRequestTypedDict,
|
|
105
|
+
)
|
|
106
|
+
from .cancelstatus import CancelStatus
|
|
100
107
|
from .capture_transactionop import (
|
|
101
108
|
CaptureTransactionGlobals,
|
|
102
109
|
CaptureTransactionGlobalsTypedDict,
|
|
@@ -977,6 +984,7 @@ if TYPE_CHECKING:
|
|
|
977
984
|
)
|
|
978
985
|
from .transaction import Transaction, TransactionTypedDict
|
|
979
986
|
from .transactionbuyer import TransactionBuyer, TransactionBuyerTypedDict
|
|
987
|
+
from .transactioncancel import TransactionCancel, TransactionCancelTypedDict
|
|
980
988
|
from .transactioncapture import TransactionCapture, TransactionCaptureTypedDict
|
|
981
989
|
from .transactioncapturecreate import (
|
|
982
990
|
TransactionCaptureCreate,
|
|
@@ -1224,6 +1232,11 @@ __all__ = [
|
|
|
1224
1232
|
"Buyers",
|
|
1225
1233
|
"BuyersTypedDict",
|
|
1226
1234
|
"CVVResponseCode",
|
|
1235
|
+
"CancelStatus",
|
|
1236
|
+
"CancelTransactionGlobals",
|
|
1237
|
+
"CancelTransactionGlobalsTypedDict",
|
|
1238
|
+
"CancelTransactionRequest",
|
|
1239
|
+
"CancelTransactionRequestTypedDict",
|
|
1227
1240
|
"CaptureStatus",
|
|
1228
1241
|
"CaptureTransactionGlobals",
|
|
1229
1242
|
"CaptureTransactionGlobalsTypedDict",
|
|
@@ -1907,6 +1920,8 @@ __all__ = [
|
|
|
1907
1920
|
"Transaction",
|
|
1908
1921
|
"TransactionBuyer",
|
|
1909
1922
|
"TransactionBuyerTypedDict",
|
|
1923
|
+
"TransactionCancel",
|
|
1924
|
+
"TransactionCancelTypedDict",
|
|
1910
1925
|
"TransactionCapture",
|
|
1911
1926
|
"TransactionCaptureCreate",
|
|
1912
1927
|
"TransactionCaptureCreateTypedDict",
|
|
@@ -2109,6 +2124,11 @@ _dynamic_imports: dict[str, str] = {
|
|
|
2109
2124
|
"BuyersTypedDict": ".buyers",
|
|
2110
2125
|
"BuyerUpdate": ".buyerupdate",
|
|
2111
2126
|
"BuyerUpdateTypedDict": ".buyerupdate",
|
|
2127
|
+
"CancelTransactionGlobals": ".cancel_transactionop",
|
|
2128
|
+
"CancelTransactionGlobalsTypedDict": ".cancel_transactionop",
|
|
2129
|
+
"CancelTransactionRequest": ".cancel_transactionop",
|
|
2130
|
+
"CancelTransactionRequestTypedDict": ".cancel_transactionop",
|
|
2131
|
+
"CancelStatus": ".cancelstatus",
|
|
2112
2132
|
"CaptureTransactionGlobals": ".capture_transactionop",
|
|
2113
2133
|
"CaptureTransactionGlobalsTypedDict": ".capture_transactionop",
|
|
2114
2134
|
"CaptureTransactionRequest": ".capture_transactionop",
|
|
@@ -2784,6 +2804,8 @@ _dynamic_imports: dict[str, str] = {
|
|
|
2784
2804
|
"TransactionTypedDict": ".transaction",
|
|
2785
2805
|
"TransactionBuyer": ".transactionbuyer",
|
|
2786
2806
|
"TransactionBuyerTypedDict": ".transactionbuyer",
|
|
2807
|
+
"TransactionCancel": ".transactioncancel",
|
|
2808
|
+
"TransactionCancelTypedDict": ".transactioncancel",
|
|
2787
2809
|
"TransactionCapture": ".transactioncapture",
|
|
2788
2810
|
"TransactionCaptureTypedDict": ".transactioncapture",
|
|
2789
2811
|
"TransactionCaptureCreate": ".transactioncapturecreate",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from gr4vy.types import BaseModel
|
|
5
|
+
from gr4vy.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
|
|
6
|
+
import pydantic
|
|
7
|
+
from typing import Optional
|
|
8
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CancelTransactionGlobalsTypedDict(TypedDict):
|
|
12
|
+
merchant_account_id: NotRequired[str]
|
|
13
|
+
r"""The ID of the merchant account to use for this request."""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CancelTransactionGlobals(BaseModel):
|
|
17
|
+
merchant_account_id: Annotated[
|
|
18
|
+
Optional[str],
|
|
19
|
+
pydantic.Field(alias="x-gr4vy-merchant-account-id"),
|
|
20
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
21
|
+
] = None
|
|
22
|
+
r"""The ID of the merchant account to use for this request."""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class CancelTransactionRequestTypedDict(TypedDict):
|
|
26
|
+
transaction_id: str
|
|
27
|
+
r"""The ID of the transaction"""
|
|
28
|
+
merchant_account_id: NotRequired[str]
|
|
29
|
+
r"""The ID of the merchant account to use for this request."""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class CancelTransactionRequest(BaseModel):
|
|
33
|
+
transaction_id: Annotated[
|
|
34
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
35
|
+
]
|
|
36
|
+
r"""The ID of the transaction"""
|
|
37
|
+
|
|
38
|
+
merchant_account_id: Annotated[
|
|
39
|
+
Optional[str],
|
|
40
|
+
pydantic.Field(alias="x-gr4vy-merchant-account-id"),
|
|
41
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
42
|
+
] = None
|
|
43
|
+
r"""The ID of the merchant account to use for this request."""
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from gr4vy.types import UnrecognizedStr
|
|
5
|
+
from typing import Literal, Union
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
CancelStatus = Union[Literal["succeeded", "pending", "failed"], UnrecognizedStr]
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .cancelstatus import CancelStatus
|
|
5
|
+
from .transaction import Transaction, TransactionTypedDict
|
|
6
|
+
from gr4vy.types import BaseModel, Nullable, UNSET_SENTINEL
|
|
7
|
+
from gr4vy.utils import validate_const, validate_open_enum
|
|
8
|
+
import pydantic
|
|
9
|
+
from pydantic import model_serializer
|
|
10
|
+
from pydantic.functional_validators import AfterValidator, PlainValidator
|
|
11
|
+
from typing import Literal, Optional
|
|
12
|
+
from typing_extensions import Annotated, TypedDict
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class TransactionCancelTypedDict(TypedDict):
|
|
16
|
+
status: CancelStatus
|
|
17
|
+
code: Nullable[str]
|
|
18
|
+
r"""The standardized error code set by Gr4vy."""
|
|
19
|
+
raw_response_code: Nullable[str]
|
|
20
|
+
r"""This is the response code received from the payment service. This can be set to any value and is not standardized across different payment services."""
|
|
21
|
+
raw_response_description: Nullable[str]
|
|
22
|
+
r"""This is the response description received from the payment service. This can be set to any value and is not standardized across different payment services."""
|
|
23
|
+
transaction: TransactionTypedDict
|
|
24
|
+
r"""A full transaction resource."""
|
|
25
|
+
type: Literal["transaction-cancel"]
|
|
26
|
+
r"""Always `transaction-cancel`."""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class TransactionCancel(BaseModel):
|
|
30
|
+
status: Annotated[CancelStatus, PlainValidator(validate_open_enum(False))]
|
|
31
|
+
|
|
32
|
+
code: Nullable[str]
|
|
33
|
+
r"""The standardized error code set by Gr4vy."""
|
|
34
|
+
|
|
35
|
+
raw_response_code: Nullable[str]
|
|
36
|
+
r"""This is the response code received from the payment service. This can be set to any value and is not standardized across different payment services."""
|
|
37
|
+
|
|
38
|
+
raw_response_description: Nullable[str]
|
|
39
|
+
r"""This is the response description received from the payment service. This can be set to any value and is not standardized across different payment services."""
|
|
40
|
+
|
|
41
|
+
transaction: Transaction
|
|
42
|
+
r"""A full transaction resource."""
|
|
43
|
+
|
|
44
|
+
TYPE: Annotated[
|
|
45
|
+
Annotated[
|
|
46
|
+
Optional[Literal["transaction-cancel"]],
|
|
47
|
+
AfterValidator(validate_const("transaction-cancel")),
|
|
48
|
+
],
|
|
49
|
+
pydantic.Field(alias="type"),
|
|
50
|
+
] = "transaction-cancel"
|
|
51
|
+
r"""Always `transaction-cancel`."""
|
|
52
|
+
|
|
53
|
+
@model_serializer(mode="wrap")
|
|
54
|
+
def serialize_model(self, handler):
|
|
55
|
+
optional_fields = ["type"]
|
|
56
|
+
nullable_fields = ["code", "raw_response_code", "raw_response_description"]
|
|
57
|
+
null_default_fields = []
|
|
58
|
+
|
|
59
|
+
serialized = handler(self)
|
|
60
|
+
|
|
61
|
+
m = {}
|
|
62
|
+
|
|
63
|
+
for n, f in type(self).model_fields.items():
|
|
64
|
+
k = f.alias or n
|
|
65
|
+
val = serialized.get(k)
|
|
66
|
+
serialized.pop(k, None)
|
|
67
|
+
|
|
68
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
69
|
+
is_set = (
|
|
70
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
71
|
+
or k in null_default_fields
|
|
72
|
+
) # pylint: disable=no-member
|
|
73
|
+
|
|
74
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
75
|
+
m[k] = val
|
|
76
|
+
elif val != UNSET_SENTINEL and (
|
|
77
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
78
|
+
):
|
|
79
|
+
m[k] = val
|
|
80
|
+
|
|
81
|
+
return m
|
gr4vy/transactions.py
CHANGED
|
@@ -2546,6 +2546,292 @@ class Transactions(BaseSDK):
|
|
|
2546
2546
|
|
|
2547
2547
|
raise errors.APIError("Unexpected response received", http_res)
|
|
2548
2548
|
|
|
2549
|
+
def cancel(
|
|
2550
|
+
self,
|
|
2551
|
+
*,
|
|
2552
|
+
transaction_id: str,
|
|
2553
|
+
merchant_account_id: Optional[str] = None,
|
|
2554
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2555
|
+
server_url: Optional[str] = None,
|
|
2556
|
+
timeout_ms: Optional[int] = None,
|
|
2557
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2558
|
+
) -> models.TransactionCancel:
|
|
2559
|
+
r"""Cancel transaction
|
|
2560
|
+
|
|
2561
|
+
Cancels a pending transaction. If the transaction was successfully authorized, or was already captured, the cancel will not be processed.
|
|
2562
|
+
|
|
2563
|
+
:param transaction_id: The ID of the transaction
|
|
2564
|
+
:param merchant_account_id: The ID of the merchant account to use for this request.
|
|
2565
|
+
:param retries: Override the default retry configuration for this method
|
|
2566
|
+
:param server_url: Override the default server URL for this method
|
|
2567
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2568
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2569
|
+
"""
|
|
2570
|
+
base_url = None
|
|
2571
|
+
url_variables = None
|
|
2572
|
+
if timeout_ms is None:
|
|
2573
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2574
|
+
|
|
2575
|
+
if server_url is not None:
|
|
2576
|
+
base_url = server_url
|
|
2577
|
+
else:
|
|
2578
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2579
|
+
|
|
2580
|
+
request = models.CancelTransactionRequest(
|
|
2581
|
+
transaction_id=transaction_id,
|
|
2582
|
+
merchant_account_id=merchant_account_id,
|
|
2583
|
+
)
|
|
2584
|
+
|
|
2585
|
+
req = self._build_request(
|
|
2586
|
+
method="POST",
|
|
2587
|
+
path="/transactions/{transaction_id}/cancel",
|
|
2588
|
+
base_url=base_url,
|
|
2589
|
+
url_variables=url_variables,
|
|
2590
|
+
request=request,
|
|
2591
|
+
request_body_required=False,
|
|
2592
|
+
request_has_path_params=True,
|
|
2593
|
+
request_has_query_params=True,
|
|
2594
|
+
user_agent_header="user-agent",
|
|
2595
|
+
accept_header_value="application/json",
|
|
2596
|
+
http_headers=http_headers,
|
|
2597
|
+
_globals=models.CancelTransactionGlobals(
|
|
2598
|
+
merchant_account_id=self.sdk_configuration.globals.merchant_account_id,
|
|
2599
|
+
),
|
|
2600
|
+
security=self.sdk_configuration.security,
|
|
2601
|
+
timeout_ms=timeout_ms,
|
|
2602
|
+
)
|
|
2603
|
+
|
|
2604
|
+
if retries == UNSET:
|
|
2605
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2606
|
+
retries = self.sdk_configuration.retry_config
|
|
2607
|
+
|
|
2608
|
+
retry_config = None
|
|
2609
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2610
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2611
|
+
|
|
2612
|
+
http_res = self.do_request(
|
|
2613
|
+
hook_ctx=HookContext(
|
|
2614
|
+
config=self.sdk_configuration,
|
|
2615
|
+
base_url=base_url or "",
|
|
2616
|
+
operation_id="cancel_transaction",
|
|
2617
|
+
oauth2_scopes=[],
|
|
2618
|
+
security_source=get_security_from_env(
|
|
2619
|
+
self.sdk_configuration.security, models.Security
|
|
2620
|
+
),
|
|
2621
|
+
),
|
|
2622
|
+
request=req,
|
|
2623
|
+
error_status_codes=[
|
|
2624
|
+
"400",
|
|
2625
|
+
"401",
|
|
2626
|
+
"403",
|
|
2627
|
+
"404",
|
|
2628
|
+
"405",
|
|
2629
|
+
"409",
|
|
2630
|
+
"422",
|
|
2631
|
+
"425",
|
|
2632
|
+
"429",
|
|
2633
|
+
"4XX",
|
|
2634
|
+
"500",
|
|
2635
|
+
"502",
|
|
2636
|
+
"504",
|
|
2637
|
+
"5XX",
|
|
2638
|
+
],
|
|
2639
|
+
retry_config=retry_config,
|
|
2640
|
+
)
|
|
2641
|
+
|
|
2642
|
+
response_data: Any = None
|
|
2643
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
2644
|
+
return unmarshal_json_response(models.TransactionCancel, http_res)
|
|
2645
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
2646
|
+
response_data = unmarshal_json_response(errors.Error400Data, http_res)
|
|
2647
|
+
raise errors.Error400(response_data, http_res)
|
|
2648
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
2649
|
+
response_data = unmarshal_json_response(errors.Error401Data, http_res)
|
|
2650
|
+
raise errors.Error401(response_data, http_res)
|
|
2651
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
2652
|
+
response_data = unmarshal_json_response(errors.Error403Data, http_res)
|
|
2653
|
+
raise errors.Error403(response_data, http_res)
|
|
2654
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
2655
|
+
response_data = unmarshal_json_response(errors.Error404Data, http_res)
|
|
2656
|
+
raise errors.Error404(response_data, http_res)
|
|
2657
|
+
if utils.match_response(http_res, "405", "application/json"):
|
|
2658
|
+
response_data = unmarshal_json_response(errors.Error405Data, http_res)
|
|
2659
|
+
raise errors.Error405(response_data, http_res)
|
|
2660
|
+
if utils.match_response(http_res, "409", "application/json"):
|
|
2661
|
+
response_data = unmarshal_json_response(errors.Error409Data, http_res)
|
|
2662
|
+
raise errors.Error409(response_data, http_res)
|
|
2663
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
2664
|
+
response_data = unmarshal_json_response(
|
|
2665
|
+
errors.HTTPValidationErrorData, http_res
|
|
2666
|
+
)
|
|
2667
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
2668
|
+
if utils.match_response(http_res, "425", "application/json"):
|
|
2669
|
+
response_data = unmarshal_json_response(errors.Error425Data, http_res)
|
|
2670
|
+
raise errors.Error425(response_data, http_res)
|
|
2671
|
+
if utils.match_response(http_res, "429", "application/json"):
|
|
2672
|
+
response_data = unmarshal_json_response(errors.Error429Data, http_res)
|
|
2673
|
+
raise errors.Error429(response_data, http_res)
|
|
2674
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
2675
|
+
response_data = unmarshal_json_response(errors.Error500Data, http_res)
|
|
2676
|
+
raise errors.Error500(response_data, http_res)
|
|
2677
|
+
if utils.match_response(http_res, "502", "application/json"):
|
|
2678
|
+
response_data = unmarshal_json_response(errors.Error502Data, http_res)
|
|
2679
|
+
raise errors.Error502(response_data, http_res)
|
|
2680
|
+
if utils.match_response(http_res, "504", "application/json"):
|
|
2681
|
+
response_data = unmarshal_json_response(errors.Error504Data, http_res)
|
|
2682
|
+
raise errors.Error504(response_data, http_res)
|
|
2683
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2684
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2685
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2686
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2687
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2688
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2689
|
+
|
|
2690
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
2691
|
+
|
|
2692
|
+
async def cancel_async(
|
|
2693
|
+
self,
|
|
2694
|
+
*,
|
|
2695
|
+
transaction_id: str,
|
|
2696
|
+
merchant_account_id: Optional[str] = None,
|
|
2697
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2698
|
+
server_url: Optional[str] = None,
|
|
2699
|
+
timeout_ms: Optional[int] = None,
|
|
2700
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2701
|
+
) -> models.TransactionCancel:
|
|
2702
|
+
r"""Cancel transaction
|
|
2703
|
+
|
|
2704
|
+
Cancels a pending transaction. If the transaction was successfully authorized, or was already captured, the cancel will not be processed.
|
|
2705
|
+
|
|
2706
|
+
:param transaction_id: The ID of the transaction
|
|
2707
|
+
:param merchant_account_id: The ID of the merchant account to use for this request.
|
|
2708
|
+
:param retries: Override the default retry configuration for this method
|
|
2709
|
+
:param server_url: Override the default server URL for this method
|
|
2710
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2711
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2712
|
+
"""
|
|
2713
|
+
base_url = None
|
|
2714
|
+
url_variables = None
|
|
2715
|
+
if timeout_ms is None:
|
|
2716
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2717
|
+
|
|
2718
|
+
if server_url is not None:
|
|
2719
|
+
base_url = server_url
|
|
2720
|
+
else:
|
|
2721
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2722
|
+
|
|
2723
|
+
request = models.CancelTransactionRequest(
|
|
2724
|
+
transaction_id=transaction_id,
|
|
2725
|
+
merchant_account_id=merchant_account_id,
|
|
2726
|
+
)
|
|
2727
|
+
|
|
2728
|
+
req = self._build_request_async(
|
|
2729
|
+
method="POST",
|
|
2730
|
+
path="/transactions/{transaction_id}/cancel",
|
|
2731
|
+
base_url=base_url,
|
|
2732
|
+
url_variables=url_variables,
|
|
2733
|
+
request=request,
|
|
2734
|
+
request_body_required=False,
|
|
2735
|
+
request_has_path_params=True,
|
|
2736
|
+
request_has_query_params=True,
|
|
2737
|
+
user_agent_header="user-agent",
|
|
2738
|
+
accept_header_value="application/json",
|
|
2739
|
+
http_headers=http_headers,
|
|
2740
|
+
_globals=models.CancelTransactionGlobals(
|
|
2741
|
+
merchant_account_id=self.sdk_configuration.globals.merchant_account_id,
|
|
2742
|
+
),
|
|
2743
|
+
security=self.sdk_configuration.security,
|
|
2744
|
+
timeout_ms=timeout_ms,
|
|
2745
|
+
)
|
|
2746
|
+
|
|
2747
|
+
if retries == UNSET:
|
|
2748
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2749
|
+
retries = self.sdk_configuration.retry_config
|
|
2750
|
+
|
|
2751
|
+
retry_config = None
|
|
2752
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2753
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2754
|
+
|
|
2755
|
+
http_res = await self.do_request_async(
|
|
2756
|
+
hook_ctx=HookContext(
|
|
2757
|
+
config=self.sdk_configuration,
|
|
2758
|
+
base_url=base_url or "",
|
|
2759
|
+
operation_id="cancel_transaction",
|
|
2760
|
+
oauth2_scopes=[],
|
|
2761
|
+
security_source=get_security_from_env(
|
|
2762
|
+
self.sdk_configuration.security, models.Security
|
|
2763
|
+
),
|
|
2764
|
+
),
|
|
2765
|
+
request=req,
|
|
2766
|
+
error_status_codes=[
|
|
2767
|
+
"400",
|
|
2768
|
+
"401",
|
|
2769
|
+
"403",
|
|
2770
|
+
"404",
|
|
2771
|
+
"405",
|
|
2772
|
+
"409",
|
|
2773
|
+
"422",
|
|
2774
|
+
"425",
|
|
2775
|
+
"429",
|
|
2776
|
+
"4XX",
|
|
2777
|
+
"500",
|
|
2778
|
+
"502",
|
|
2779
|
+
"504",
|
|
2780
|
+
"5XX",
|
|
2781
|
+
],
|
|
2782
|
+
retry_config=retry_config,
|
|
2783
|
+
)
|
|
2784
|
+
|
|
2785
|
+
response_data: Any = None
|
|
2786
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
2787
|
+
return unmarshal_json_response(models.TransactionCancel, http_res)
|
|
2788
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
2789
|
+
response_data = unmarshal_json_response(errors.Error400Data, http_res)
|
|
2790
|
+
raise errors.Error400(response_data, http_res)
|
|
2791
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
2792
|
+
response_data = unmarshal_json_response(errors.Error401Data, http_res)
|
|
2793
|
+
raise errors.Error401(response_data, http_res)
|
|
2794
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
2795
|
+
response_data = unmarshal_json_response(errors.Error403Data, http_res)
|
|
2796
|
+
raise errors.Error403(response_data, http_res)
|
|
2797
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
2798
|
+
response_data = unmarshal_json_response(errors.Error404Data, http_res)
|
|
2799
|
+
raise errors.Error404(response_data, http_res)
|
|
2800
|
+
if utils.match_response(http_res, "405", "application/json"):
|
|
2801
|
+
response_data = unmarshal_json_response(errors.Error405Data, http_res)
|
|
2802
|
+
raise errors.Error405(response_data, http_res)
|
|
2803
|
+
if utils.match_response(http_res, "409", "application/json"):
|
|
2804
|
+
response_data = unmarshal_json_response(errors.Error409Data, http_res)
|
|
2805
|
+
raise errors.Error409(response_data, http_res)
|
|
2806
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
2807
|
+
response_data = unmarshal_json_response(
|
|
2808
|
+
errors.HTTPValidationErrorData, http_res
|
|
2809
|
+
)
|
|
2810
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
2811
|
+
if utils.match_response(http_res, "425", "application/json"):
|
|
2812
|
+
response_data = unmarshal_json_response(errors.Error425Data, http_res)
|
|
2813
|
+
raise errors.Error425(response_data, http_res)
|
|
2814
|
+
if utils.match_response(http_res, "429", "application/json"):
|
|
2815
|
+
response_data = unmarshal_json_response(errors.Error429Data, http_res)
|
|
2816
|
+
raise errors.Error429(response_data, http_res)
|
|
2817
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
2818
|
+
response_data = unmarshal_json_response(errors.Error500Data, http_res)
|
|
2819
|
+
raise errors.Error500(response_data, http_res)
|
|
2820
|
+
if utils.match_response(http_res, "502", "application/json"):
|
|
2821
|
+
response_data = unmarshal_json_response(errors.Error502Data, http_res)
|
|
2822
|
+
raise errors.Error502(response_data, http_res)
|
|
2823
|
+
if utils.match_response(http_res, "504", "application/json"):
|
|
2824
|
+
response_data = unmarshal_json_response(errors.Error504Data, http_res)
|
|
2825
|
+
raise errors.Error504(response_data, http_res)
|
|
2826
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2827
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2828
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2829
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2830
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2831
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2832
|
+
|
|
2833
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
2834
|
+
|
|
2549
2835
|
def sync(
|
|
2550
2836
|
self,
|
|
2551
2837
|
*,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: gr4vy
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: Python Client SDK Generated by Speakeasy.
|
|
5
5
|
Author: Gr4vy
|
|
6
6
|
Requires-Python: >=3.9.2
|
|
@@ -490,6 +490,7 @@ except ValueError as error:
|
|
|
490
490
|
* [update](https://github.com/gr4vy/gr4vy-python/blob/master/docs/sdks/transactions/README.md#update) - Manually update a transaction
|
|
491
491
|
* [capture](https://github.com/gr4vy/gr4vy-python/blob/master/docs/sdks/transactions/README.md#capture) - Capture transaction
|
|
492
492
|
* [void](https://github.com/gr4vy/gr4vy-python/blob/master/docs/sdks/transactions/README.md#void) - Void transaction
|
|
493
|
+
* [cancel](https://github.com/gr4vy/gr4vy-python/blob/master/docs/sdks/transactions/README.md#cancel) - Cancel transaction
|
|
493
494
|
* [sync](https://github.com/gr4vy/gr4vy-python/blob/master/docs/sdks/transactions/README.md#sync) - Sync transaction
|
|
494
495
|
|
|
495
496
|
#### [transactions.events](https://github.com/gr4vy/gr4vy-python/blob/master/docs/sdks/events/README.md)
|
|
@@ -2,7 +2,7 @@ gr4vy/__init__.py,sha256=w2u919V3Tzv4zEPQ-OYJ79gQ_4_SyW7GOFFoHtqXDFA,401
|
|
|
2
2
|
gr4vy/_hooks/__init__.py,sha256=p5J13DeYuISQyQWirjJAObHIf2VtIlOtFqnIpvjjVwk,118
|
|
3
3
|
gr4vy/_hooks/sdkhooks.py,sha256=3jKTs2B1lcAxBMJge9C-qL0RGbKGLcrHvikzi67Tbdo,2493
|
|
4
4
|
gr4vy/_hooks/types.py,sha256=0O7dbbolkiFAnHkNULvwoLsiXJu0_Wmhev163bvZbW8,3039
|
|
5
|
-
gr4vy/_version.py,sha256=
|
|
5
|
+
gr4vy/_version.py,sha256=0Q5aJfrq4vdvm26lVeB8tBL7QnhfGozo5pDdx6FvyDw,454
|
|
6
6
|
gr4vy/account_updater.py,sha256=mmTd25Oap80PBqQ3p4MvZ_buT5VS0zWc8s8cqfI7iyA,607
|
|
7
7
|
gr4vy/all.py,sha256=WwnLoNn3RgXNpf4Xoz12ct94JD7NMpLz-kzesHHh4m8,15172
|
|
8
8
|
gr4vy/audit_logs.py,sha256=iAT3rnS0NYNKZGw5IVl_MC_RPAHMJNXHfd_K--HIplU,17015
|
|
@@ -40,7 +40,7 @@ gr4vy/gift_cards_sdk.py,sha256=wGmWTaQqsnVOUNXQ7dFZcDAcw9c5wq8xyoO189ctmpo,57465
|
|
|
40
40
|
gr4vy/httpclient.py,sha256=Eu73urOAiZQtdUIyOUnPccxCiBbWEKrXG-JrRG3SLM4,3946
|
|
41
41
|
gr4vy/jobs.py,sha256=WHx0epnlxOMHFSXTJPwuI5dhOO_acGTX72Lbz6fvD8A,14565
|
|
42
42
|
gr4vy/merchant_accounts_sdk.py,sha256=TGwGZqyD_b7xR2pggTsOa3H813-zhakhtjS9d_NsfmA,80907
|
|
43
|
-
gr4vy/models/__init__.py,sha256=
|
|
43
|
+
gr4vy/models/__init__.py,sha256=JbrNyHNBK8OlW3Kfhcbk5auLFgXnT4RAKD8FBxc0bDI,131370
|
|
44
44
|
gr4vy/models/accountsreceivablesreportspec.py,sha256=X4YKJ5TII4KFi1I47BYt1Egxsfs84EaqXsb7g90IpLw,1012
|
|
45
45
|
gr4vy/models/accountupdaterinquirysummary.py,sha256=rOJn5uG7cNFUkd6BbsAve6ueUlAJzU5_d_zeDu6RBTg,1097
|
|
46
46
|
gr4vy/models/accountupdaterjob.py,sha256=JKuRwrc5yYSAQ9lD5Ta4MALtfXBF7tn_37lllQsH2B0,1972
|
|
@@ -81,6 +81,8 @@ gr4vy/models/buyer.py,sha256=KEN4eeI7HSPr8NcrR8ieEhwCeqZpALWHwCebfRSeL7U,3569
|
|
|
81
81
|
gr4vy/models/buyercreate.py,sha256=bFhAzie6osvQYc8YSlCwwZuEIaTmgmddVpD607fbHNQ,2555
|
|
82
82
|
gr4vy/models/buyers.py,sha256=QJLFFT-l3RUGww78h-BqYTt7Mr-fLUs9VDrK2wl3naU,2133
|
|
83
83
|
gr4vy/models/buyerupdate.py,sha256=tiPp2oKZYemrRp0uCt0sO6x-nlKNmtvIIzTmRCBe_h4,2567
|
|
84
|
+
gr4vy/models/cancel_transactionop.py,sha256=RBsqNruvMIWAHkhPT_s4GPu3pWlf_NfKJWNXc9HrvxI,1511
|
|
85
|
+
gr4vy/models/cancelstatus.py,sha256=sEpL0C7fS95WiqRX4WRGXkfYXu3jZ3TQoVPYeqfBcVE,265
|
|
84
86
|
gr4vy/models/capture_transactionop.py,sha256=-mWQC7dDILr0PKYgC6mOTcD2vYRtumbd92IAbbf67MM,3726
|
|
85
87
|
gr4vy/models/capturestatus.py,sha256=dqgBYyfzjQRML7XsbbeW2BkJLdkOZDb1VjOufU_9by4,284
|
|
86
88
|
gr4vy/models/cardpaymentmethodcreate.py,sha256=WQPt3NYDIPV0lCDQ8rB4Tqzu9JNkh0_UrgwJZeCI6SQ,3498
|
|
@@ -340,6 +342,7 @@ gr4vy/models/threedsecurev2.py,sha256=tbl7LU6hrQaC-stDPQYXJApr62A2HgJD17YvD06Isn
|
|
|
340
342
|
gr4vy/models/tokenpaymentmethodcreate.py,sha256=vuhZCgZvu9d7U7DAjBN6Bx8tJ29Yx-LCxrmijXaWUj0,2681
|
|
341
343
|
gr4vy/models/transaction.py,sha256=fof5VDhoQfUyp23cR0QX2RHtSskU--Bj1sqO0Yxyd5U,22264
|
|
342
344
|
gr4vy/models/transactionbuyer.py,sha256=7VxBYmR7IBNA082NqCCdwWtOjyK9ut5dPS4M-6rVHjE,3074
|
|
345
|
+
gr4vy/models/transactioncancel.py,sha256=OHP0xmmM374aaYXPeV0G2fZn5RRfxbTAzJnNospfCas,3162
|
|
343
346
|
gr4vy/models/transactioncapture.py,sha256=7WD3uoUyDJ1sejtjIb7b5B5BFtpKEi7KkegVtB0DLTg,3174
|
|
344
347
|
gr4vy/models/transactioncapturecreate.py,sha256=Hs8tTi8iG3xUBptznKHfUD7rvcGZX0OwDzpXOBegd8E,2188
|
|
345
348
|
gr4vy/models/transactionconnectionoptions.py,sha256=GeXBb1VgGyRJvOxt8Dl0-psTHERjFWM5GBBgcvuBGKI,18231
|
|
@@ -402,7 +405,7 @@ gr4vy/reports_sdk.py,sha256=lUuxAgnAO0CIDYEoP3VAHnYoG8d4Vq-pi-41uJ4sKPs,59557
|
|
|
402
405
|
gr4vy/sdk.py,sha256=XqkSODRWO2VLYcVBhQjX0EdgKson0juO_oQMsgJ_h5o,10477
|
|
403
406
|
gr4vy/sdkconfiguration.py,sha256=aBQ8gY9aOjf1TL0kSLat8hEIoH4lCE9_PhihyhBpRE4,1985
|
|
404
407
|
gr4vy/sessions.py,sha256=yg9L1vMfHT6dNc6zjthULHFS2dC67QzXCv5WUFMn3DI,41609
|
|
405
|
-
gr4vy/transactions.py,sha256=
|
|
408
|
+
gr4vy/transactions.py,sha256=706j8-jmi-fSoNhIsMENmtvw5VqawPPyJopb-YFvJyc,164741
|
|
406
409
|
gr4vy/transactions_refunds.py,sha256=_YXYEbNw-F5PotIxZE83zU__987Asqz_9JnqBIKhEvw,43591
|
|
407
410
|
gr4vy/transactions_settlements.py,sha256=YOH0JAGvli36XhKKXyQ81JIIuv59uCOpqBri6SlYfa0,27750
|
|
408
411
|
gr4vy/types/__init__.py,sha256=RArOwSgeeTIva6h-4ttjXwMUeCkz10nAFBL9D-QljI4,377
|
|
@@ -425,6 +428,6 @@ gr4vy/utils/unmarshal_json_response.py,sha256=H7jxugtMDuagdBXdpGiPf0Vr5-PWLETp8B
|
|
|
425
428
|
gr4vy/utils/url.py,sha256=BgGPgcTA6MRK4bF8fjP2dUopN3NzEzxWMXPBVg8NQUA,5254
|
|
426
429
|
gr4vy/utils/values.py,sha256=CcaCXEa3xHhkUDROyXZocN8f0bdITftv9Y0P9lTf0YM,3517
|
|
427
430
|
gr4vy/webhooks.py,sha256=2L-ZhdK-XU2X0AkVqgZvhfRqDCKUVs7R4UNCmZJR78w,1359
|
|
428
|
-
gr4vy-1.2.
|
|
429
|
-
gr4vy-1.2.
|
|
430
|
-
gr4vy-1.2.
|
|
431
|
+
gr4vy-1.2.1.dist-info/METADATA,sha256=rvmcxWyYQqU6E5aJY1vccqymw5G-66VikOo49Pl6TYA,44151
|
|
432
|
+
gr4vy-1.2.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
433
|
+
gr4vy-1.2.1.dist-info/RECORD,,
|
|
File without changes
|