python-terminusgps 45.5.0__py3-none-any.whl → 45.6.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.

Potentially problematic release.


This version of python-terminusgps might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 45.5.0
3
+ Version: 45.6.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
@@ -6,7 +6,7 @@ terminusgps/authorizenet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
6
6
  terminusgps/authorizenet/auth.py,sha256=T4lPm6eq2ZRoPffLg6GrLZn7wUZ-RTBNi0epyw6ph_w,1035
7
7
  terminusgps/authorizenet/constants.py,sha256=eukAZQVuv3XHL-Kd1gqxf8IYUqNC67ClTz4ZU7JPNYE,1459
8
8
  terminusgps/authorizenet/controllers.py,sha256=wuyKDLTpBmnfyPsHnN9uVnWlrMDUF059ctW-OiZQL-I,2055
9
- terminusgps/authorizenet/services.py,sha256=IGW1xuc7uZBAZ4KHJGEp7dFlMb-u7Q3SmSpNmAmrkTY,2344
9
+ terminusgps/authorizenet/services.py,sha256=aItmf8RHDOmAaYFl38hE23gIoTZiCzKYXb6ukbzD91Y,2576
10
10
  terminusgps/authorizenet/api/__init__.py,sha256=VXR4Yco1yz5R-R7vgaH2zTP9VFqzfvvGy_XJVjyb3i0,154
11
11
  terminusgps/authorizenet/api/address_profiles.py,sha256=VouUN6dIxlnuE3qEiacFqqDBi_VtwvSbsELqTqFZ0BE,4746
12
12
  terminusgps/authorizenet/api/customer_profiles.py,sha256=oya9KMRE10nKLjECTIdanfV_P8-gnNZLE0sYmRYVkgM,4505
@@ -29,7 +29,7 @@ terminusgps/wialon/items/route.py,sha256=9hmRBEFRJF3lKukv_y3blZxqxv75YgFCcRALrU6
29
29
  terminusgps/wialon/items/unit.py,sha256=B5iuGEghu89SL8KzYLUytYNRa8cogsVtf-bJ_RybPTA,5522
30
30
  terminusgps/wialon/items/unit_group.py,sha256=MIR0x5IlTjcnwx8Y9wXLNTql-wwVVj7NCe7dL2vOw4c,2131
31
31
  terminusgps/wialon/items/user.py,sha256=CRSICiJ-qzybEO_gXuKyzW5oa2RQeIp0SzX9ARcdME4,5151
32
- python_terminusgps-45.5.0.dist-info/METADATA,sha256=JlfYlqfaOdBlzkckUZ4ToaOlcyo9qxx82mmYLknbr9I,938
33
- python_terminusgps-45.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
34
- python_terminusgps-45.5.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
35
- python_terminusgps-45.5.0.dist-info/RECORD,,
32
+ python_terminusgps-45.6.0.dist-info/METADATA,sha256=YvvuY_Wtok4yqHgXy7A0-m633B3EyLcuOyfGy20UMtM,938
33
+ python_terminusgps-45.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
34
+ python_terminusgps-45.6.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
35
+ python_terminusgps-45.6.0.dist-info/RECORD,,
@@ -1,4 +1,3 @@
1
- from abc import ABC
2
1
  from functools import cached_property
3
2
  from typing import Callable
4
3
 
@@ -8,11 +7,14 @@ from django.core.exceptions import ImproperlyConfigured
8
7
  from lxml.objectify import ObjectifiedElement
9
8
 
10
9
  from .auth import get_environment, get_merchant_auth, get_validation_mode
11
- from .controllers import execute_controller
10
+ from .controllers import (
11
+ AuthorizenetControllerExecutionError,
12
+ execute_controller,
13
+ )
12
14
 
13
15
 
14
- class AuthorizenetService(ABC):
15
- """Base class for services that interact with the Authorizenet API."""
16
+ class AuthorizenetService:
17
+ """A service that safely interacts with the Authorizenet API."""
16
18
 
17
19
  REQUIRED_SETTINGS = (
18
20
  "MERCHANT_AUTH_ENVIRONMENT",
@@ -27,7 +29,7 @@ class AuthorizenetService(ABC):
27
29
  if not hasattr(settings, setting):
28
30
  raise ImproperlyConfigured(f"'{setting}' setting is required.")
29
31
 
30
- def call_api(self, func: Callable, *args, **kwargs) -> ObjectifiedElement:
32
+ def request(self, func: Callable, *args, **kwargs) -> ObjectifiedElement:
31
33
  """
32
34
  Calls the Authorizenet API function with arguments and returns the result.
33
35
 
@@ -35,14 +37,19 @@ class AuthorizenetService(ABC):
35
37
  :type func: ~typing.Callable
36
38
  :param args: Positional arguments for the API call.
37
39
  :param kwargs: Keyword arguments for the API call.
40
+ :raises ValueError: If any function arguments were invalid.
38
41
  :raises ~terminusgps.authorizenet.controllers.AuthorizenetControllerExecutionError: If the API call failed.
39
42
  :returns: The Authorizenet API call response.
40
43
  :rtype: ~lxml.objectify.ObjectifiedElement
41
44
 
42
45
  """
43
- request, controller_cls = func(*args, **kwargs)
44
- request.merchantAuthentication = self.merchantAuthentication
45
- return execute_controller(controller_cls(request), self.environment)
46
+ try:
47
+ request, controller_cls = func(*args, **kwargs)
48
+ request.merchantAuthentication = self.merchantAuthentication
49
+ controller = controller_cls(request)
50
+ return execute_controller(controller, self.environment)
51
+ except AuthorizenetControllerExecutionError | ValueError:
52
+ raise
46
53
 
47
54
  @cached_property
48
55
  def merchantAuthentication(self) -> merchantAuthenticationType: