python-terminusgps 44.0.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 (60) hide show
  1. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/PKG-INFO +1 -1
  2. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/authorizenet/index.rst +1 -2
  3. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/conf.py +1 -1
  4. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/index.rst +3 -1
  5. python_terminusgps-45.0.0/docs/source/wialon/constants.rst +31 -0
  6. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/wialon/index.rst +3 -2
  7. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/pyproject.toml +1 -1
  8. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/api/address_profiles.py +19 -37
  9. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/api/customer_profiles.py +25 -45
  10. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/api/payment_profiles.py +22 -45
  11. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/api/subscriptions.py +25 -43
  12. python_terminusgps-45.0.0/terminusgps/authorizenet/api/transactions.py +2 -0
  13. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/controllers.py +3 -2
  14. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/validators.py +35 -12
  15. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/uv.lock +1 -1
  16. python_terminusgps-44.0.0/docs/source/authorizenet/validators.rst +0 -31
  17. python_terminusgps-44.0.0/terminusgps/authorizenet/api/transactions.py +0 -79
  18. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/.github/workflows/sphinx.yml +0 -0
  19. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/.gitignore +0 -0
  20. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/.python-version +0 -0
  21. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/COPYING +0 -0
  22. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/README.md +0 -0
  23. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/Makefile +0 -0
  24. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/make.bat +0 -0
  25. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/requirements.txt +0 -0
  26. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/authorizenet/api.rst +0 -0
  27. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/authorizenet/auth.rst +0 -0
  28. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/authorizenet/constants.rst +0 -0
  29. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/authorizenet/exceptions.rst +0 -0
  30. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/authorizenet/usage.rst +0 -0
  31. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/mixins.rst +0 -0
  32. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/validators.rst +0 -0
  33. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/wialon/exceptions.rst +0 -0
  34. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/wialon/items.rst +0 -0
  35. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/wialon/session.rst +0 -0
  36. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/docs/source/wialon/usage.rst +0 -0
  37. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/__init__.py +0 -0
  38. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/__init__.py +0 -0
  39. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/api/__init__.py +0 -0
  40. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/auth.py +0 -0
  41. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/constants.py +0 -0
  42. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/authorizenet/validators.py +0 -0
  43. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/default_settings.py +0 -0
  44. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/mixins.py +0 -0
  45. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/__init__.py +0 -0
  46. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/constants.py +0 -0
  47. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/flags.py +0 -0
  48. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/__init__.py +0 -0
  49. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/account.py +0 -0
  50. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/base.py +0 -0
  51. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/factory.py +0 -0
  52. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/resource.py +0 -0
  53. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/retranslator.py +0 -0
  54. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/route.py +0 -0
  55. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/unit.py +0 -0
  56. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/unit_group.py +0 -0
  57. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/items/user.py +0 -0
  58. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/session.py +0 -0
  59. {python_terminusgps-44.0.0 → python_terminusgps-45.0.0}/terminusgps/wialon/utils.py +0 -0
  60. {python_terminusgps-44.0.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: 44.0.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
@@ -25,9 +25,8 @@ Most `Authorizenet API endpoints <https://developer.authorize.net/api/reference/
25
25
  :maxdepth: 2
26
26
  :caption: Contents:
27
27
 
28
- api.rst
29
28
  auth.rst
30
29
  constants.rst
31
30
  exceptions.rst
31
+ api.rst
32
32
  usage.rst
33
- validators.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 = "44.0.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
@@ -6,10 +6,12 @@
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
11
  `Terminus GPS <https://terminusgps.com/>`_ is an IoT software/hardware GPS monitoring company.
12
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.
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
 
15
17
  ============
@@ -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
@@ -2,13 +2,14 @@ Wialon
2
2
  ======
3
3
  The :py:mod:`terminusgps.wialon` package provides a Pythonic interface for interacting with the Wialon API.
4
4
 
5
- Most Wialon objects are modeled as plain Python objects which have attributes and methods that make `Wialon API calls <https://help.wialon.com/en/api/user-guide/api-reference>`_.
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
6
 
7
7
  .. toctree::
8
8
  :maxdepth: 2
9
9
  :caption: Contents:
10
10
 
11
- items.rst
11
+ constants.rst
12
12
  exceptions.rst
13
+ items.rst
13
14
  session.rst
14
15
  usage.rst
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-terminusgps"
3
- version = "44.0.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
@@ -1,11 +1,8 @@
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 (
5
- get_merchant_auth,
6
- get_validation_mode,
7
- )
8
- from terminusgps.authorizenet.controllers import execute_controller
5
+ from terminusgps.authorizenet.auth import get_validation_mode
9
6
 
10
7
  __all__ = [
11
8
  "create_customer_payment_profile",
@@ -20,7 +17,7 @@ def create_customer_payment_profile(
20
17
  customer_profile_id: int,
21
18
  payment_profile: apicontractsv1.customerPaymentProfileType,
22
19
  validate: bool = True,
23
- ) -> ObjectifiedElement | None:
20
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
24
21
  """
25
22
  `createCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-payment-profile>`_.
26
23
 
@@ -29,27 +26,23 @@ def create_customer_payment_profile(
29
26
  :param payment_profile: An Authorizenet payment profile element.
30
27
  :type payment_profile: ~authorizenet.apicontractsv1.customerPaymentProfileType
31
28
  :param validate: Whether to validate the payment profile. Default is True.
32
- :returns: An Authorizenet createCustomerPaymentProfileResponse element.
33
- :rtype: ~lxml.objectify.ObjectifiedElement | None
29
+ :returns: A tuple containing an Authorizenet API request element and controller class.
30
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
34
31
 
35
32
  """
36
33
  request = apicontractsv1.createCustomerPaymentProfileRequest()
37
- request.merchantAuthentication = get_merchant_auth()
38
34
  request.customerProfileId = str(customer_profile_id)
39
35
  request.paymentProfile = payment_profile
40
36
  if validate:
41
37
  request.validationMode = get_validation_mode()
42
-
43
- return execute_controller(
44
- apicontrollers.createCustomerPaymentProfileController(request)
45
- )
38
+ return request, apicontrollers.createCustomerPaymentProfileController
46
39
 
47
40
 
48
41
  def get_customer_payment_profile(
49
42
  customer_profile_id: int,
50
43
  payment_profile_id: int,
51
44
  include_issuer_info: bool = False,
52
- ) -> ObjectifiedElement | None:
45
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
53
46
  """
54
47
  `getCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-get-customer-payment-profile>`_.
55
48
 
@@ -59,24 +52,20 @@ def get_customer_payment_profile(
59
52
  :type payment_profile_id: int
60
53
  :param include_issuer_info: Whether to include issuer info in the response. Default is False.
61
54
  :type include_issuer_info: bool
62
- :returns: An Authorizenet getCustomerPaymentProfileResponse element.
63
- :rtype: ~lxml.objectify.ObjectifiedElement | None
55
+ :returns: A tuple containing an Authorizenet API request element and controller class.
56
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
64
57
 
65
58
  """
66
59
  request = apicontractsv1.getCustomerPaymentProfileRequest()
67
- request.merchantAuthentication = get_merchant_auth()
68
60
  request.customerProfileId = str(customer_profile_id)
69
61
  request.customerPaymentProfileId = str(payment_profile_id)
70
62
  request.includeIssuerInfo = str(include_issuer_info).lower()
71
-
72
- return execute_controller(
73
- apicontrollers.getCustomerPaymentProfileController(request)
74
- )
63
+ return request, apicontrollers.getCustomerPaymentProfileController
75
64
 
76
65
 
77
66
  def validate_customer_payment_profile(
78
67
  customer_profile_id: int, payment_profile_id: int
79
- ) -> ObjectifiedElement | None:
68
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
80
69
  """
81
70
  `validateCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-validate-customer-payment-profile>`_.
82
71
 
@@ -84,19 +73,15 @@ def validate_customer_payment_profile(
84
73
  :type customer_profile_id: int
85
74
  :param payment_profile_id: An Authorizenet customer payment profile id.
86
75
  :type payment_profile_id: int
87
- :returns: An Authorizenet validateCustomerPaymentProfileResponse element.
88
- :rtype: ~lxml.objectify.ObjectifiedElement | None
76
+ :returns: A tuple containing an Authorizenet API request element and controller class.
77
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
89
78
 
90
79
  """
91
80
  request = apicontractsv1.validateCustomerPaymentProfileRequest()
92
- request.merchantAuthentication = get_merchant_auth()
93
81
  request.customerProfileId = str(customer_profile_id)
94
82
  request.customerPaymentProfileId = str(payment_profile_id)
95
83
  request.validationMode = get_validation_mode()
96
-
97
- return execute_controller(
98
- apicontrollers.validateCustomerPaymentProfileController(request)
99
- )
84
+ return request, apicontrollers.validateCustomerPaymentProfileController
100
85
 
101
86
 
102
87
  def update_customer_payment_profile(
@@ -104,7 +89,7 @@ def update_customer_payment_profile(
104
89
  payment_profile_id: int,
105
90
  payment_profile: apicontractsv1.customerPaymentProfileType,
106
91
  validate: bool = True,
107
- ) -> ObjectifiedElement | None:
92
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
108
93
  """
109
94
  `updateCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-payment-profile>`_.
110
95
 
@@ -116,28 +101,24 @@ def update_customer_payment_profile(
116
101
  :type payment_profile: ~authorizenet.apicontractsv1.customerPaymentProfileType
117
102
  :param validate: Whether to validate the payment profile. Default is True.
118
103
  :type validate: bool
119
- :returns: An Authorizenet updateCustomerPaymentProfileResponse element.
120
- :rtype: ~lxml.objectify.ObjectifiedElement | None
104
+ :returns: A tuple containing an Authorizenet API request element and controller class.
105
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
121
106
 
122
107
  """
123
108
  if not hasattr(payment_profile, "customerPaymentProfileId"):
124
109
  payment_profile.customerPaymentProfileId = str(payment_profile_id)
125
110
 
126
111
  request = apicontractsv1.updateCustomerPaymentProfileRequest()
127
- request.merchantAuthentication = get_merchant_auth()
128
112
  request.customerProfileId = str(customer_profile_id)
129
113
  request.paymentProfile = payment_profile
130
114
  if validate:
131
115
  request.validationMode = get_validation_mode()
132
-
133
- return execute_controller(
134
- apicontrollers.updateCustomerPaymentProfileController(request)
135
- )
116
+ return request, apicontrollers.updateCustomerPaymentProfileController
136
117
 
137
118
 
138
119
  def delete_customer_payment_profile(
139
120
  customer_profile_id: int, payment_profile_id: int
140
- ) -> ObjectifiedElement | None:
121
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
141
122
  """
142
123
  `deleteCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-delete-customer-payment-profile>`_.
143
124
 
@@ -145,15 +126,11 @@ def delete_customer_payment_profile(
145
126
  :type customer_profile_id: int
146
127
  :param payment_profile_id: An Authorizenet customer payment profile id.
147
128
  :type payment_profile_id: int
148
- :returns: An Authorizenet deleteCustomerPaymentProfileResponse element.
149
- :rtype: ~lxml.objectify.ObjectifiedElement | None
129
+ :returns: A tuple containing an Authorizenet API request element and controller class.
130
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
150
131
 
151
132
  """
152
133
  request = apicontractsv1.deleteCustomerPaymentProfileRequest()
153
- request.merchantAuthentication = get_merchant_auth()
154
134
  request.customerProfileId = str(customer_profile_id)
155
135
  request.customerPaymentProfileId = str(payment_profile_id)
156
-
157
- return execute_controller(
158
- apicontrollers.deleteCustomerPaymentProfileController(request)
159
- )
136
+ return request, apicontrollers.deleteCustomerPaymentProfileController
@@ -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_subscription",
9
7
  "get_subscription",
@@ -15,28 +13,24 @@ __all__ = [
15
13
 
16
14
  def create_subscription(
17
15
  subscription: apicontractsv1.ARBSubscriptionType,
18
- ) -> ObjectifiedElement | None:
16
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
19
17
  """
20
18
  `ARBCreateSubscriptionRequest <https://developer.authorize.net/api/reference/index.html#recurring-billing-create-a-subscription>`_.
21
19
 
22
20
  :param subscription: An Authorizenet ARBSubscriptionType element.
23
21
  :type subscription: ~authorizenet.apicontractsv1.ARBSubscriptionType
24
- :returns: An Authorizenet ARBCreateSubscriptionResponse element.
25
- :rtype: ~lxml.objectify.ObjectifiedElement | None
22
+ :returns: A tuple containing an Authorizenet API request element and controller class.
23
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
26
24
 
27
25
  """
28
26
  request = apicontractsv1.ARBCreateSubscriptionRequest()
29
- request.merchantAuthentication = get_merchant_auth()
30
27
  request.subscription = subscription
31
-
32
- return execute_controller(
33
- apicontrollers.ARBCreateSubscriptionController(request)
34
- )
28
+ return request, apicontrollers.ARBCreateSubscriptionController
35
29
 
36
30
 
37
31
  def get_subscription(
38
32
  subscription_id: int, include_transactions: bool = True
39
- ) -> ObjectifiedElement | None:
33
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
40
34
  """
41
35
  `ARBGetSubscriptionRequest <https://developer.authorize.net/api/reference/index.html#recurring-billing-get-subscription>`_.
42
36
 
@@ -44,42 +38,36 @@ def get_subscription(
44
38
  :type subscription_id: int
45
39
  :param include_transactions: Whether to include the subscription transaction list in the response. Default is True.
46
40
  :type include_transactions: bool
47
- :returns: An Authorizenet ARBGetSubscriptionResponse element.
48
- :rtype: ~lxml.objectify.ObjectifiedElement | None
41
+ :returns: A tuple containing an Authorizenet API request element and controller class.
42
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
49
43
 
50
44
  """
51
45
  request = apicontractsv1.ARBGetSubscriptionRequest()
52
- request.merchantAuthentication = get_merchant_auth()
53
46
  request.subscriptionId = str(subscription_id)
54
47
  request.includeTransactions = str(include_transactions).lower()
55
-
56
- return execute_controller(
57
- apicontrollers.ARBGetSubscriptionController(request)
58
- )
48
+ return request, apicontrollers.ARBGetSubscriptionController
59
49
 
60
50
 
61
- def get_subscription_status(subscription_id: int) -> ObjectifiedElement | None:
51
+ def get_subscription_status(
52
+ subscription_id: int,
53
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
62
54
  """
63
55
  `ARBGetSubscriptionStatusRequest <https://developer.authorize.net/api/reference/index.html#recurring-billing-get-subscription-status>`_.
64
56
 
65
57
  :param subscription_id: An Authorizenet subscription id.
66
58
  :type subscription_id: int
67
- :returns: An Authorizenet ARBGetSubscriptionStatusResponse element.
68
- :rtype: ~lxml.objectify.ObjectifiedElement | None
59
+ :returns: A tuple containing an Authorizenet API request element and controller class.
60
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
69
61
 
70
62
  """
71
63
  request = apicontractsv1.ARBGetSubscriptionStatusRequest()
72
- request.merchantAuthentication = get_merchant_auth()
73
64
  request.subscriptionId = str(subscription_id)
74
-
75
- return execute_controller(
76
- apicontrollers.ARBGetSubscriptionStatusController(request)
77
- )
65
+ return request, apicontrollers.ARBGetSubscriptionStatusController
78
66
 
79
67
 
80
68
  def update_subscription(
81
69
  subscription_id: int, subscription: apicontractsv1.ARBSubscriptionType
82
- ) -> ObjectifiedElement | None:
70
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
83
71
  """
84
72
  `ARBUpdateSubscriptionRequest <https://developer.authorize.net/api/reference/index.html#recurring-billing-update-a-subscription>`_.
85
73
 
@@ -87,34 +75,28 @@ def update_subscription(
87
75
  :type subscription_id: int
88
76
  :param subscription: An Authorizenet ARBSubscriptionType element.
89
77
  :type subscription: ~authorizenet.apicontractsv1.ARBSubscriptionType
90
- :returns: An Authorizenet ARBUpdateSubscriptionResponse element.
91
- :rtype: ~lxml.objectify.ObjectifiedElement | None
78
+ :returns: A tuple containing an Authorizenet API request element and controller class.
79
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
92
80
 
93
81
  """
94
82
  request = apicontractsv1.ARBUpdateSubscriptionRequest()
95
- request.merchantAuthentication = get_merchant_auth()
96
83
  request.subscriptionId = str(subscription_id)
97
84
  request.subscription = subscription
98
-
99
- return execute_controller(
100
- apicontrollers.ARBUpdateSubscriptionController(request)
101
- )
85
+ return request, apicontrollers.ARBUpdateSubscriptionController
102
86
 
103
87
 
104
- def cancel_subscription(subscription_id: int) -> ObjectifiedElement | None:
88
+ def cancel_subscription(
89
+ subscription_id: int,
90
+ ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
105
91
  """
106
92
  `ARBCancelSubscriptionRequest <https://developer.authorize.net/api/reference/index.html#recurring-billing-cancel-a-subscription>`_.
107
93
 
108
94
  :param subscription_id: An Authorizenet subscription id.
109
95
  :type subscription_id: int
110
- :returns: An Authorizenet ARBCancelSubscriptionResponse element.
111
- :rtype: ~lxml.objectify.ObjectifiedElement | None
96
+ :returns: A tuple containing an Authorizenet API request element and controller class.
97
+ :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
112
98
 
113
99
  """
114
100
  request = apicontractsv1.ARBCancelSubscriptionRequest()
115
- request.merchantAuthentication = get_merchant_auth()
116
101
  request.subscriptionId = str(subscription_id)
117
-
118
- return execute_controller(
119
- apicontrollers.ARBCancelSubscriptionController(request)
120
- )
102
+ return request, apicontrollers.ARBCancelSubscriptionController
@@ -0,0 +1,2 @@
1
+ # TODO
2
+ __all__ = []
@@ -1,7 +1,7 @@
1
1
  from authorizenet.apicontrollersbase import APIOperationBase
2
2
  from lxml.objectify import ObjectifiedElement
3
3
 
4
- from .auth import get_environment
4
+ from .auth import get_environment, get_merchant_auth
5
5
 
6
6
 
7
7
  def execute_controller(
@@ -18,9 +18,10 @@ def execute_controller(
18
18
 
19
19
  """
20
20
  controller.setenvironment(get_environment())
21
+ controller.setmerchantauthentication(get_merchant_auth())
21
22
  controller.execute()
22
- response = controller.getresponse()
23
23
 
24
+ response = controller.getresponse()
24
25
  if response is not None and response.messages.resultCode != "Ok":
25
26
  raise AuthorizenetControllerExecutionError(
26
27
  message=response.messages.message[0]["text"].text,
@@ -8,7 +8,30 @@ VALID_COUNTRY_CODES = ("+1", "+52")
8
8
 
9
9
 
10
10
  def validate_e164_phone_number(value: str) -> None:
11
- """Raises :py:exc:`~django.core.exceptions.ValidationError` if the value is not a valid `E.164 <https://en.wikipedia.org/wiki/E.164>`_ formatted phone number."""
11
+ """
12
+ Raises :py:exc:`~django.core.exceptions.ValidationError` if the value is not a valid `E.164 <https://en.wikipedia.org/wiki/E.164>`_ formatted phone number.
13
+
14
+ * Country Code: A 2-5 character code with a leading '+' indicating the phone number's destination country.
15
+ * Area Code: The first 3 digits of the phone number.
16
+ * Subscriber Number: The last 7 digits of the phone number.
17
+
18
+ :param value: A phone number in `E.164 <https://en.wikipedia.org/wiki/E.164>`_ format.
19
+ :type value: str
20
+ :raises ~django.core.exceptions.ValidationError: If the phone number wasn't provided.
21
+ :raises ~django.core.exceptions.ValidationError: If the phone number didn't start with a '+' character.
22
+ :raises ~django.core.exceptions.ValidationError: If the phone number contained any number of spaces.
23
+ :raises ~django.core.exceptions.ValidationError: If the phone number contained any number of hyphens.
24
+ :raises ~django.core.exceptions.ValidationError: If the phone number was less than 12 characters in length.
25
+ :raises ~django.core.exceptions.ValidationError: If the phone number was greater than 15 characters in length.
26
+ :raises ~django.core.exceptions.ValidationError: If the country code was invalid.
27
+ :raises ~django.core.exceptions.ValidationError: If the area code wasn't exactly 3 characters in length.
28
+ :raises ~django.core.exceptions.ValidationError: If the area code wasn't a digit.
29
+ :raises ~django.core.exceptions.ValidationError: If the subscriber number (non-area code number) wasn't exactly 7 characters in length.
30
+ :raises ~django.core.exceptions.ValidationError: If the subscriber number (non-area code number) wasn't a digit.
31
+ :returns: Nothing.
32
+ :rtype: None
33
+
34
+ """
12
35
  if not value:
13
36
  raise ValidationError(
14
37
  _("This field is required, got '%(value)s'"),
@@ -110,10 +133,10 @@ def validate_credit_card_number(value: str) -> None:
110
133
 
111
134
  Uses the `Luhn algorithm <https://en.wikipedia.org/wiki/Luhn_algorithm>`_ to validate the credit card number.
112
135
 
113
- :param value: A credit card number string.
136
+ :param value: A credit card number.
114
137
  :type value: str
115
- :raises ValidationError: If the value contains non-digit characters.
116
- :raises ValidationError: If the value fails the Luhn algorithm.
138
+ :raises ~django.core.exceptions.ValidationError: If the credit card number contained non-digit characters.
139
+ :raises ~django.core.exceptions.ValidationError: If the credit card number failed the Luhn algorithm check.
117
140
  :returns: Nothing.
118
141
  :rtype: None
119
142
 
@@ -146,11 +169,11 @@ def validate_credit_card_expiry_month(value: str) -> None:
146
169
  """
147
170
  Raises :py:exc:`~django.core.exceptions.ValidationError` if the value is an invalid credit card expiration date month.
148
171
 
149
- :param value: A credit card expiration year string.
172
+ :param value: A credit card expiration month.
150
173
  :type value: str
151
- :raises ValidationError: If the value contains non-digit characters.
152
- :raises ValidationError: If the value is negative.
153
- :raises ValidationError: If the value isn't between 1-12.
174
+ :raises ~django.core.exceptions.ValidationError: If the expiration month contained non-digit characters.
175
+ :raises ~django.core.exceptions.ValidationError: If the expiration month was negative.
176
+ :raises ~django.core.exceptions.ValidationError: If the expiration month was an invalid (non-existent) month.
154
177
  :returns: Nothing.
155
178
  :rtype: None
156
179
 
@@ -184,11 +207,11 @@ def validate_credit_card_expiry_year(value: str) -> None:
184
207
  """
185
208
  Raises :py:exc:`~django.core.exceptions.ValidationError` if the value is an invalid credit card expiration date year.
186
209
 
187
- :param value: A credit card expiration year string.
210
+ :param value: A credit card expiration year.
188
211
  :type value: str
189
- :raises ValidationError: If the value contains non-digit characters.
190
- :raises ValidationError: If the value is negative.
191
- :raises ValidationError: If the value is a year in the past.
212
+ :raises ~django.core.exceptions.ValidationError: If the expiration year contained non-digit characters.
213
+ :raises ~django.core.exceptions.ValidationError: If the expiration year was negative.
214
+ :raises ~django.core.exceptions.ValidationError: If the expiration year was a year in the past.
192
215
  :returns: Nothing.
193
216
  :rtype: None
194
217
 
@@ -298,7 +298,7 @@ wheels = [
298
298
 
299
299
  [[package]]
300
300
  name = "python-terminusgps"
301
- version = "44.0.0"
301
+ version = "45.0.0"
302
302
  source = { editable = "." }
303
303
  dependencies = [
304
304
  { name = "authorizenet" },
@@ -1,31 +0,0 @@
1
- Validators
2
- ==========
3
-
4
- .. automodule:: terminusgps.authorizenet.validators
5
- :members:
6
-
7
- =====
8
- Usage
9
- =====
10
-
11
- .. code:: python
12
-
13
- from django import forms
14
-
15
- from terminusgps.authorizenet.validators import (
16
- validate_credit_card_number,
17
- validate_credit_card_expiry_month,
18
- validate_credit_card_expiry_year,
19
- )
20
-
21
- class CreditCardForm(forms.Form):
22
- # Adding the validators to a form field renders error messages properly
23
- cc_number = forms.CharField(
24
- max_length=17, validators=[validate_credit_card_number]
25
- )
26
- cc_expiry_month = forms.CharField(
27
- max_length=2, validators=[validate_credit_card_expiry_month]
28
- )
29
- cc_expiry_year = forms.CharField(
30
- max_length=2, validators=[validate_credit_card_expiry_year]
31
- )
@@ -1,79 +0,0 @@
1
- import datetime
2
-
3
- from authorizenet import apicontractsv1, apicontrollers
4
- from lxml.objectify import ObjectifiedElement
5
-
6
- from terminusgps.authorizenet.auth import get_merchant_auth
7
- from terminusgps.authorizenet.controllers import execute_controller
8
-
9
- __all__ = []
10
-
11
-
12
- def get_settled_batch_list(
13
- start: datetime.datetime,
14
- end: datetime.datetime,
15
- include_statistics: bool = False,
16
- ) -> ObjectifiedElement | None:
17
- """
18
- `getSettledBatchListRequest <https://developer.authorize.net/api/reference/index.html#transaction-reporting-get-settled-batch-list>`_.
19
-
20
- :param start: First settlement date.
21
- :type start: ~datetime.datetime
22
- :param end: Last settlement date.
23
- :type end: ~datetime.datetime
24
- :returns: An Authorizenet getSettledBatchListResponse element.
25
- :rtype: ~lxml.objectify.ObjectifiedElement | None
26
-
27
- """
28
- request = apicontractsv1.getSettledBatchListRequest()
29
- request.merchantAuthentication = get_merchant_auth()
30
- request.includeStatistics = str(include_statistics).lower()
31
- request.firstSettlementDate = start
32
- request.lastSettlementDate = end
33
-
34
- return execute_controller(
35
- apicontrollers.getSettledBatchListController(request)
36
- )
37
-
38
-
39
- def get_transaction_list(
40
- batch_id: int,
41
- ordering: str = "submitTimeUTC",
42
- descending: bool = False,
43
- limit: int = 1000,
44
- offset: int = 0,
45
- ) -> ObjectifiedElement | None:
46
- """
47
- `getTransactionListRequest <https://developer.authorize.net/api/reference/index.html#transaction-reporting-get-transaction-list>`_.
48
-
49
- :param batch_id: An Authorizenet transaction batch id.
50
- :type batch_id int
51
- :param ordering: An Authorizenet transaction list ordering string. Default is "submitTimeUTC".
52
- :type ordering: str
53
- :param descending: Whether to sort the transaction list in descending order. Default is False (ascending order).
54
- :type descending: bool
55
- :param limit: Total number of transactions to return in the list.
56
- :type limit: int
57
- :param offset: Page number to return results from.
58
- :type offset: int
59
- :returns: An Authorizenet getTransactionListResponse element.
60
- :rtype: ~lxml.objectify.ObjectifiedElement | None
61
-
62
- """
63
- sorting = apicontractsv1.TransactionListSorting()
64
- sorting.orderBy = ordering
65
- sorting.orderDescending = str(descending).lower()
66
-
67
- paging = apicontractsv1.Paging()
68
- paging.limit = str(limit)
69
- paging.offset = str(offset)
70
-
71
- request = apicontractsv1.getTransactionListRequest()
72
- request.merchantAuthentication = get_merchant_auth()
73
- request.batchId = str(batch_id)
74
- request.sorting = sorting
75
- request.paging = paging
76
-
77
- return execute_controller(
78
- apicontrollers.getTransactionListController(request)
79
- )