python-terminusgps 43.3.0__tar.gz → 45.0.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 (75) hide show
  1. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/PKG-INFO +1 -1
  2. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/docs/source/authorizenet/api.rst +2 -2
  3. python_terminusgps-45.0.0/docs/source/authorizenet/auth.rst +22 -0
  4. python_terminusgps-45.0.0/docs/source/authorizenet/constants.rst +20 -0
  5. python_terminusgps-43.3.0/docs/source/authorizenet/controllers.rst → python_terminusgps-45.0.0/docs/source/authorizenet/exceptions.rst +2 -2
  6. python_terminusgps-45.0.0/docs/source/authorizenet/index.rst +32 -0
  7. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/docs/source/conf.py +5 -3
  8. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/docs/source/index.rst +7 -11
  9. python_terminusgps-45.0.0/docs/source/mixins.rst +5 -0
  10. python_terminusgps-45.0.0/docs/source/validators.rst +5 -0
  11. python_terminusgps-45.0.0/docs/source/wialon/constants.rst +31 -0
  12. python_terminusgps-45.0.0/docs/source/wialon/exceptions.rst +5 -0
  13. python_terminusgps-45.0.0/docs/source/wialon/index.rst +15 -0
  14. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/docs/source/wialon/items.rst +12 -7
  15. python_terminusgps-45.0.0/docs/source/wialon/session.rst +6 -0
  16. python_terminusgps-45.0.0/docs/source/wialon/usage.rst +70 -0
  17. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/pyproject.toml +1 -1
  18. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/api/address_profiles.py +19 -37
  19. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/api/customer_profiles.py +25 -45
  20. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/api/payment_profiles.py +22 -45
  21. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/api/subscriptions.py +25 -43
  22. python_terminusgps-45.0.0/terminusgps/authorizenet/api/transactions.py +2 -0
  23. python_terminusgps-45.0.0/terminusgps/authorizenet/auth.py +56 -0
  24. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/constants.py +21 -5
  25. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/controllers.py +3 -13
  26. python_terminusgps-43.3.0/terminusgps/django/settings.py → python_terminusgps-45.0.0/terminusgps/default_settings.py +5 -5
  27. python_terminusgps-45.0.0/terminusgps/validators.py +242 -0
  28. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/account.py +10 -10
  29. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/base.py +7 -7
  30. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/resource.py +3 -3
  31. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/retranslator.py +3 -21
  32. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/route.py +1 -1
  33. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/unit.py +5 -5
  34. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/unit_group.py +2 -2
  35. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/user.py +5 -5
  36. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/session.py +25 -22
  37. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/uv.lock +1 -1
  38. python_terminusgps-43.3.0/docs/source/authorizenet/auth.rst +0 -7
  39. python_terminusgps-43.3.0/docs/source/authorizenet/constants.rst +0 -12
  40. python_terminusgps-43.3.0/docs/source/authorizenet/index.rst +0 -15
  41. python_terminusgps-43.3.0/docs/source/authorizenet/validators.rst +0 -31
  42. python_terminusgps-43.3.0/docs/source/django/forms.rst +0 -65
  43. python_terminusgps-43.3.0/docs/source/django/index.rst +0 -13
  44. python_terminusgps-43.3.0/docs/source/django/mixins.rst +0 -31
  45. python_terminusgps-43.3.0/docs/source/django/settings.rst +0 -61
  46. python_terminusgps-43.3.0/docs/source/django/validators.rst +0 -6
  47. python_terminusgps-43.3.0/docs/source/wialon/index.rst +0 -11
  48. python_terminusgps-43.3.0/docs/source/wialon/session.rst +0 -37
  49. python_terminusgps-43.3.0/terminusgps/authorizenet/api/transactions.py +0 -79
  50. python_terminusgps-43.3.0/terminusgps/authorizenet/auth.py +0 -43
  51. python_terminusgps-43.3.0/terminusgps/django/forms/__init__.py +0 -0
  52. python_terminusgps-43.3.0/terminusgps/django/forms/renderer.py +0 -5
  53. python_terminusgps-43.3.0/terminusgps/django/validators.py +0 -99
  54. python_terminusgps-43.3.0/terminusgps/wialon/__init__.py +0 -0
  55. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/.github/workflows/sphinx.yml +0 -0
  56. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/.gitignore +0 -0
  57. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/.python-version +0 -0
  58. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/COPYING +0 -0
  59. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/README.md +0 -0
  60. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/docs/Makefile +0 -0
  61. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/docs/make.bat +0 -0
  62. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/docs/requirements.txt +0 -0
  63. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/docs/source/authorizenet/usage.rst +0 -0
  64. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/__init__.py +0 -0
  65. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/__init__.py +0 -0
  66. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/api/__init__.py +0 -0
  67. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/validators.py +0 -0
  68. {python_terminusgps-43.3.0/terminusgps/django → python_terminusgps-45.0.0/terminusgps}/mixins.py +0 -0
  69. {python_terminusgps-43.3.0/terminusgps/django → python_terminusgps-45.0.0/terminusgps/wialon}/__init__.py +0 -0
  70. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/constants.py +0 -0
  71. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/flags.py +0 -0
  72. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/__init__.py +0 -0
  73. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/factory.py +0 -0
  74. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/utils.py +0 -0
  75. {python_terminusgps-43.3.0 → python_terminusgps-45.0.0}/terminusgps/wialon/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 43.3.0
3
+ Version: 45.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
@@ -1,5 +1,5 @@
1
- Authorizenet API Endpoints
2
- ==========================
1
+ Functions
2
+ =========
3
3
 
4
4
  ================
5
5
  Address Profiles
@@ -0,0 +1,22 @@
1
+ Authentication
2
+ ==============
3
+
4
+ Authentication for each Authorizenet API call is handled by values defined in a Django ``settings.py`` module.
5
+
6
+ Required settings:
7
+
8
+ +-----------------------------------+---------------+
9
+ | setting | type |
10
+ +===================================+===============+
11
+ | ``MERCHANT_AUTH_ENVIRONMENT`` | :py:obj:`str` |
12
+ +-----------------------------------+---------------+
13
+ | ``MERCHANT_AUTH_LOGIN_ID`` | :py:obj:`str` |
14
+ +-----------------------------------+---------------+
15
+ | ``MERCHANT_AUTH_TRANSACTION_KEY`` | :py:obj:`str` |
16
+ +-----------------------------------+---------------+
17
+ | ``MERCHANT_AUTH_VALIDATION_MODE`` | :py:obj:`str` |
18
+ +-----------------------------------+---------------+
19
+
20
+ .. automodule:: terminusgps.authorizenet.auth
21
+ :synopsis: Provides functions for authenticating Authorizenet API calls.
22
+ :members:
@@ -0,0 +1,20 @@
1
+ Constants
2
+ =========
3
+
4
+ These constants inherit from :py:obj:`~django.db.models.TextChoices`, not the built-in Python :py:obj:`~enum.StrEnum` type.
5
+
6
+ Django :py:obj:`~django.db.models.TextChoices` provides attributes such as :py:attr:`~django.db.models.TextChoices.choices`, :py:attr:`~django.db.models.TextChoices.values`, :py:attr:`~django.db.models.TextChoices.labels` and more.
7
+
8
+ .. py:currentmodule:: terminusgps.authorizenet.constants
9
+
10
+ .. autoclass:: Environment
11
+ :members:
12
+
13
+ .. autoclass:: SubscriptionStatus
14
+ :members:
15
+
16
+ .. autoclass:: SubscriptionIntervalUnit
17
+ :members:
18
+
19
+ .. autoclass:: ValidationMode
20
+ :members:
@@ -1,4 +1,4 @@
1
- API Controllers
2
- ===============
1
+ Exceptions
2
+ ==========
3
3
 
4
4
  .. autoexception:: terminusgps.authorizenet.controllers.AuthorizenetControllerExecutionError
@@ -0,0 +1,32 @@
1
+ Authorizenet
2
+ ============
3
+
4
+ The :py:mod:`terminusgps.authorizenet` package provides convenient functions for interacting with the Authorizenet API in a Pythonic interface.
5
+
6
+ Most `Authorizenet API endpoints <https://developer.authorize.net/api/reference/index.html>`_ are represented as plain Python functions.
7
+
8
+ .. attention:: These functions require the following settings to be present in your Django project's ``settings.py`` module.
9
+
10
+ Using this package without setting these settings will raise :py:exc:`~django.core.exceptions.ImproperlyConfigured`.
11
+
12
+ +-----------------------------------+---------------+
13
+ | setting | type |
14
+ +===================================+===============+
15
+ | ``MERCHANT_AUTH_ENVIRONMENT`` | :py:obj:`str` |
16
+ +-----------------------------------+---------------+
17
+ | ``MERCHANT_AUTH_LOGIN_ID`` | :py:obj:`str` |
18
+ +-----------------------------------+---------------+
19
+ | ``MERCHANT_AUTH_TRANSACTION_KEY`` | :py:obj:`str` |
20
+ +-----------------------------------+---------------+
21
+ | ``MERCHANT_AUTH_VALIDATION_MODE`` | :py:obj:`str` |
22
+ +-----------------------------------+---------------+
23
+
24
+ .. toctree::
25
+ :maxdepth: 2
26
+ :caption: Contents:
27
+
28
+ auth.rst
29
+ constants.rst
30
+ exceptions.rst
31
+ api.rst
32
+ usage.rst
@@ -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 = "43.3.0"
15
+ release = "45.0.0"
16
16
 
17
17
  # -- General configuration ---------------------------------------------------
18
18
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -28,8 +28,8 @@ extensions = [
28
28
  intersphinx_mapping = {
29
29
  "python": ("https://docs.python.org/3/", None),
30
30
  "django": (
31
- "http://docs.djangoproject.com/en/stable/",
32
- "http://docs.djangoproject.com/en/stable/_objects/",
31
+ "https://docs.djangoproject.com/en/5.2/",
32
+ "https://docs.djangoproject.com/en/5.2/objects.inv",
33
33
  ),
34
34
  }
35
35
 
@@ -40,7 +40,9 @@ exclude_patterns = []
40
40
  # -- Options for HTML output -------------------------------------------------
41
41
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
42
42
 
43
+ autodoc_member_order = "groupwise"
43
44
  html_theme = "sphinxawesome_theme"
44
45
  pygments_style = "sas"
45
46
  pygments_style_dark = "lightbulb"
46
47
  html_static_path = ["_static"]
48
+ graphviz_dot = "/usr/bin/dot"
@@ -6,9 +6,11 @@
6
6
  python-terminusgps documentation
7
7
  ================================
8
8
 
9
- `python-terminusgps <https://pypi.org/project/python-terminusgps>`_ is a package [#f1]_ of subpackages that streamlines the use of web APIs for Terminus GPS developers.
9
+ `python-terminusgps <https://pypi.org/project/python-terminusgps>`_ is a Python package [#f1]_ that streamlines the use of web APIs for Terminus GPS developers.
10
10
 
11
- `Terminus GPS <https://terminusgps.com/>`_ is an IoT hardware/software GPS monitoring company.
11
+ `Terminus GPS <https://terminusgps.com/>`_ is an IoT software/hardware GPS monitoring company.
12
+
13
+ Commonly written and repeated Python code used in Terminus GPS Django projects is accessible from the :py:mod:`terminusgps` package, e.g. :py:obj:`~terminusgps.mixins.HtmxTemplateResponseMixin` for HTMX-enabled Django views and :py:obj:`~terminusgps.validators.validate_e164_phone_number` for validating Django model/form fields.
12
14
 
13
15
  .. [#f1] In other programming languages, the term "library" is used to describe what Python calls a "package". Put simply, a "package" is a Python "library".
14
16
 
@@ -16,23 +18,17 @@ python-terminusgps documentation
16
18
  Installation
17
19
  ============
18
20
 
19
-
20
21
  Use pip to install from `PyPI <https://pypi.org/project/python-terminusgps/>`_.
21
22
 
22
23
  .. code:: bash
23
24
 
24
- pip install python-terminusgps
25
-
26
- All subpackages are nested within :py:mod:`terminusgps`:
27
-
28
- .. code:: python
29
-
30
- from terminusgps.wialon.session import WialonSession # Creates Wialon API sessions
25
+ pip install python-terminusgps
31
26
 
32
27
  .. toctree::
33
28
  :maxdepth: 2
34
29
  :caption: Contents:
35
30
 
36
31
  authorizenet/index.rst
37
- django/index.rst
32
+ mixins.rst
33
+ validators.rst
38
34
  wialon/index.rst
@@ -0,0 +1,5 @@
1
+ Mixins
2
+ ======
3
+
4
+ .. autoclass:: terminusgps.mixins.HtmxTemplateResponseMixin
5
+ :members:
@@ -0,0 +1,5 @@
1
+ Validators
2
+ ==========
3
+
4
+ .. automodule:: terminusgps.validators
5
+ :members:
@@ -0,0 +1,31 @@
1
+ Constants
2
+ =========
3
+
4
+ .. currentmodule:: terminusgps.wialon.constants
5
+
6
+ .. autoclass:: WialonLogAction
7
+ :members:
8
+
9
+ .. autodata:: ACCESSMASK_RESOURCE_BASIC
10
+
11
+ .. autodata:: ACCESSMASK_UNIT_BASIC
12
+
13
+ .. autodata:: ACCESSMASK_UNIT_MIGRATION
14
+
15
+ .. currentmodule:: terminusgps.wialon.flags
16
+
17
+ .. autoclass:: AccessFlag
18
+ :members:
19
+ :member-order: bysource
20
+
21
+ .. autoclass:: DataFlag
22
+ :members:
23
+ :member-order: bysource
24
+
25
+ .. autoclass:: SettingsFlag
26
+ :members:
27
+ :member-order: bysource
28
+
29
+ .. autoclass:: TokenFlag
30
+ :members:
31
+ :member-order: bysource
@@ -0,0 +1,5 @@
1
+ Exceptions
2
+ ==========
3
+
4
+ .. autoexception:: terminusgps.wialon.session.WialonAPIError
5
+ :members:
@@ -0,0 +1,15 @@
1
+ Wialon
2
+ ======
3
+ The :py:mod:`terminusgps.wialon` package provides a Pythonic interface for interacting with the Wialon API.
4
+
5
+ Most Wialon objects are modeled as plain Python classes which have methods that make `Wialon API calls <https://help.wialon.com/en/api/user-guide/api-reference>`_.
6
+
7
+ .. toctree::
8
+ :maxdepth: 2
9
+ :caption: Contents:
10
+
11
+ constants.rst
12
+ exceptions.rst
13
+ items.rst
14
+ session.rst
15
+ usage.rst
@@ -9,38 +9,43 @@ Base
9
9
  :autoclasstoc:
10
10
  :members:
11
11
 
12
- =======
13
- Factory
14
- =======
12
+ =========
13
+ Factories
14
+ =========
15
15
 
16
16
  .. autoclass:: terminusgps.wialon.items.factory.WialonObjectFactory
17
17
  :autoclasstoc:
18
- :members:
18
+
19
19
 
20
20
  ==============
21
21
  Wialon objects
22
22
  ==============
23
23
 
24
24
  .. autoclass:: terminusgps.wialon.items.account.WialonAccount
25
+ :autoclasstoc:
25
26
  :members:
26
27
 
27
28
  .. autoclass:: terminusgps.wialon.items.resource.WialonResource
29
+ :autoclasstoc:
28
30
  :members:
29
31
 
30
32
  .. autoclass:: terminusgps.wialon.items.retranslator.WialonRetranslator
31
- :members:
32
-
33
- .. autoclass:: terminusgps.wialon.items.retranslator.WialonRetranslatorConfiguration
33
+ :autoclasstoc:
34
34
  :members:
35
35
 
36
36
  .. autoclass:: terminusgps.wialon.items.route.WialonRoute
37
+ :autoclasstoc:
37
38
  :members:
38
39
 
39
40
  .. autoclass:: terminusgps.wialon.items.unit.WialonUnit
41
+ :autoclasstoc:
40
42
  :members:
41
43
 
42
44
  .. autoclass:: terminusgps.wialon.items.unit_group.WialonUnitGroup
45
+ :autoclasstoc:
43
46
  :members:
44
47
 
45
48
  .. autoclass:: terminusgps.wialon.items.user.WialonUser
49
+ :autoclasstoc:
46
50
  :members:
51
+
@@ -0,0 +1,6 @@
1
+ Sessions
2
+ ========
3
+
4
+ .. autoclass:: terminusgps.wialon.session.WialonSession
5
+ :members:
6
+ :class-doc-from: init
@@ -0,0 +1,70 @@
1
+ Usage
2
+ =====
3
+
4
+ To perform Wialon API operations, open a :py:obj:`~terminusgps.wialon.session.WialonSession` in a context manager, passing in your desired Wialon API token to use during the session's lifetime.
5
+
6
+ If :py:data:`token` isn't provided, the environment variable ``"WIALON_TOKEN"`` is passed instead.
7
+
8
+ .. code:: python
9
+
10
+ from terminusgps.wialon.session import WialonSession
11
+
12
+ # Context manager handles logging in and out of the Wialon API session
13
+ with WialonSession(token="my_wialon_api_token") as session:
14
+ # Perform Wialon API calls within this block
15
+ # Session is logged out when the interpreter exits this block
16
+ session.wialon_api.core_search_item(**{"id": 123, "flags": 0x1})
17
+
18
+ # Will raise WialonAPIError because the session is now invalid (logged out)
19
+ session.wialon_api.core_search_item(**{"id": 123, "flags": 0x1})
20
+
21
+ Instead of remembering every `Wialon API endpoint <https://help.wialon.com/en/api/user-guide/api-reference>`_, initialize a :py:obj:`~terminusgps.wialon.items.factory.WialonObjectFactory` in a :py:obj:`~terminusgps.wialon.session.WialonSession` to retrieve objects with convenient methods for calling the Wialon API:
22
+
23
+ .. code:: python
24
+
25
+ from terminusgps.wialon.items import WialonObjectFactory
26
+ from terminusgps.wialon.session import WialonSession
27
+
28
+ with WialonSession(token="my_wialon_api_token") as session:
29
+ # A valid Wialon API session is the only argument passed to the factory
30
+ factory = WialonObjectFactory(session)
31
+ # Call get() or create() on the factory to retrieve a WialonObject instance
32
+ # The 'items_type' argument mirrors Wialon's definition of Wialon objects, e.g. 'avl_unit' for WialonUnit, 'avl_resource' for WialonResource, etc.
33
+ unit = factory.get("avl_unit", 123)
34
+ # Refer to your IDE or this documentation for available attributes and methods of each Wialon object type.
35
+
36
+ ========
37
+ Examples
38
+ ========
39
+
40
+ Creating a new Wialon user
41
+ --------------------------
42
+
43
+ .. code:: python
44
+
45
+ from terminusgps.wialon.items import WialonObjectFactory
46
+ from terminusgps.wialon.session import WialonSession
47
+
48
+ with WialonSession() as session:
49
+ factory = WialonObjectFactory(session)
50
+ user = factory.create(
51
+ "user",
52
+ creator_id=12345678,
53
+ name="New User",
54
+ password="my_secure_password!1",
55
+ )
56
+
57
+ .. seealso:: :py:meth:`~terminusgps.wialon.items.user.WialonUser.create` for details on creating a Wialon user.
58
+
59
+ Update an existing Wialon user's name
60
+ -------------------------------------
61
+
62
+ .. code:: python
63
+
64
+ from terminusgps.wialon.items import WialonObjectFactory
65
+ from terminusgps.wialon.session import WialonSession
66
+
67
+ with WialonSession() as session:
68
+ factory = WialonObjectFactory(session)
69
+ user = factory.get("user", id=12345678)
70
+ user.set_name("New User")
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-terminusgps"
3
- version = "43.3.0"
3
+ version = "45.0.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" } ]
@@ -1,9 +1,7 @@
1
1
  from authorizenet import apicontractsv1, apicontrollers
2
+ from authorizenet.apicontrollersbase import APIOperationBase
2
3
  from lxml.objectify import ObjectifiedElement
3
4
 
4
- from terminusgps.authorizenet.auth import get_merchant_auth
5
- from terminusgps.authorizenet.controllers import execute_controller
6
-
7
5
  __all__ = [
8
6
  "create_customer_shipping_address",
9
7
  "get_customer_shipping_address",
@@ -16,7 +14,7 @@ def create_customer_shipping_address(
16
14
  customer_profile_id: int,
17
15
  address: apicontractsv1.customerAddressType,
18
16
  default: bool = False,
19
- ) -> ObjectifiedElement | None:
17
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
20
18
  """
21
19
  `createCustomerShippingAddressRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-shipping-address>`_.
22
20
 
@@ -24,26 +22,22 @@ def create_customer_shipping_address(
24
22
  :type customer_profile_id: int
25
23
  :param address: An Authorizenet customer address element.
26
24
  :type address: ~authorizenet.apicontractsv1.customerAddressType
27
- :param default: Whether to set the address profile as default. Default is False.
25
+ :param default: Whether to set the address profile as default. Default is :py:obj:`False`.
28
26
  :type default: bool
29
- :returns: An Authorizenet createCustomerShippingAddressResponse element.
30
- :rtype: ~lxml.objectify.ObjectifiedElement | None
27
+ :returns: A tuple containing an Authorizenet API request element and controller class.
28
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
31
29
 
32
30
  """
33
31
  request = apicontractsv1.createCustomerShippingAddressRequest()
34
- request.merchantAuthentication = get_merchant_auth()
35
32
  request.customerProfileId = str(customer_profile_id)
36
33
  request.address = address
37
34
  request.defaultShippingAddress = str(default).lower()
38
-
39
- return execute_controller(
40
- apicontrollers.createCustomerShippingAddressController(request)
41
- )
35
+ return request, apicontrollers.createCustomerShippingAddressController
42
36
 
43
37
 
44
38
  def get_customer_shipping_address(
45
39
  customer_profile_id: int, address_profile_id: int
46
- ) -> ObjectifiedElement | None:
40
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
47
41
  """
48
42
  `getCustomerShippingAddressRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-get-customer-shipping-address>`_.
49
43
 
@@ -51,25 +45,21 @@ def get_customer_shipping_address(
51
45
  :type customer_profile_id: int
52
46
  :param address_profile_id: An Authorizenet customer address profile id.
53
47
  :type address_profile_id: int
54
- :returns: An Authorizenet getCustomerShippingAddressResponse element.
55
- :rtype: ~lxml.objectify.ObjectifiedElement | None
48
+ :returns: A tuple containing an Authorizenet API request element and controller class.
49
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
56
50
 
57
51
  """
58
52
  request = apicontractsv1.getCustomerShippingAddressRequest()
59
- request.merchantAuthentication = get_merchant_auth()
60
53
  request.customerProfileId = str(customer_profile_id)
61
54
  request.customerAddressId = str(address_profile_id)
62
-
63
- return execute_controller(
64
- apicontrollers.getCustomerShippingAddressController(request)
65
- )
55
+ return request, apicontrollers.getCustomerShippingAddressController
66
56
 
67
57
 
68
58
  def update_customer_shipping_address(
69
59
  customer_profile_id: int,
70
60
  address: apicontractsv1.customerAddressType,
71
61
  default: bool = False,
72
- ) -> ObjectifiedElement | None:
62
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
73
63
  """
74
64
  `updateCustomerShippingAddressRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-shipping-address>`_.
75
65
 
@@ -77,26 +67,22 @@ def update_customer_shipping_address(
77
67
  :type customer_profile_id: int
78
68
  :param address: An Authorizenet customer address element.
79
69
  :type address: ~authorizenet.apicontractsv1.customerAddressType
80
- :param default: Whether to set the address profile as default. Default is False.
70
+ :param default: Whether to set the address profile as default. Default is :py:obj:`False`.
81
71
  :type default: bool
82
- :returns: An Authorizenet updateCustomerShippingAddressResponse element.
83
- :rtype: ~lxml.objectify.ObjectifiedElement | None
72
+ :returns: A tuple containing an Authorizenet API request element and controller class.
73
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
84
74
 
85
75
  """
86
76
  request = apicontractsv1.updateCustomerShippingAddressRequest()
87
- request.merchantAuthentication = get_merchant_auth()
88
77
  request.customerProfileId = str(customer_profile_id)
89
78
  request.address = address
90
79
  request.defaultShippingAddress = str(default).lower()
91
-
92
- return execute_controller(
93
- apicontrollers.updateCustomerShippingAddressController(request)
94
- )
80
+ return request, apicontrollers.updateCustomerShippingAddressController
95
81
 
96
82
 
97
83
  def delete_customer_shipping_address(
98
84
  customer_profile_id: int, address_profile_id: int
99
- ) -> ObjectifiedElement | None:
85
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
100
86
  """
101
87
  `deleteCustomerShippingAddressRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-delete-customer-shipping-address>`_.
102
88
 
@@ -104,15 +90,11 @@ def delete_customer_shipping_address(
104
90
  :type customer_profile_id: int
105
91
  :param address_profile_id: An Authorizenet customer address profile id.
106
92
  :type address_profile_id: int
107
- :returns: An Authorizenet deleteCustomerShippingAddressResponse element.
108
- :rtype: ~lxml.objectify.ObjectifiedElement | None
93
+ :returns: A tuple containing an Authorizenet API request element and controller class.
94
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
109
95
 
110
96
  """
111
97
  request = apicontractsv1.deleteCustomerShippingAddressRequest()
112
- request.merchantAuthentication = get_merchant_auth()
113
98
  request.customerProfileId = str(customer_profile_id)
114
99
  request.customerAddressId = str(address_profile_id)
115
-
116
- return execute_controller(
117
- apicontrollers.deleteCustomerShippingAddressController(request)
118
- )
100
+ return request, apicontrollers.deleteCustomerShippingAddressController
@@ -1,9 +1,7 @@
1
1
  from authorizenet import apicontractsv1, apicontrollers
2
+ from authorizenet.apicontrollersbase import APIOperationBase
2
3
  from lxml.objectify import ObjectifiedElement
3
4
 
4
- from terminusgps.authorizenet.auth import get_merchant_auth
5
- from terminusgps.authorizenet.controllers import execute_controller
6
-
7
5
  __all__ = [
8
6
  "create_customer_profile",
9
7
  "get_customer_profile",
@@ -15,7 +13,7 @@ __all__ = [
15
13
 
16
14
  def create_customer_profile(
17
15
  merchant_id: str, email: str, description: str = ""
18
- ) -> ObjectifiedElement | None:
16
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
19
17
  """
20
18
  `createCustomerProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-profile>`_.
21
19
 
@@ -25,99 +23,81 @@ def create_customer_profile(
25
23
  :type email: str
26
24
  :param description: An optional customer description.
27
25
  :type description: str
28
- :returns: An Authorizenet createCustomerProfileResponse element.
29
- :rtype: ~lxml.objectify.ObjectifiedElement | None
26
+ :returns: A tuple containing an Authorizenet API request element and controller class.
27
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
30
28
 
31
29
  """
32
30
  request = apicontractsv1.createCustomerProfileRequest()
33
- request.merchantAuthentication = get_merchant_auth()
34
31
  request.profile = apicontractsv1.customerProfileType()
35
32
  request.profile.merchantCustomerId = merchant_id
36
33
  request.profile.description = description
37
34
  request.profile.email = email
38
-
39
- return execute_controller(
40
- apicontrollers.createCustomerProfileController(request)
41
- )
35
+ return request, apicontrollers.createCustomerProfileController
42
36
 
43
37
 
44
38
  def get_customer_profile(
45
39
  customer_profile_id: int, include_issuer_info: bool = False
46
- ) -> ObjectifiedElement | None:
40
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
47
41
  """
48
42
  `getCustomerProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-get-customer-profile>`_.
49
43
 
50
- :param customer_profile_id: An Authorizenet customer profile id.
44
+ :param customer_profile_id: Authorizenet customer profile id.
51
45
  :type customer_profile_id: int
52
- :param include_issuer_info: Whether to include issuer info in the response. Default is False.
46
+ :param include_issuer_info: Whether to include issuer info in the response. Default is :py:obj:`False`.
53
47
  :type include_issuer_info: bool
54
- :returns: An Authorizenet getCustomerProfileResponse element.
55
- :rtype: ~lxml.objectify.ObjectifiedElement | None
48
+ :returns: A tuple containing an Authorizenet API request element and controller class.
49
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
56
50
 
57
51
  """
58
52
  request = apicontractsv1.getCustomerProfileRequest()
59
- request.merchantAuthentication = get_merchant_auth()
60
53
  request.customerProfileId = str(customer_profile_id)
61
54
  request.includeIssuerInfo = str(include_issuer_info).lower()
62
-
63
- return execute_controller(
64
- apicontrollers.getCustomerProfileController(request)
65
- )
55
+ return request, apicontrollers.getCustomerProfileController
66
56
 
67
57
 
68
- def get_customer_profile_ids() -> ObjectifiedElement | None:
58
+ def get_customer_profile_ids() -> tuple[
59
+ ObjectifiedElement, type[APIOperationBase]
60
+ ]:
69
61
  """
70
62
  `getCustomerProfileIdsRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-get-customer-profile-ids>`_.
71
63
 
72
- :returns: An Authorizenet getCustomerProfileIdsResponse element.
73
- :rtype: ~lxml.objectify.ObjectifiedElement | None
64
+ :returns: A tuple containing an Authorizenet API request element and controller class.
65
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
74
66
 
75
67
  """
76
68
  request = apicontractsv1.getCustomerProfileIdsRequest()
77
- request.merchantAuthentication = get_merchant_auth()
78
-
79
- return execute_controller(
80
- apicontrollers.getCustomerProfileIdsController(request)
81
- )
69
+ return request, apicontrollers.getCustomerProfileIdsController
82
70
 
83
71
 
84
72
  def update_customer_profile(
85
73
  profile: apicontractsv1.customerProfileExType,
86
- ) -> ObjectifiedElement | None:
74
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
87
75
  """
88
76
  `updateCustomerProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-profile>`_.
89
77
 
90
78
  :param profile: An Authorizenet customer profile ex element.
91
79
  :type profile: ~authorizenet.apicontractsv1.customerProfileExType
92
- :returns: An Authorizenet updateCustomerProfileResponse element.
93
- :rtype: ~lxml.objectify.ObjectifiedElement | None
80
+ :returns: A tuple containing an Authorizenet API request element and controller class.
81
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
94
82
 
95
83
  """
96
84
  request = apicontractsv1.updateCustomerProfileRequest()
97
- request.merchantAuthentication = get_merchant_auth()
98
85
  request.profile = profile
99
-
100
- return execute_controller(
101
- apicontrollers.updateCustomerProfileController(request)
102
- )
86
+ return request, apicontrollers.updateCustomerProfileController
103
87
 
104
88
 
105
89
  def delete_customer_profile(
106
90
  customer_profile_id: int,
107
- ) -> ObjectifiedElement | None:
91
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
108
92
  """
109
93
  `deleteCustomerProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-delete-customer-profile>`_.
110
94
 
111
95
  :param customer_profile_id: An Authorizenet customer profile id.
112
96
  :type customer_profile_id: int
113
- :returns: An Authorizenet deleteCustomerProfileResponse element.
114
- :rtype: ~lxml.objectify.ObjectifiedElement | None
97
+ :returns: A tuple containing an Authorizenet API request element and controller class.
98
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
115
99
 
116
100
  """
117
101
  request = apicontractsv1.deleteCustomerProfileRequest()
118
- request.merchantAuthentication = get_merchant_auth()
119
102
  request.customerProfileId = str(customer_profile_id)
120
-
121
- return execute_controller(
122
- apicontrollers.deleteCustomerProfileController(request)
123
- )
103
+ return request, apicontrollers.deleteCustomerProfileController