python-terminusgps 42.2.4__tar.gz → 43.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 (74) hide show
  1. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/PKG-INFO +1 -1
  2. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/conf.py +1 -1
  3. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/pyproject.toml +2 -2
  4. python_terminusgps-43.0.0/terminusgps/authorizenet/api/__init__.py +5 -0
  5. python_terminusgps-42.2.4/terminusgps/authorizenet/profiles/addresses.py → python_terminusgps-43.0.0/terminusgps/authorizenet/api/address_profiles.py +45 -44
  6. python_terminusgps-43.0.0/terminusgps/authorizenet/api/customer_profiles.py +123 -0
  7. python_terminusgps-42.2.4/terminusgps/authorizenet/profiles/payments.py → python_terminusgps-43.0.0/terminusgps/authorizenet/api/payment_profiles.py +72 -60
  8. {python_terminusgps-42.2.4/terminusgps/authorizenet → python_terminusgps-43.0.0/terminusgps/authorizenet/api}/subscriptions.py +44 -20
  9. python_terminusgps-43.0.0/terminusgps/authorizenet/api/transactions.py +77 -0
  10. python_terminusgps-43.0.0/terminusgps/authorizenet/constants.py +15 -0
  11. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/authorizenet/controllers.py +8 -30
  12. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/authorizenet/validators.py +10 -3
  13. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/uv.lock +7 -7
  14. python_terminusgps-42.2.4/terminusgps/authorizenet/constants.py +0 -19
  15. python_terminusgps-42.2.4/terminusgps/authorizenet/profiles/__init__.py +0 -3
  16. python_terminusgps-42.2.4/terminusgps/authorizenet/profiles/customers.py +0 -107
  17. python_terminusgps-42.2.4/terminusgps/authorizenet/utils.py +0 -172
  18. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/.gitignore +0 -0
  19. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/COPYING +0 -0
  20. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/README.md +0 -0
  21. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/Makefile +0 -0
  22. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/make.bat +0 -0
  23. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/authorizenet/auth.rst +0 -0
  24. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/authorizenet/constants.rst +0 -0
  25. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/authorizenet/controllers.rst +0 -0
  26. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/authorizenet/examples.rst +0 -0
  27. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/authorizenet/index.rst +0 -0
  28. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/authorizenet/profiles.rst +0 -0
  29. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/authorizenet/subscriptions.rst +0 -0
  30. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/authorizenet/utils.rst +0 -0
  31. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/authorizenet/validators.rst +0 -0
  32. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/django/forms.rst +0 -0
  33. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/django/index.rst +0 -0
  34. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/django/mixins.rst +0 -0
  35. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/django/settings.rst +0 -0
  36. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/django/validators.rst +0 -0
  37. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/index.rst +0 -0
  38. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/wialon/constants.rst +0 -0
  39. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/wialon/errors.rst +0 -0
  40. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/wialon/examples.rst +0 -0
  41. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/wialon/flags.rst +0 -0
  42. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/wialon/index.rst +0 -0
  43. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/wialon/items.rst +0 -0
  44. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/wialon/session.rst +0 -0
  45. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/docs/source/wialon/utils.rst +0 -0
  46. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/__init__.py +0 -0
  47. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/authorizenet/__init__.py +0 -0
  48. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/authorizenet/auth.py +0 -0
  49. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/django/__init__.py +0 -0
  50. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/django/forms/__init__.py +0 -0
  51. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/django/forms/fields.py +0 -0
  52. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/django/forms/forms.py +0 -0
  53. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/django/forms/renderer.py +0 -0
  54. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/django/forms/widgets.py +0 -0
  55. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/django/mixins.py +0 -0
  56. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/django/settings.py +0 -0
  57. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/django/utils.py +0 -0
  58. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/django/validators.py +0 -0
  59. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/__init__.py +0 -0
  60. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/constants.py +0 -0
  61. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/flags.py +0 -0
  62. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/items/__init__.py +0 -0
  63. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/items/account.py +0 -0
  64. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/items/base.py +0 -0
  65. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/items/factory.py +0 -0
  66. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/items/resource.py +0 -0
  67. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/items/retranslator.py +0 -0
  68. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/items/route.py +0 -0
  69. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/items/unit.py +0 -0
  70. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/items/unit_group.py +0 -0
  71. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/items/user.py +0 -0
  72. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/session.py +0 -0
  73. {python_terminusgps-42.2.4 → python_terminusgps-43.0.0}/terminusgps/wialon/utils.py +0 -0
  74. {python_terminusgps-42.2.4 → python_terminusgps-43.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: 42.2.4
3
+ Version: 43.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://docs.terminusgps.com
6
6
  Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
@@ -18,7 +18,7 @@ django.setup()
18
18
  project = "python-terminusgps"
19
19
  copyright = "2025, Terminus GPS, LLC"
20
20
  author = "Terminus GPS, LLC"
21
- release = "42.2.4"
21
+ release = "44.0.0"
22
22
 
23
23
  # -- General configuration ---------------------------------------------------
24
24
  # 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 = "42.2.4"
3
+ version = "43.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" } ]
@@ -46,7 +46,7 @@ exclude = [
46
46
  "dist",
47
47
  "build",
48
48
  ]
49
- line-length = 88
49
+ line-length = 79
50
50
  indent-width = 4
51
51
  target-version = "py312"
52
52
 
@@ -0,0 +1,5 @@
1
+ from .address_profiles import *
2
+ from .customer_profiles import *
3
+ from .payment_profiles import *
4
+ from .subscriptions import *
5
+ from .transactions import *
@@ -1,64 +1,65 @@
1
1
  from authorizenet import apicontractsv1, apicontrollers
2
+ from lxml.objectify import ObjectifiedElement
2
3
 
3
4
  from terminusgps.authorizenet.auth import get_merchant_auth
4
5
  from terminusgps.authorizenet.controllers import execute_controller
5
6
 
6
7
  __all__ = [
7
8
  "create_customer_shipping_address",
8
- "delete_customer_shipping_address",
9
9
  "get_customer_shipping_address",
10
10
  "update_customer_shipping_address",
11
+ "delete_customer_shipping_address",
11
12
  ]
12
13
 
13
14
 
14
15
  def create_customer_shipping_address(
15
16
  customer_profile_id: int,
16
- new_address: apicontractsv1.customerAddressType,
17
+ address: apicontractsv1.customerAddressType,
17
18
  default: bool = True,
18
- ):
19
+ ) -> ObjectifiedElement | None:
19
20
  """
20
21
  `createCustomerShippingAddressRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-shipping-address>`_.
21
22
 
22
23
  :param customer_profile_id: An Authorizenet customer profile id.
23
24
  :type customer_profile_id: :py:obj:`int`
24
- :param new_address: An Authorizenet customer address object.
25
- :type new_address: :py:obj:`~authorizenet.apicontractsv1.customerAddressType`
25
+ :param elem: An Authorizenet customer address element.
26
+ :type elem: :py:obj:`~authorizenet.apicontractsv1.customerAddressType`
26
27
  :param default: Whether or not to mark the new shipping address as default. Default is :py:obj:`True`.
27
28
  :type default: :py:obj:`bool`
28
29
  :returns: An Authorizenet createCustomerShippingAddress response.
29
- :rtype: :py:obj:`dict`
30
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
30
31
 
31
32
  """
32
- request = apicontractsv1.createCustomerShippingAddressRequest(
33
- merchantAuthentication=get_merchant_auth(),
34
- customerProfileId=str(customer_profile_id),
35
- address=new_address,
36
- defaultShippingAddress=str(default).lower(),
37
- )
33
+ request = apicontractsv1.createCustomerShippingAddressRequest()
34
+ request.merchantAuthentication = get_merchant_auth()
35
+ request.customerProfileId = str(customer_profile_id)
36
+ request.address = address
37
+ request.defaultShippingAddress = str(default).lower()
38
+
38
39
  return execute_controller(
39
40
  apicontrollers.createCustomerShippingAddressController(request)
40
41
  )
41
42
 
42
43
 
43
44
  def get_customer_shipping_address(
44
- customer_profile_id: int, customer_address_profile_id: int
45
- ):
45
+ customer_profile_id: int, address_profile_id: int
46
+ ) -> ObjectifiedElement | None:
46
47
  """
47
48
  `getCustomerShippingAddressRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-get-customer-shipping-address>`_.
48
49
 
49
50
  :param customer_profile_id: An Authorizenet customer profile id.
50
51
  :type customer_profile_id: :py:obj:`int`
51
- :param customer_address_profile_id: An Authorizenet customer address profile id.
52
- :type customer_address_profile_id: :py:obj:`int`
52
+ :param address_profile_id: An Authorizenet customer address profile id.
53
+ :type address_profile_id: :py:obj:`int`
53
54
  :returns: An Authorizenet getCustomerShippingAddress response.
54
- :rtype: :py:obj:`dict`
55
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
55
56
 
56
57
  """
57
- request = apicontractsv1.getCustomerShippingAddressRequest(
58
- merchantAuthentication=get_merchant_auth(),
59
- customerProfileId=str(customer_profile_id),
60
- customerAddressId=str(customer_address_profile_id),
61
- )
58
+ request = apicontractsv1.getCustomerShippingAddressRequest()
59
+ request.merchantAuthentication = get_merchant_auth()
60
+ request.customerProfileId = str(customer_profile_id)
61
+ request.customerAddressId = str(address_profile_id)
62
+
62
63
  return execute_controller(
63
64
  apicontrollers.getCustomerShippingAddressController(request)
64
65
  )
@@ -66,52 +67,52 @@ def get_customer_shipping_address(
66
67
 
67
68
  def update_customer_shipping_address(
68
69
  customer_profile_id: int,
69
- new_address: apicontractsv1.customerAddressType,
70
+ address: apicontractsv1.customerAddressType,
70
71
  default: bool = False,
71
- ):
72
+ ) -> ObjectifiedElement | None:
72
73
  """
73
74
  `updateCustomerShippingAddressRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-shipping-address>`_.
74
75
 
75
76
  :param customer_profile_id: An Authorizenet customer profile id.
76
77
  :type customer_profile_id: :py:obj:`int`
77
- :param new_address: An Authorizenet customer address object.
78
- :type new_address: :py:obj:`~authorizenet.apicontractsv1.customerAddressType`
78
+ :param address: An Authorizenet customer address element.
79
+ :type address: :py:obj:`~authorizenet.apicontractsv1.customerAddressType`
79
80
  :param default: Whether or not to mark the new shipping address as default. Default is :py:obj:`False`.
80
81
  :type default: :py:obj:`bool`
81
82
  :returns: An Authorizenet updateCustomerShippingAddress response.
82
- :rtype: :py:obj:`dict`
83
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
83
84
 
84
85
  """
85
- request = apicontractsv1.updateCustomerShippingAddressRequest(
86
- merchantAuthentication=get_merchant_auth(),
87
- customerProfileId=str(customer_profile_id),
88
- address=new_address,
89
- defaultShippingAddress=str(default).lower(),
90
- )
86
+ request = apicontractsv1.updateCustomerShippingAddressRequest()
87
+ request.merchantAuthentication = get_merchant_auth()
88
+ request.customerProfileId = str(customer_profile_id)
89
+ request.address = address
90
+ request.defaultShippingAddress = str(default).lower()
91
+
91
92
  return execute_controller(
92
93
  apicontrollers.updateCustomerShippingAddressController(request)
93
94
  )
94
95
 
95
96
 
96
97
  def delete_customer_shipping_address(
97
- customer_profile_id: int, customer_address_profile_id: int
98
- ):
98
+ customer_profile_id: int, address_profile_id: int
99
+ ) -> ObjectifiedElement | None:
99
100
  """
100
101
  `deleteCustomerShippingAddressRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-delete-customer-shipping-address>`_.
101
102
 
102
103
  :param customer_profile_id: An Authorizenet customer profile id.
103
104
  :type customer_profile_id: :py:obj:`int`
104
- :param customer_address_profile_id: An Authorizenet customer address profile id.
105
- :type customer_address_profile_id: :py:obj:`int`
106
- :returns: An Authorizenet deleteCustomerShippingAddress response.
107
- :rtype: :py:obj:`dict`
105
+ :param address_profile_id: An Authorizenet customer address profile id.
106
+ :type address_profile_id: :py:obj:`int`
107
+ :returns: An Authorizenet deleteCustomerShippingAddressResponse element.
108
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
108
109
 
109
110
  """
110
- request = apicontractsv1.deleteCustomerShippingAddressRequest(
111
- merchantAuthentication=get_merchant_auth(),
112
- customerProfileId=str(customer_profile_id),
113
- customerAddressId=str(customer_address_profile_id),
114
- )
111
+ request = apicontractsv1.deleteCustomerShippingAddressRequest()
112
+ request.merchantAuthentication = get_merchant_auth()
113
+ request.customerProfileId = str(customer_profile_id)
114
+ request.customerAddressId = str(address_profile_id)
115
+
115
116
  return execute_controller(
116
117
  apicontrollers.deleteCustomerShippingAddressController(request)
117
118
  )
@@ -0,0 +1,123 @@
1
+ from authorizenet import apicontractsv1, apicontrollers
2
+ from lxml.objectify import ObjectifiedElement
3
+
4
+ from terminusgps.authorizenet.auth import get_merchant_auth
5
+ from terminusgps.authorizenet.controllers import execute_controller
6
+
7
+ __all__ = [
8
+ "create_customer_profile",
9
+ "get_customer_profile",
10
+ "get_customer_profile_ids",
11
+ "update_customer_profile",
12
+ "delete_customer_profile",
13
+ ]
14
+
15
+
16
+ def create_customer_profile(
17
+ merchant_id: str, email: str, description: str = ""
18
+ ) -> ObjectifiedElement | None:
19
+ """
20
+ `createCustomerProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-profile>`_.
21
+
22
+ :param merchant_id: A merchant designated customer id.
23
+ :type merchant_id: :py:obj:`str`
24
+ :param email: A customer email address.
25
+ :type email: :py:obj:`str`
26
+ :param description: An optional customer description.
27
+ :type description: :py:obj:`str`
28
+ :returns: An Authorizenet createCustomerProfile response.
29
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
30
+
31
+ """
32
+ request = apicontractsv1.createCustomerProfileRequest()
33
+ request.merchantAuthentication = get_merchant_auth()
34
+ request.profile = apicontractsv1.customerProfileType()
35
+ request.profile.merchantCustomerId = merchant_id
36
+ request.profile.description = description
37
+ request.profile.email = email
38
+
39
+ return execute_controller(
40
+ apicontrollers.createCustomerProfileController(request)
41
+ )
42
+
43
+
44
+ def get_customer_profile(
45
+ customer_profile_id: int, include_issuer_info: bool = False
46
+ ) -> ObjectifiedElement | None:
47
+ """
48
+ `getCustomerProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-get-customer-profile>`_.
49
+
50
+ :param customer_profile_id: An Authorizenet customer profile id.
51
+ :type customer_profile_id: :py:obj:`int`
52
+ :param include_issuer_info: Whether or not to include issuer info in the response. Default is :py:obj:`False`.
53
+ :type include_issuer_info: :py:obj:`bool`
54
+ :returns: An Authorizenet getCustomerProfile response.
55
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
56
+
57
+ """
58
+ request = apicontractsv1.getCustomerProfileRequest()
59
+ request.merchantAuthentication = get_merchant_auth()
60
+ request.customerProfileId = str(customer_profile_id)
61
+ request.includeIssuerInfo = str(include_issuer_info).lower()
62
+
63
+ return execute_controller(
64
+ apicontrollers.getCustomerProfileController(request)
65
+ )
66
+
67
+
68
+ def get_customer_profile_ids() -> ObjectifiedElement | None:
69
+ """
70
+ `getCustomerProfileIdsRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-get-customer-profile-ids>`_.
71
+
72
+ :returns: An Authorizenet getCustomerProfileIds response.
73
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
74
+
75
+ """
76
+ request = apicontractsv1.getCustomerProfileIdsRequest()
77
+ request.merchantAuthentication = get_merchant_auth()
78
+
79
+ return execute_controller(
80
+ apicontrollers.getCustomerProfileIdsController(request)
81
+ )
82
+
83
+
84
+ def update_customer_profile(
85
+ profile: apicontractsv1.customerProfileExType,
86
+ ) -> ObjectifiedElement | None:
87
+ """
88
+ `updateCustomerProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-profile>`_.
89
+
90
+ :param profile: An Authorizenet customer profile ex element.
91
+ :type profile: :py:obj:`~authorizenet.apicontractsv1.customerProfileExType`
92
+ :returns: An Authorizenet updateCustomerProfile response.
93
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
94
+
95
+ """
96
+ request = apicontractsv1.updateCustomerProfileRequest()
97
+ request.merchantAuthentication = get_merchant_auth()
98
+ request.profile = profile
99
+
100
+ return execute_controller(
101
+ apicontrollers.updateCustomerProfileController(request)
102
+ )
103
+
104
+
105
+ def delete_customer_profile(
106
+ customer_profile_id: int,
107
+ ) -> ObjectifiedElement | None:
108
+ """
109
+ `deleteCustomerProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-delete-customer-profile>`_.
110
+
111
+ :param customer_profile_id: An Authorizenet customer profile id.
112
+ :type customer_profile_id: :py:obj:`int`
113
+ :returns: An Authorizenet deleteCustomerProfile response.
114
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
115
+
116
+ """
117
+ request = apicontractsv1.deleteCustomerProfileRequest()
118
+ request.merchantAuthentication = get_merchant_auth()
119
+ request.customerProfileId = str(customer_profile_id)
120
+
121
+ return execute_controller(
122
+ apicontrollers.deleteCustomerProfileController(request)
123
+ )
@@ -1,38 +1,44 @@
1
1
  from authorizenet import apicontractsv1, apicontrollers
2
+ from lxml.objectify import ObjectifiedElement
2
3
 
3
- from terminusgps.authorizenet.auth import get_merchant_auth, get_validation_mode
4
+ from terminusgps.authorizenet.auth import (
5
+ get_merchant_auth,
6
+ get_validation_mode,
7
+ )
4
8
  from terminusgps.authorizenet.controllers import execute_controller
5
9
 
6
10
  __all__ = [
7
11
  "create_customer_payment_profile",
8
- "delete_customer_payment_profile",
9
12
  "get_customer_payment_profile",
10
- "update_customer_payment_profile",
11
13
  "validate_customer_payment_profile",
14
+ "update_customer_payment_profile",
15
+ "delete_customer_payment_profile",
12
16
  ]
13
17
 
14
18
 
15
19
  def create_customer_payment_profile(
16
20
  customer_profile_id: int,
17
- new_payment_profile: apicontractsv1.customerPaymentProfileType,
18
- ):
21
+ payment_profile: apicontractsv1.customerPaymentProfileType,
22
+ validate: bool = False,
23
+ ) -> ObjectifiedElement | None:
19
24
  """
20
25
  `createCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-payment-profile>`_.
21
26
 
22
27
  :param customer_profile_id: An Authorizenet customer profile id.
23
28
  :type customer_profile_id: :py:obj:`int`
24
- :param new_payment_profile: An Authorizenet payment profile object.
25
- :type new_payment_profile: :py:obj:`~authorizenet.apicontractsv1.customerPaymentProfileType`
29
+ :param payment_profile: An Authorizenet payment profile element.
30
+ :type payment_profile: :py:obj:`~authorizenet.apicontractsv1.customerPaymentProfileType`
26
31
  :returns: An Authorizenet createCustomerPaymentProfile response.
27
- :rtype: :py:obj:`dict`
32
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
28
33
 
29
34
  """
30
- request = apicontractsv1.createCustomerPaymentProfileRequest(
31
- merchantAuthentication=get_merchant_auth(),
32
- customerProfileId=str(customer_profile_id),
33
- paymentProfile=new_payment_profile,
34
- validationMode=get_validation_mode(),
35
- )
35
+ request = apicontractsv1.createCustomerPaymentProfileRequest()
36
+ request.merchantAuthentication = get_merchant_auth()
37
+ request.customerProfileId = str(customer_profile_id)
38
+ request.paymentProfile = payment_profile
39
+ if validate:
40
+ request.validationMode = get_validation_mode()
41
+
36
42
  return execute_controller(
37
43
  apicontrollers.createCustomerPaymentProfileController(request)
38
44
  )
@@ -40,36 +46,36 @@ def create_customer_payment_profile(
40
46
 
41
47
  def get_customer_payment_profile(
42
48
  customer_profile_id: int,
43
- customer_payment_profile_id: int,
49
+ payment_profile_id: int,
44
50
  include_issuer_info: bool = False,
45
- ):
51
+ ) -> ObjectifiedElement | None:
46
52
  """
47
53
  `getCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-get-customer-payment-profile>`_.
48
54
 
49
55
  :param customer_profile_id: An Authorizenet customer profile id.
50
56
  :type customer_profile_id: :py:obj:`int`
51
- :param customer_payment_profile_id: An Authorizenet customer payment profile id.
52
- :type customer_payment_profile_id: :py:obj:`int`
53
- :param include_issuer_info: Whether or not to include issuer info in the response. Default is :py:obj:`False`.
57
+ :param payment_profile_id: An Authorizenet customer payment profile id.
58
+ :type payment_profile_id: :py:obj:`int`
59
+ :param include_issuer_info: Whether to include issuer info in the response. Default is :py:obj:`False`.
54
60
  :type include_issuer_info: :py:obj:`bool`
55
61
  :returns: An Authorizenet getCustomerPaymentProfile response.
56
- :rtype: :py:obj:`dict`
62
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
57
63
 
58
64
  """
59
- request = apicontractsv1.getCustomerPaymentProfileRequest(
60
- merchantAuthentication=get_merchant_auth(),
61
- customerProfileId=str(customer_profile_id),
62
- customerPaymentProfileId=str(customer_payment_profile_id),
63
- includeIssuerInfo=str(include_issuer_info).lower(),
64
- )
65
+ request = apicontractsv1.getCustomerPaymentProfileRequest()
66
+ request.merchantAuthentication = get_merchant_auth()
67
+ request.customerProfileId = str(customer_profile_id)
68
+ request.customerPaymentProfileId = str(payment_profile_id)
69
+ request.includeIssuerInfo = str(include_issuer_info).lower()
70
+
65
71
  return execute_controller(
66
72
  apicontrollers.getCustomerPaymentProfileController(request)
67
73
  )
68
74
 
69
75
 
70
76
  def validate_customer_payment_profile(
71
- customer_profile_id: int, customer_payment_profile_id: int
72
- ):
77
+ customer_profile_id: int, payment_profile_id: int
78
+ ) -> ObjectifiedElement | None:
73
79
  """
74
80
  `validateCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-validate-customer-payment-profile>`_.
75
81
 
@@ -78,15 +84,15 @@ def validate_customer_payment_profile(
78
84
  :param customer_payment_profile_id: An Authorizenet customer payment profile id.
79
85
  :type customer_payment_profile_id: :py:obj:`int`
80
86
  :returns: An Authorizenet validateCustomerPaymentProfile response.
81
- :rtype: :py:obj:`dict`
87
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
82
88
 
83
89
  """
84
- request = apicontractsv1.validateCustomerPaymentProfileRequest(
85
- merchantAuthentication=get_merchant_auth(),
86
- customerProfileId=str(customer_profile_id),
87
- customerPaymentProfileId=str(customer_payment_profile_id),
88
- validationMode=get_validation_mode(),
89
- )
90
+ request = apicontractsv1.validateCustomerPaymentProfileRequest()
91
+ request.merchantAuthentication = get_merchant_auth()
92
+ request.customerProfileId = str(customer_profile_id)
93
+ request.customerPaymentProfileId = str(payment_profile_id)
94
+ request.validationMode = get_validation_mode()
95
+
90
96
  return execute_controller(
91
97
  apicontrollers.validateCustomerPaymentProfileController(request)
92
98
  )
@@ -94,53 +100,59 @@ def validate_customer_payment_profile(
94
100
 
95
101
  def update_customer_payment_profile(
96
102
  customer_profile_id: int,
97
- customer_payment_profile_id: int,
98
- new_payment_profile: apicontractsv1.customerPaymentProfileType,
99
- ):
103
+ payment_profile_id: int,
104
+ payment_profile: apicontractsv1.customerPaymentProfileType,
105
+ validate: bool = False,
106
+ ) -> ObjectifiedElement | None:
100
107
  """
101
108
  `updateCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-payment-profile>`_.
102
109
 
103
110
  :param customer_profile_id: An Authorizenet customer profile id.
104
111
  :type customer_profile_id: :py:obj:`int`
105
- :param customer_payment_profile_id: An Authorizenet customer payment profile id.
106
- :type customer_payment_profile_id: :py:obj:`int`
107
- :param new_payment_profile: An Authorizenet payment profile object.
108
- :type new_payment_profile: :py:obj:`~authorizenet.apicontractsv1.customerPaymentProfileType`
112
+ :param payment_profile_id: An Authorizenet customer payment profile id.
113
+ :type payment_profile_id: :py:obj:`int`
114
+ :param payment_profile: An Authorizenet payment profile element.
115
+ :type payment_profile: :py:obj:`~authorizenet.apicontractsv1.customerPaymentProfileType`
116
+ :param validate: Whether to validate the updated payment profile. Default is :py:obj:`False`.
117
+ :type validate: :py:obj:`bool`
109
118
  :returns: An Authorizenet updateCustomerPaymentProfile response.
110
- :rtype: :py:obj:`dict`
119
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
111
120
 
112
121
  """
113
- new_payment_profile.customerPaymentProfileId = str(customer_payment_profile_id)
114
- request = apicontractsv1.updateCustomerPaymentProfileRequest(
115
- merchantAuthentication=get_merchant_auth(),
116
- customerProfileId=str(customer_profile_id),
117
- paymentProfile=new_payment_profile,
118
- validationMode=get_validation_mode(),
119
- )
122
+ if not hasattr(payment_profile, "customerPaymentProfileId"):
123
+ payment_profile.customerPaymentProfileId = str(payment_profile_id)
124
+
125
+ request = apicontractsv1.updateCustomerPaymentProfileRequest()
126
+ request.merchantAuthentication = get_merchant_auth()
127
+ request.customerProfileId = str(customer_profile_id)
128
+ request.paymentProfile = payment_profile
129
+ if validate:
130
+ request.validationMode = get_validation_mode()
131
+
120
132
  return execute_controller(
121
133
  apicontrollers.updateCustomerPaymentProfileController(request)
122
134
  )
123
135
 
124
136
 
125
137
  def delete_customer_payment_profile(
126
- customer_profile_id: int, customer_payment_profile_id: int
127
- ):
138
+ customer_profile_id: int, payment_profile_id: int
139
+ ) -> ObjectifiedElement | None:
128
140
  """
129
141
  `deleteCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-delete-customer-payment-profile>`_.
130
142
 
131
143
  :param customer_profile_id: An Authorizenet customer profile id.
132
144
  :type customer_profile_id: :py:obj:`int`
133
- :param customer_payment_profile_id: An Authorizenet customer payment profile id.
134
- :type customer_payment_profile_id: :py:obj:`int`
145
+ :param payment_profile_id: An Authorizenet customer payment profile id.
146
+ :type payment_profile_id: :py:obj:`int`
135
147
  :returns: An Authorizenet deleteCustomerPaymentProfile response.
136
- :rtype: :py:obj:`dict`
148
+ :rtype: :py:obj:`~lxml.objectify.ObjectifiedElement` | :py:obj:`None`
137
149
 
138
150
  """
139
- request = apicontractsv1.deleteCustomerPaymentProfileRequest(
140
- merchantAuthentication=get_merchant_auth(),
141
- customerProfileId=str(customer_profile_id),
142
- customerPaymentProfileId=str(customer_payment_profile_id),
143
- )
151
+ request = apicontractsv1.deleteCustomerPaymentProfileRequest()
152
+ request.merchantAuthentication = get_merchant_auth()
153
+ request.customerProfileId = str(customer_profile_id)
154
+ request.customerPaymentProfileId = str(payment_profile_id)
155
+
144
156
  return execute_controller(
145
157
  apicontrollers.deleteCustomerPaymentProfileController(request)
146
158
  )