python-terminusgps 45.8.0__py3-none-any.whl → 46.0.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 45.8.0
3
+ Version: 46.0.0
4
4
  Summary: Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more.
5
5
  Project-URL: Documentation, https://terminusgps.github.io/python-terminusgps
6
6
  Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
@@ -4,7 +4,7 @@ terminusgps/mixins.py,sha256=Q9ZJuzpk3d9lDnlVA8ZTVvnZWxB13p08EQ8yVJcztn4,1034
4
4
  terminusgps/validators.py,sha256=Mf0c7ku_wTQ7uv4hcLRyz0r2eRjvznIL77LLTE5uJ6E,9152
5
5
  terminusgps/authorizenet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  terminusgps/authorizenet/constants.py,sha256=Bat87PXB-g5_FM0pkAwX2dTHLJ05UAf_xLery4eKmr0,2723
7
- terminusgps/authorizenet/service.py,sha256=MKtudM2vwmBytCneZsQ9PDAX-RO4Ma2sPL6ZwEcHDms,4198
7
+ terminusgps/authorizenet/service.py,sha256=jjYo1vLgTZSXVNeBY6uKSma94AgEj3Q5xOAT5wUB6ko,4260
8
8
  terminusgps/authorizenet/api/__init__.py,sha256=VXR4Yco1yz5R-R7vgaH2zTP9VFqzfvvGy_XJVjyb3i0,154
9
9
  terminusgps/authorizenet/api/address_profiles.py,sha256=VouUN6dIxlnuE3qEiacFqqDBi_VtwvSbsELqTqFZ0BE,4746
10
10
  terminusgps/authorizenet/api/customer_profiles.py,sha256=oya9KMRE10nKLjECTIdanfV_P8-gnNZLE0sYmRYVkgM,4505
@@ -27,7 +27,7 @@ terminusgps/wialon/items/route.py,sha256=9hmRBEFRJF3lKukv_y3blZxqxv75YgFCcRALrU6
27
27
  terminusgps/wialon/items/unit.py,sha256=B5iuGEghu89SL8KzYLUytYNRa8cogsVtf-bJ_RybPTA,5522
28
28
  terminusgps/wialon/items/unit_group.py,sha256=MIR0x5IlTjcnwx8Y9wXLNTql-wwVVj7NCe7dL2vOw4c,2131
29
29
  terminusgps/wialon/items/user.py,sha256=CRSICiJ-qzybEO_gXuKyzW5oa2RQeIp0SzX9ARcdME4,5151
30
- python_terminusgps-45.8.0.dist-info/METADATA,sha256=9UdnSnFWPz1De4j4nqUlyiRrA-MPsb2Yvoj9J8WDZGs,938
31
- python_terminusgps-45.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
32
- python_terminusgps-45.8.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
33
- python_terminusgps-45.8.0.dist-info/RECORD,,
30
+ python_terminusgps-46.0.0.dist-info/METADATA,sha256=FEQ3DDBwtUI1T9NTyNl0Az-9M2ecIW8ihK4v8Ynftns,938
31
+ python_terminusgps-46.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
32
+ python_terminusgps-46.0.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
33
+ python_terminusgps-46.0.0.dist-info/RECORD,,
@@ -1,3 +1,4 @@
1
+ from abc import ABC
1
2
  from functools import cached_property
2
3
 
3
4
  from authorizenet.apicontractsv1 import merchantAuthenticationType
@@ -34,8 +35,8 @@ class AuthorizenetControllerExecutionError(Exception):
34
35
  return self._code
35
36
 
36
37
 
37
- class AuthorizenetService:
38
- """A service for safely interacting with the Authorizenet API."""
38
+ class AuthorizenetService(ABC):
39
+ """Base service for safely interacting with the Authorizenet API."""
39
40
 
40
41
  REQUIRED_SETTINGS = (
41
42
  "MERCHANT_AUTH_ENVIRONMENT",
@@ -50,21 +51,18 @@ class AuthorizenetService:
50
51
  if not hasattr(settings, setting):
51
52
  raise ImproperlyConfigured(f"'{setting}' setting is required.")
52
53
 
53
- def call_api(
54
+ def execute(
54
55
  self,
55
- request: ObjectifiedElement,
56
- controller_cls: type[APIOperationBase],
56
+ request_tuple: tuple[ObjectifiedElement, type[APIOperationBase]],
57
57
  reference_id: str | None = None,
58
58
  ) -> ObjectifiedElement:
59
59
  """
60
- Adds required authentication data to the request before executing it and returning its response.
60
+ Adds required authentication data to the Authorizenet API request before executing it and returning its response.
61
61
 
62
62
  If ``reference_id`` was provided, it is added to the request before execution.
63
63
 
64
- :param request: An Authorizenet API request element.
65
- :type request: ~lxml.objectify.ObjectifiedElement
66
- :param controller_cls: An Authorizenet controller class.
67
- :type controller_cls: type[~authorizenet.apicontrollersbase.APIOperationBase]
64
+ :param request_tuple: A tuple containing an Authorizenet API request contract and a controller class to execute it with.
65
+ :type request_tuple: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
68
66
  :param reference_id: An optional reference id string for the API call. Default is :py:obj:`None`.
69
67
  :type reference_id: str | None
70
68
  :raises AuthorizenetControllerExecutionError: If the API call failed.
@@ -72,6 +70,7 @@ class AuthorizenetService:
72
70
  :rtype: ~lxml.objectify.ObjectifiedElement
73
71
 
74
72
  """
73
+ request, controller_cls = request_tuple[0], request_tuple[1]
75
74
  request.merchantAuthentication = self.merchantAuthentication
76
75
  if reference_id is not None:
77
76
  request.refId = reference_id
@@ -79,8 +78,8 @@ class AuthorizenetService:
79
78
  controller = controller_cls(request)
80
79
  controller.setenvironment(self.environment)
81
80
  controller.execute()
81
+ response = controller.getresponse()
82
82
 
83
- response: ObjectifiedElement | None = controller.getresponse()
84
83
  if response is None:
85
84
  raise AuthorizenetControllerExecutionError(
86
85
  message="No response from the Authorizenet API controller.",