python-terminusgps 45.4.0__tar.gz → 45.6.0__tar.gz

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.
Files changed (58) hide show
  1. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/PKG-INFO +1 -1
  2. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/conf.py +1 -1
  3. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/pyproject.toml +1 -1
  4. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/authorizenet/api/payment_profiles.py +51 -12
  5. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/authorizenet/services.py +15 -8
  6. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/uv.lock +1 -1
  7. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/.github/workflows/sphinx.yml +0 -0
  8. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/.gitignore +0 -0
  9. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/.python-version +0 -0
  10. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/COPYING +0 -0
  11. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/README.md +0 -0
  12. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/Makefile +0 -0
  13. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/make.bat +0 -0
  14. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/requirements.txt +0 -0
  15. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/authorizenet/api.rst +0 -0
  16. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/authorizenet/auth.rst +0 -0
  17. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/authorizenet/constants.rst +0 -0
  18. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/authorizenet/exceptions.rst +0 -0
  19. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/authorizenet/index.rst +0 -0
  20. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/authorizenet/usage.rst +0 -0
  21. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/index.rst +0 -0
  22. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/mixins.rst +0 -0
  23. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/validators.rst +0 -0
  24. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/wialon/constants.rst +0 -0
  25. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/wialon/exceptions.rst +0 -0
  26. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/wialon/index.rst +0 -0
  27. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/wialon/items.rst +0 -0
  28. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/wialon/session.rst +0 -0
  29. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/docs/source/wialon/usage.rst +0 -0
  30. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/__init__.py +0 -0
  31. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/authorizenet/__init__.py +0 -0
  32. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/authorizenet/api/__init__.py +0 -0
  33. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/authorizenet/api/address_profiles.py +0 -0
  34. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/authorizenet/api/customer_profiles.py +0 -0
  35. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/authorizenet/api/subscriptions.py +0 -0
  36. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/authorizenet/api/transactions.py +0 -0
  37. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/authorizenet/auth.py +0 -0
  38. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/authorizenet/constants.py +0 -0
  39. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/authorizenet/controllers.py +0 -0
  40. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/default_settings.py +0 -0
  41. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/mixins.py +0 -0
  42. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/validators.py +0 -0
  43. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/__init__.py +0 -0
  44. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/constants.py +0 -0
  45. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/flags.py +0 -0
  46. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/items/__init__.py +0 -0
  47. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/items/account.py +0 -0
  48. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/items/base.py +0 -0
  49. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/items/factory.py +0 -0
  50. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/items/resource.py +0 -0
  51. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/items/retranslator.py +0 -0
  52. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/items/route.py +0 -0
  53. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/items/unit.py +0 -0
  54. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/items/unit_group.py +0 -0
  55. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/items/user.py +0 -0
  56. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/session.py +0 -0
  57. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/utils.py +0 -0
  58. {python_terminusgps-45.4.0 → python_terminusgps-45.6.0}/terminusgps/wialon/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 45.4.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
@@ -12,7 +12,7 @@ sys.path.insert(0, os.path.abspath("../../"))
12
12
  project = "python-terminusgps"
13
13
  copyright = "2025, Terminus GPS, LLC"
14
14
  author = "Terminus GPS, LLC"
15
- release = "45.4.0"
15
+ release = "45.6.0"
16
16
 
17
17
  # -- General configuration ---------------------------------------------------
18
18
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-terminusgps"
3
- version = "45.4.0"
3
+ version = "45.6.0"
4
4
  description = "Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more."
5
5
  readme = "README.md"
6
6
  authors = [ {name = "Blake Nall", email = "blake@terminusgps.com" } ]
@@ -13,23 +13,37 @@ __all__ = [
13
13
 
14
14
  def create_customer_payment_profile(
15
15
  customer_profile_id: int,
16
- payment_profile: apicontractsv1.customerPaymentProfileType,
16
+ payment: apicontractsv1.paymentType,
17
+ address: apicontractsv1.customerAddressType,
18
+ default: bool = False,
19
+ validation: str | None = None,
17
20
  ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
18
21
  """
19
22
  `createCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-payment-profile>`_.
20
23
 
21
24
  :param customer_profile_id: An Authorizenet customer profile id.
22
25
  :type customer_profile_id: int
23
- :param payment_profile: An Authorizenet payment profile element.
24
- :type payment_profile: ~authorizenet.apicontractsv1.customerPaymentProfileType
25
- :param validate: Whether to validate the payment profile. Default is True.
26
+ :param payment: An Authorizenet payment element.
27
+ :type payment: ~authorizenet.apicontractsv1.paymentType
28
+ :param address: An Authorizenet address element.
29
+ :type address: ~authorizenet.apicontractsv1.customerAddressType
30
+ :param default: Whether to set the payment profile as default. Default is :py:obj:`False`.
31
+ :type default: bool
32
+ :param validation: Validation mode to use when validating the payment profile. If not provided, the payment profile is not validated. Default is :py:obj:`None`.
33
+ :type validation: str | None
26
34
  :returns: A tuple containing an Authorizenet API request element and controller class.
27
35
  :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
28
36
 
29
37
  """
30
38
  request = apicontractsv1.createCustomerPaymentProfileRequest()
31
39
  request.customerProfileId = str(customer_profile_id)
32
- request.paymentProfile = payment_profile
40
+ request.paymentProfile = apicontractsv1.customerPaymentProfileType()
41
+ request.paymentProfile.payment = payment
42
+ request.paymentProfile.billTo = address
43
+ request.paymentProfile.defaultPaymentProfile = str(default).lower()
44
+
45
+ if validation is not None:
46
+ request.validationMode = str(validation)
33
47
  return request, apicontrollers.createCustomerPaymentProfileController
34
48
 
35
49
 
@@ -59,7 +73,7 @@ def get_customer_payment_profile(
59
73
 
60
74
 
61
75
  def validate_customer_payment_profile(
62
- customer_profile_id: int, payment_profile_id: int
76
+ customer_profile_id: int, payment_profile_id: int, validation: str
63
77
  ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
64
78
  """
65
79
  `validateCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-validate-customer-payment-profile>`_.
@@ -68,6 +82,8 @@ def validate_customer_payment_profile(
68
82
  :type customer_profile_id: int
69
83
  :param payment_profile_id: An Authorizenet customer payment profile id.
70
84
  :type payment_profile_id: int
85
+ :param validation: Validation mode to use when validating the payment profile.
86
+ :type validation: str
71
87
  :returns: A tuple containing an Authorizenet API request element and controller class.
72
88
  :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
73
89
 
@@ -75,13 +91,17 @@ def validate_customer_payment_profile(
75
91
  request = apicontractsv1.validateCustomerPaymentProfileRequest()
76
92
  request.customerProfileId = str(customer_profile_id)
77
93
  request.customerPaymentProfileId = str(payment_profile_id)
94
+ request.validationMode = validation
78
95
  return request, apicontrollers.validateCustomerPaymentProfileController
79
96
 
80
97
 
81
98
  def update_customer_payment_profile(
82
99
  customer_profile_id: int,
83
100
  payment_profile_id: int,
84
- payment_profile: apicontractsv1.customerPaymentProfileType,
101
+ payment: apicontractsv1.paymentType | None = None,
102
+ address: apicontractsv1.customerAddressType | None = None,
103
+ default: bool | None = None,
104
+ validation: str | None = None,
85
105
  ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
86
106
  """
87
107
  `updateCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-payment-profile>`_.
@@ -90,18 +110,37 @@ def update_customer_payment_profile(
90
110
  :type customer_profile_id: int
91
111
  :param payment_profile_id: An Authorizenet customer payment profile id.
92
112
  :type payment_profile_id: int
93
- :param payment_profile: An Authorizenet payment profile element.
94
- :type payment_profile: ~authorizenet.apicontractsv1.customerPaymentProfileType
113
+ :param payment: An Authorizenet payment element.
114
+ :type payment: ~authorizenet.apicontractsv1.paymentType | None
115
+ :param address: An Authorizenet address element.
116
+ :type address: ~authorizenet.apicontractsv1.customerAddressType | None
117
+ :param default: Whether to set the payment profile as default. If not provided, the payment profile's default state is not updated. Default is :py:obj:`None`.
118
+ :type default: bool | None
119
+ :param validation: Validation mode to use when validating the payment profile. If not provided, the payment profile is not validated. Default is :py:obj:`None`.
120
+ :type validation: str | None
121
+ :raises ValueError: If neither payment nor address was provided.
95
122
  :returns: A tuple containing an Authorizenet API request element and controller class.
96
123
  :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
97
124
 
98
125
  """
99
- if not hasattr(payment_profile, "customerPaymentProfileId"):
100
- payment_profile.customerPaymentProfileId = str(payment_profile_id)
126
+ if payment is None and address is None:
127
+ raise ValueError(
128
+ f"At least one of 'payment' or 'address' is required, got '{payment}' and '{address}'."
129
+ )
101
130
 
102
131
  request = apicontractsv1.updateCustomerPaymentProfileRequest()
103
132
  request.customerProfileId = str(customer_profile_id)
104
- request.paymentProfile = payment_profile
133
+ request.paymentProfile = apicontractsv1.customerPaymentProfileType()
134
+ request.paymentProfile.customerPaymentProfileId = str(payment_profile_id)
135
+
136
+ if payment is not None:
137
+ request.paymentProfile.payment = payment
138
+ if address is not None:
139
+ request.paymentProfile.billTo = address
140
+ if default is not None:
141
+ request.paymentProfile.defaultPaymentProfile = str(default).lower()
142
+ if validation is not None:
143
+ request.validationMode = str(validation)
105
144
  return request, apicontrollers.updateCustomerPaymentProfileController
106
145
 
107
146
 
@@ -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:
@@ -298,7 +298,7 @@ wheels = [
298
298
 
299
299
  [[package]]
300
300
  name = "python-terminusgps"
301
- version = "45.4.0"
301
+ version = "45.6.0"
302
302
  source = { editable = "." }
303
303
  dependencies = [
304
304
  { name = "authorizenet" },