python-terminusgps 40.0.0__py3-none-any.whl → 40.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_terminusgps-40.0.0.dist-info → python_terminusgps-40.1.0.dist-info}/METADATA +1 -1
- {python_terminusgps-40.0.0.dist-info → python_terminusgps-40.1.0.dist-info}/RECORD +9 -8
- terminusgps/authorizenet/controllers.py +24 -10
- terminusgps/authorizenet/profiles/addresses.py +5 -5
- terminusgps/authorizenet/profiles/customers.py +6 -16
- terminusgps/authorizenet/profiles/payments.py +6 -6
- terminusgps/authorizenet/subscriptions.py +96 -0
- {python_terminusgps-40.0.0.dist-info → python_terminusgps-40.1.0.dist-info}/WHEEL +0 -0
- {python_terminusgps-40.0.0.dist-info → python_terminusgps-40.1.0.dist-info}/licenses/COPYING +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version: 40.
|
|
3
|
+
Version: 40.1.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
|
|
@@ -2,13 +2,14 @@ terminusgps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
2
2
|
terminusgps/authorizenet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
terminusgps/authorizenet/auth.py,sha256=CKT_pfDEL-53GceOEaFtIU6IBXVuVd8MVHikpPAX0xY,1184
|
|
4
4
|
terminusgps/authorizenet/constants.py,sha256=uXkYVmQPrnYBDfGahVEmzwTny21A8jGcrH7qfSdLhvc,512
|
|
5
|
-
terminusgps/authorizenet/controllers.py,sha256=
|
|
5
|
+
terminusgps/authorizenet/controllers.py,sha256=Kqp-cvHwX_TCbRa_xoCVV6A9Ky1bQuaX8PJpQFRfFOI,2685
|
|
6
|
+
terminusgps/authorizenet/subscriptions.py,sha256=8QPLMwLXHu3SLapGsNKoasTUiPqCd7GkK7UpXsXp5wk,3996
|
|
6
7
|
terminusgps/authorizenet/utils.py,sha256=LosPGnOam97Fk51aoCAIdoyrQRdxV43mXxpZ1TsmPDQ,7042
|
|
7
8
|
terminusgps/authorizenet/validators.py,sha256=Z4JfKMHhMIH9elsmzW-6KHi9TwOlNp3h_uvtRPCX0GI,3822
|
|
8
9
|
terminusgps/authorizenet/profiles/__init__.py,sha256=WYODXV43js8JN_rd__0FiW0-6GsiDPqfOAIlpyASiak,74
|
|
9
|
-
terminusgps/authorizenet/profiles/addresses.py,sha256=
|
|
10
|
-
terminusgps/authorizenet/profiles/customers.py,sha256=
|
|
11
|
-
terminusgps/authorizenet/profiles/payments.py,sha256=
|
|
10
|
+
terminusgps/authorizenet/profiles/addresses.py,sha256=7heMIOSQtk5eHgApH-vxigDRejWDCbO3sO362IsYDXw,4673
|
|
11
|
+
terminusgps/authorizenet/profiles/customers.py,sha256=x9w0gWnF2CSrzH6SVRl2TrfBNlMkA0DzI4IuYkvA84s,4360
|
|
12
|
+
terminusgps/authorizenet/profiles/payments.py,sha256=G13Ag9zXGQD9joJr06F6PSeufdq7Ngml8ZqryZnjmTU,6033
|
|
12
13
|
terminusgps/django/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
14
|
terminusgps/django/mixins.py,sha256=Q9ZJuzpk3d9lDnlVA8ZTVvnZWxB13p08EQ8yVJcztn4,1034
|
|
14
15
|
terminusgps/django/settings.py,sha256=NLjcdnD_Ny_04eNNVWabUwzWvw0zS_-ebXnzhx8PJRU,691
|
|
@@ -34,7 +35,7 @@ terminusgps/wialon/items/route.py,sha256=2dEUK9o8nwutPE03W-5GUcZrjGvbwLoExVnFV9L
|
|
|
34
35
|
terminusgps/wialon/items/unit.py,sha256=kee7dwpvjxbfDuRFzqbhKjLWjCN9iAimkjTyMilqKek,12124
|
|
35
36
|
terminusgps/wialon/items/unit_group.py,sha256=HhYMZ9b7UATXeEgHkXN9r5-M_w82fabjDYADCUwBtxQ,4442
|
|
36
37
|
terminusgps/wialon/items/user.py,sha256=pR6OTrm6f7Zo0J8eLvKtWVsdhGi430OxMsMMthGh8YE,5382
|
|
37
|
-
python_terminusgps-40.
|
|
38
|
-
python_terminusgps-40.
|
|
39
|
-
python_terminusgps-40.
|
|
40
|
-
python_terminusgps-40.
|
|
38
|
+
python_terminusgps-40.1.0.dist-info/METADATA,sha256=1BvaYYwi2wGVfwAmMZHfEy7ZVjNKxKYIZ-c4zk7JdjU,1036
|
|
39
|
+
python_terminusgps-40.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
40
|
+
python_terminusgps-40.1.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
41
|
+
python_terminusgps-40.1.0.dist-info/RECORD,,
|
|
@@ -5,6 +5,29 @@ from authorizenet.apicontrollersbase import APIOperationBase
|
|
|
5
5
|
from .auth import get_environment
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
def execute_controller(controller: APIOperationBase) -> dict[str, typing.Any] | None:
|
|
9
|
+
"""
|
|
10
|
+
Executes an Authorizenet API controller and returns its response.
|
|
11
|
+
|
|
12
|
+
:param controller: An Authorizenet API controller.
|
|
13
|
+
:type controller: :py:obj:`~authorizenet.apicontrollersbase.APIOperationBase`
|
|
14
|
+
:raises AuthorizenetControllerExecutionError: If the API call fails.
|
|
15
|
+
:returns: An Authorizenet API response, if any.
|
|
16
|
+
:rtype: :py:obj:`dict` | :py:obj:`None`
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
controller.setenvironment(get_environment())
|
|
20
|
+
controller.execute()
|
|
21
|
+
response = controller.getresponse()
|
|
22
|
+
|
|
23
|
+
if response is not None and response.messages.resultCode != "Ok":
|
|
24
|
+
raise AuthorizenetControllerExecutionError(
|
|
25
|
+
message=response.messages.message[0]["text"].text,
|
|
26
|
+
code=response.messages.message[0]["code"].text,
|
|
27
|
+
)
|
|
28
|
+
return response
|
|
29
|
+
|
|
30
|
+
|
|
8
31
|
class AuthorizenetControllerExecutor:
|
|
9
32
|
"""Allows objects to use :py:meth:`execute_controller` to execute Authorizenet API controllers."""
|
|
10
33
|
|
|
@@ -22,16 +45,7 @@ class AuthorizenetControllerExecutor:
|
|
|
22
45
|
:rtype: :py:obj:`dict` | :py:obj:`None`
|
|
23
46
|
|
|
24
47
|
"""
|
|
25
|
-
controller
|
|
26
|
-
controller.execute()
|
|
27
|
-
response = controller.getresponse()
|
|
28
|
-
|
|
29
|
-
if response is not None and response.messages.resultCode != "Ok":
|
|
30
|
-
raise AuthorizenetControllerExecutionError(
|
|
31
|
-
message=response.messages.message[0]["text"].text,
|
|
32
|
-
code=response.messages.message[0]["code"].text,
|
|
33
|
-
)
|
|
34
|
-
return response
|
|
48
|
+
return execute_controller(controller)
|
|
35
49
|
|
|
36
50
|
|
|
37
51
|
class AuthorizenetControllerExecutionError(Exception):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from authorizenet import apicontractsv1, apicontrollers
|
|
2
2
|
|
|
3
3
|
from terminusgps.authorizenet.auth import get_merchant_auth
|
|
4
|
-
from terminusgps.authorizenet.controllers import
|
|
4
|
+
from terminusgps.authorizenet.controllers import execute_controller
|
|
5
5
|
|
|
6
6
|
__all__ = [
|
|
7
7
|
"create_customer_shipping_address",
|
|
@@ -35,7 +35,7 @@ def create_customer_shipping_address(
|
|
|
35
35
|
address=new_address,
|
|
36
36
|
defaultShippingAddress=str(default).lower(),
|
|
37
37
|
)
|
|
38
|
-
return
|
|
38
|
+
return execute_controller(
|
|
39
39
|
apicontrollers.createCustomerShippingAddressController(request)
|
|
40
40
|
)
|
|
41
41
|
|
|
@@ -59,7 +59,7 @@ def get_customer_shipping_address(
|
|
|
59
59
|
customerProfileId=str(customer_profile_id),
|
|
60
60
|
customerAddressId=str(customer_address_profile_id),
|
|
61
61
|
)
|
|
62
|
-
return
|
|
62
|
+
return execute_controller(
|
|
63
63
|
apicontrollers.getCustomerShippingAddressController(request)
|
|
64
64
|
)
|
|
65
65
|
|
|
@@ -88,7 +88,7 @@ def update_customer_shipping_address(
|
|
|
88
88
|
address=new_address,
|
|
89
89
|
defaultShippingAddress=str(default).lower(),
|
|
90
90
|
)
|
|
91
|
-
return
|
|
91
|
+
return execute_controller(
|
|
92
92
|
apicontrollers.updateCustomerShippingAddressController(request)
|
|
93
93
|
)
|
|
94
94
|
|
|
@@ -112,6 +112,6 @@ def delete_customer_shipping_address(
|
|
|
112
112
|
customerProfileId=str(customer_profile_id),
|
|
113
113
|
customerAddressId=str(customer_address_profile_id),
|
|
114
114
|
)
|
|
115
|
-
return
|
|
115
|
+
return execute_controller(
|
|
116
116
|
apicontrollers.deleteCustomerShippingAddressController(request)
|
|
117
117
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from authorizenet import apicontractsv1, apicontrollers
|
|
2
2
|
|
|
3
3
|
from terminusgps.authorizenet.auth import get_merchant_auth, get_validation_mode
|
|
4
|
-
from terminusgps.authorizenet.controllers import
|
|
4
|
+
from terminusgps.authorizenet.controllers import execute_controller
|
|
5
5
|
|
|
6
6
|
__all__ = [
|
|
7
7
|
"create_customer_profile",
|
|
@@ -33,9 +33,7 @@ def create_customer_profile(merchant_id: int | str, email: str, description: str
|
|
|
33
33
|
),
|
|
34
34
|
validationMode=get_validation_mode(),
|
|
35
35
|
)
|
|
36
|
-
return
|
|
37
|
-
apicontrollers.createCustomerProfileController(request)
|
|
38
|
-
)
|
|
36
|
+
return execute_controller(apicontrollers.createCustomerProfileController(request))
|
|
39
37
|
|
|
40
38
|
|
|
41
39
|
def get_customer_profile(customer_profile_id: int, include_issuer_info: bool = False):
|
|
@@ -55,9 +53,7 @@ def get_customer_profile(customer_profile_id: int, include_issuer_info: bool = F
|
|
|
55
53
|
customerProfileId=str(customer_profile_id),
|
|
56
54
|
includeIssuerInfo=str(include_issuer_info).lower(),
|
|
57
55
|
)
|
|
58
|
-
return
|
|
59
|
-
apicontrollers.getCustomerProfileController(request)
|
|
60
|
-
)
|
|
56
|
+
return execute_controller(apicontrollers.getCustomerProfileController(request))
|
|
61
57
|
|
|
62
58
|
|
|
63
59
|
def get_customer_profile_ids():
|
|
@@ -71,9 +67,7 @@ def get_customer_profile_ids():
|
|
|
71
67
|
request = apicontractsv1.getCustomerProfileIdsRequest(
|
|
72
68
|
merchantAuthentication=get_merchant_auth()
|
|
73
69
|
)
|
|
74
|
-
return
|
|
75
|
-
apicontrollers.getCustomerProfileIdsController(request)
|
|
76
|
-
)
|
|
70
|
+
return execute_controller(apicontrollers.getCustomerProfileIdsController(request))
|
|
77
71
|
|
|
78
72
|
|
|
79
73
|
def update_customer_profile(
|
|
@@ -94,9 +88,7 @@ def update_customer_profile(
|
|
|
94
88
|
request = apicontractsv1.updateCustomerProfileRequest(
|
|
95
89
|
merchantAuthentication=get_merchant_auth(), profile=new_profile
|
|
96
90
|
)
|
|
97
|
-
return
|
|
98
|
-
apicontrollers.updateCustomerProfileController(request)
|
|
99
|
-
)
|
|
91
|
+
return execute_controller(apicontrollers.updateCustomerProfileController(request))
|
|
100
92
|
|
|
101
93
|
|
|
102
94
|
def delete_customer_profile(customer_profile_id: int):
|
|
@@ -113,6 +105,4 @@ def delete_customer_profile(customer_profile_id: int):
|
|
|
113
105
|
merchantAuthentication=get_merchant_auth(),
|
|
114
106
|
customerProfileId=str(customer_profile_id),
|
|
115
107
|
)
|
|
116
|
-
return
|
|
117
|
-
apicontrollers.deleteCustomerProfileController(request)
|
|
118
|
-
)
|
|
108
|
+
return execute_controller(apicontrollers.deleteCustomerProfileController(request))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from authorizenet import apicontractsv1, apicontrollers
|
|
2
2
|
|
|
3
3
|
from terminusgps.authorizenet.auth import get_merchant_auth, get_validation_mode
|
|
4
|
-
from terminusgps.authorizenet.controllers import
|
|
4
|
+
from terminusgps.authorizenet.controllers import execute_controller
|
|
5
5
|
|
|
6
6
|
__all__ = [
|
|
7
7
|
"create_customer_payment_profile",
|
|
@@ -33,7 +33,7 @@ def create_customer_payment_profile(
|
|
|
33
33
|
paymentProfile=new_payment_profile,
|
|
34
34
|
validationMode=get_validation_mode(),
|
|
35
35
|
)
|
|
36
|
-
return
|
|
36
|
+
return execute_controller(
|
|
37
37
|
apicontrollers.createCustomerPaymentProfileController(request)
|
|
38
38
|
)
|
|
39
39
|
|
|
@@ -62,7 +62,7 @@ def get_customer_payment_profile(
|
|
|
62
62
|
customerPaymentProfileId=str(customer_payment_profile_id),
|
|
63
63
|
includeIssuerInfo=str(include_issuer_info).lower(),
|
|
64
64
|
)
|
|
65
|
-
return
|
|
65
|
+
return execute_controller(
|
|
66
66
|
apicontrollers.getCustomerPaymentProfileController(request)
|
|
67
67
|
)
|
|
68
68
|
|
|
@@ -87,7 +87,7 @@ def validate_customer_payment_profile(
|
|
|
87
87
|
customerPaymentProfileId=str(customer_payment_profile_id),
|
|
88
88
|
validationMode=get_validation_mode(),
|
|
89
89
|
)
|
|
90
|
-
return
|
|
90
|
+
return execute_controller(
|
|
91
91
|
apicontrollers.validateCustomerPaymentProfileController(request)
|
|
92
92
|
)
|
|
93
93
|
|
|
@@ -117,7 +117,7 @@ def update_customer_payment_profile(
|
|
|
117
117
|
paymentProfile=new_payment_profile,
|
|
118
118
|
validationMode=get_validation_mode(),
|
|
119
119
|
)
|
|
120
|
-
return
|
|
120
|
+
return execute_controller(
|
|
121
121
|
apicontrollers.updateCustomerPaymentProfileController(request)
|
|
122
122
|
)
|
|
123
123
|
|
|
@@ -141,6 +141,6 @@ def delete_customer_payment_profile(
|
|
|
141
141
|
customerProfileId=str(customer_profile_id),
|
|
142
142
|
customerPaymentProfileId=str(customer_payment_profile_id),
|
|
143
143
|
)
|
|
144
|
-
return
|
|
144
|
+
return execute_controller(
|
|
145
145
|
apicontrollers.deleteCustomerPaymentProfileController(request)
|
|
146
146
|
)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
from authorizenet import apicontractsv1, apicontrollers
|
|
2
|
+
|
|
3
|
+
from terminusgps.authorizenet.auth import get_merchant_auth
|
|
4
|
+
from terminusgps.authorizenet.controllers import execute_controller
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def create_subscription(subscription_obj: apicontractsv1.ARBSubscriptionType):
|
|
8
|
+
"""
|
|
9
|
+
`ARBCreateSubscriptionRequest <https://developer.authorize.net/api/reference/index.html#recurring-billing-create-a-subscription>`_.
|
|
10
|
+
|
|
11
|
+
:param subscription_obj: An Authorizenet subscription object.
|
|
12
|
+
:type subscription_obj: :py:obj:`~authorizenet.apicontractsv1.ARBSubscriptionType`
|
|
13
|
+
:returns: An Authorizenet ARBCreateSubscription response.
|
|
14
|
+
:rtype: :py:obj:`dict`
|
|
15
|
+
|
|
16
|
+
"""
|
|
17
|
+
request = apicontractsv1.ARBCreateSubscriptionRequest(
|
|
18
|
+
merchantAuthentication=get_merchant_auth(), subscription=subscription_obj
|
|
19
|
+
)
|
|
20
|
+
return execute_controller(apicontrollers.ARBCreateSubscriptionController(request))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_subscription(subscription_id: int, include_transactions: bool = True):
|
|
24
|
+
"""
|
|
25
|
+
`ARBGetSubscriptionRequest <https://developer.authorize.net/api/reference/index.html#recurring-billing-get-subscription>`_.
|
|
26
|
+
|
|
27
|
+
:param subscription_id: An Authorizenet subscription id.
|
|
28
|
+
:type subscription_id: :py:obj:`int`
|
|
29
|
+
:param include_transactions: Whether or not to include the subscription transaction list in the response. Default is :py:obj:`True`.
|
|
30
|
+
:type include_transactions: :py:obj:`bool`
|
|
31
|
+
:returns: An Authorizenet ARBGetSubscription response.
|
|
32
|
+
:rtype: :py:obj:`dict`
|
|
33
|
+
|
|
34
|
+
"""
|
|
35
|
+
request = apicontractsv1.ARBGetSubscriptionRequest(
|
|
36
|
+
merchantAuthentication=get_merchant_auth(),
|
|
37
|
+
subscriptionId=str(subscription_id),
|
|
38
|
+
includeTransactions=str(include_transactions).lower(),
|
|
39
|
+
)
|
|
40
|
+
return execute_controller(apicontrollers.ARBGetSubscriptionController(request))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def get_subscription_status(subscription_id: int):
|
|
44
|
+
"""
|
|
45
|
+
`ARBGetSubscriptionStatusRequest <https://developer.authorize.net/api/reference/index.html#recurring-billing-get-subscription-status>`_.
|
|
46
|
+
|
|
47
|
+
:param subscription_id: An Authorizenet subscription id.
|
|
48
|
+
:type subscription_id: :py:obj:`int`
|
|
49
|
+
:returns: An Authorizenet ARBGetSubscriptionStatus response.
|
|
50
|
+
:rtype: :py:obj:`dict`
|
|
51
|
+
|
|
52
|
+
"""
|
|
53
|
+
request = apicontractsv1.ARBGetSubscriptionStatusRequest(
|
|
54
|
+
merchantAuthentication=get_merchant_auth(), subscriptionId=str(subscription_id)
|
|
55
|
+
)
|
|
56
|
+
return execute_controller(
|
|
57
|
+
apicontrollers.ARBGetSubscriptionStatusController(request)
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def update_subscription(
|
|
62
|
+
subscription_id: int, subscription_obj: apicontractsv1.ARBSubscriptionType
|
|
63
|
+
):
|
|
64
|
+
"""
|
|
65
|
+
`ARBUpdateSubscriptionRequest <https://developer.authorize.net/api/reference/index.html#recurring-billing-update-a-subscription>`_.
|
|
66
|
+
|
|
67
|
+
:param subscription_id: An Authorizenet subscription id.
|
|
68
|
+
:type subscription_id: :py:obj:`int`
|
|
69
|
+
:param subscription_obj: An Authorizenet subscription object.
|
|
70
|
+
:type subscription_obj: :py:obj:`~authorizenet.apicontractsv1.ARBSubscriptionType`
|
|
71
|
+
:returns: An Authorizenet ARBUpdateSubscription response.
|
|
72
|
+
:rtype: :py:obj:`dict`
|
|
73
|
+
|
|
74
|
+
"""
|
|
75
|
+
request = apicontractsv1.ARBUpdateSubscriptionRequest(
|
|
76
|
+
merchantAuthentication=get_merchant_auth(),
|
|
77
|
+
subscriptionId=str(subscription_id),
|
|
78
|
+
subscription=subscription_obj,
|
|
79
|
+
)
|
|
80
|
+
return execute_controller(apicontrollers.ARBUpdateSubscriptionController(request))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def cancel_subscription(subscription_id: int):
|
|
84
|
+
"""
|
|
85
|
+
`ARBCancelSubscriptionRequest <https://developer.authorize.net/api/reference/index.html#recurring-billing-cancel-a-subscription>`_.
|
|
86
|
+
|
|
87
|
+
:param subscription_id: An Authorizenet subscription id.
|
|
88
|
+
:type subscription_id: :py:obj:`int`
|
|
89
|
+
:returns: An Authorizenet ARBCancelSubscription response.
|
|
90
|
+
:rtype: :py:obj:`dict`
|
|
91
|
+
|
|
92
|
+
"""
|
|
93
|
+
request = apicontractsv1.ARBCancelSubscriptionRequest(
|
|
94
|
+
merchantAuthentication=get_merchant_auth(), subscriptionId=str(subscription_id)
|
|
95
|
+
)
|
|
96
|
+
return execute_controller(apicontrollers.ARBCancelSubscriptionController(request))
|
|
File without changes
|
{python_terminusgps-40.0.0.dist-info → python_terminusgps-40.1.0.dist-info}/licenses/COPYING
RENAMED
|
File without changes
|