python-terminusgps 1.8.0__tar.gz → 1.9.1__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.
Potentially problematic release.
This version of python-terminusgps might be problematic. Click here for more details.
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/PKG-INFO +1 -1
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/pyproject.toml +1 -1
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/authorizenet/profiles/addresses.py +42 -19
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/authorizenet/profiles/base.py +2 -2
- python_terminusgps-1.9.1/terminusgps/authorizenet/profiles/customers.py +109 -0
- python_terminusgps-1.9.1/terminusgps/authorizenet/profiles/payments.py +118 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/settings.py +2 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/uv.lock +7 -7
- python_terminusgps-1.8.0/terminusgps/authorizenet/profiles/customers.py +0 -72
- python_terminusgps-1.8.0/terminusgps/authorizenet/profiles/payments.py +0 -90
- python_terminusgps-1.8.0/terminusgps/test.py +0 -55
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/.gitignore +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/COPYING +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/README.md +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/requirements.txt +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/__init__.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/authorizenet/__init__.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/authorizenet/auth.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/aws/__init__.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/aws/secrets.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/__init__.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/constants.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/errors.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/flags.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/items/__init__.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/items/base.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/items/resource.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/items/retranslator.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/items/route.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/items/unit.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/items/unit_group.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/items/user.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/session.py +0 -0
- {python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.1
|
|
4
4
|
Summary: Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more.
|
|
5
5
|
Project-URL: Documentation, https://app.terminusgps.com/docs/apps/python-terminusgps/index.html
|
|
6
6
|
Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "python-terminusgps"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.9.1"
|
|
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" } ]
|
{python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/authorizenet/profiles/addresses.py
RENAMED
|
@@ -17,44 +17,67 @@ from terminusgps.authorizenet.profiles.base import AuthorizenetCustomerProfileBa
|
|
|
17
17
|
|
|
18
18
|
class AddressProfile(AuthorizenetCustomerProfileBase):
|
|
19
19
|
def create(self, **kwargs) -> int:
|
|
20
|
-
|
|
21
|
-
raise ValueError("'address' is required on creation.")
|
|
20
|
+
shipping_addr = kwargs.get("shipping_addr")
|
|
22
21
|
|
|
22
|
+
if not shipping_addr:
|
|
23
|
+
raise ValueError("'shipping_addr' is required on creation.")
|
|
24
|
+
|
|
25
|
+
if not isinstance(shipping_addr, customerAddressType):
|
|
26
|
+
raise TypeError(
|
|
27
|
+
f"'shipping_addr' must be customerAddressType, got '{type(shipping_addr)}'."
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
return self._authorizenet_create_shipping_address(shipping_addr)
|
|
31
|
+
|
|
32
|
+
def delete(self) -> None:
|
|
33
|
+
self._authorizenet_delete_shipping_address()
|
|
34
|
+
|
|
35
|
+
def update(self, shipping_addr: customerAddressType) -> None:
|
|
36
|
+
self._authorizenet_update_shipping_address(shipping_addr)
|
|
37
|
+
|
|
38
|
+
def get_details(self) -> dict:
|
|
39
|
+
return self._authorizenet_get_shipping_address()
|
|
40
|
+
|
|
41
|
+
def _authorizenet_create_shipping_address(self, addr: customerAddressType) -> int:
|
|
23
42
|
request = createCustomerShippingAddressRequest(
|
|
24
43
|
merchantAuthentication=self.merchantAuthentication,
|
|
25
44
|
customerProfileId=self.customerProfileId,
|
|
26
|
-
address=
|
|
27
|
-
|
|
45
|
+
address=addr,
|
|
46
|
+
default=self.default,
|
|
28
47
|
)
|
|
29
48
|
controller = createCustomerShippingAddressController(request)
|
|
30
49
|
response = self.execute_controller(controller)
|
|
31
50
|
return int(response.get("customerAddressId"))
|
|
32
51
|
|
|
33
|
-
def
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
customerProfileId=self.customerProfileId,
|
|
37
|
-
customerAddressId=self.id,
|
|
38
|
-
)
|
|
39
|
-
controller = deleteCustomerShippingAddressController(request)
|
|
40
|
-
self.execute_controller(controller)
|
|
41
|
-
|
|
42
|
-
def update(self, address: customerAddressType, default: bool = False) -> None:
|
|
52
|
+
def _authorizenet_update_shipping_address(self, addr: customerAddressType) -> None:
|
|
53
|
+
assert self.id, "'id' was not set."
|
|
54
|
+
addr.customerAddressId = self.id
|
|
43
55
|
request = updateCustomerShippingAddressRequest(
|
|
44
56
|
merchantAuthentication=self.merchantAuthentication,
|
|
45
57
|
customerProfileId=self.customerProfileId,
|
|
46
|
-
address=
|
|
47
|
-
|
|
58
|
+
address=addr,
|
|
59
|
+
default=self.default,
|
|
48
60
|
)
|
|
49
61
|
controller = updateCustomerShippingAddressController(request)
|
|
50
62
|
self.execute_controller(controller)
|
|
51
|
-
self._default = default
|
|
52
63
|
|
|
53
|
-
def
|
|
64
|
+
def _authorizenet_get_shipping_address(self) -> dict:
|
|
65
|
+
assert self.id, "'id' was not set."
|
|
54
66
|
request = getCustomerShippingAddressRequest(
|
|
55
67
|
merchantAuthentication=self.merchantAuthentication,
|
|
56
68
|
customerProfileId=self.customerProfileId,
|
|
57
69
|
customerAddressId=self.id,
|
|
58
70
|
)
|
|
59
71
|
controller = getCustomerShippingAddressController(request)
|
|
60
|
-
|
|
72
|
+
response = self.execute_controller(controller)
|
|
73
|
+
return response
|
|
74
|
+
|
|
75
|
+
def _authorizenet_delete_shipping_address(self) -> None:
|
|
76
|
+
assert self.id, "'id' was not set."
|
|
77
|
+
request = deleteCustomerShippingAddressRequest(
|
|
78
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
79
|
+
customerProfileId=self.customerProfileId,
|
|
80
|
+
customerAddressId=self.id,
|
|
81
|
+
)
|
|
82
|
+
controller = deleteCustomerShippingAddressController(request)
|
|
83
|
+
self.execute_controller(controller)
|
{python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/authorizenet/profiles/base.py
RENAMED
|
@@ -7,7 +7,7 @@ class AuthorizenetProfileBase:
|
|
|
7
7
|
self, merchant_id: int | str, id: int | str | None = None, **kwargs
|
|
8
8
|
) -> None:
|
|
9
9
|
self.merchant_id = merchant_id
|
|
10
|
-
self.id = id if id else str(self.create(**kwargs))
|
|
10
|
+
self.id = str(id) if id else str(self.create(**kwargs))
|
|
11
11
|
|
|
12
12
|
def __str__(self) -> str:
|
|
13
13
|
return f"#{self.id}"
|
|
@@ -59,4 +59,4 @@ class AuthorizenetCustomerProfileBase(AuthorizenetProfileBase):
|
|
|
59
59
|
|
|
60
60
|
@property
|
|
61
61
|
def default(self) -> str:
|
|
62
|
-
return
|
|
62
|
+
return str(self._default).lower()
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
from authorizenet.apicontrollers import (
|
|
2
|
+
createCustomerProfileController,
|
|
3
|
+
deleteCustomerProfileController,
|
|
4
|
+
getCustomerProfileController,
|
|
5
|
+
updateCustomerProfileController,
|
|
6
|
+
)
|
|
7
|
+
from authorizenet.apicontractsv1 import (
|
|
8
|
+
customerProfileType,
|
|
9
|
+
createCustomerProfileRequest,
|
|
10
|
+
deleteCustomerProfileRequest,
|
|
11
|
+
getCustomerProfileRequest,
|
|
12
|
+
updateCustomerProfileRequest,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
from terminusgps.authorizenet.profiles.base import AuthorizenetProfileBase
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class CustomerProfile(AuthorizenetProfileBase):
|
|
19
|
+
def create(self, **kwargs) -> int:
|
|
20
|
+
"""
|
|
21
|
+
Creates the customer profile.
|
|
22
|
+
|
|
23
|
+
:param email: An email address for the customer profile.
|
|
24
|
+
:type email: :py:obj:`str`
|
|
25
|
+
:param desc: A description describing the customer profile. Optional.
|
|
26
|
+
:type desc: :py:obj:`str` | :py:obj:`None`
|
|
27
|
+
:returns: The new customer profile id.
|
|
28
|
+
:rtype: :py:obj:`int`
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
if not kwargs.get("email"):
|
|
32
|
+
raise ValueError("'email' is required for creation.")
|
|
33
|
+
|
|
34
|
+
return self._authorizenet_create_customer_profile(
|
|
35
|
+
kwargs["email"], kwargs.get("desc", "")
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
def update(self, email: str, desc: str = "") -> None:
|
|
39
|
+
"""Updates the customer profile."""
|
|
40
|
+
return self._authorizenet_update_customer_profile(email, desc)
|
|
41
|
+
|
|
42
|
+
def delete(self) -> None:
|
|
43
|
+
"""Deletes the customer profile."""
|
|
44
|
+
return self._authorizenet_delete_customer_profile()
|
|
45
|
+
|
|
46
|
+
def get_payment_profiles(self) -> list[dict] | None:
|
|
47
|
+
"""Retrieves the customer profile's payment profiles list."""
|
|
48
|
+
profiles = self._authorizenet_get_customer_profile(issuer_info=False).get(
|
|
49
|
+
"paymentProfiles"
|
|
50
|
+
)
|
|
51
|
+
return profiles if profiles else None
|
|
52
|
+
|
|
53
|
+
def get_shipping_addresses(self) -> list[dict] | None:
|
|
54
|
+
"""Retrieves the customer profile's shipping address list."""
|
|
55
|
+
addresses = self._authorizenet_get_customer_profile(issuer_info=False).get(
|
|
56
|
+
"shipToList"
|
|
57
|
+
)
|
|
58
|
+
return addresses if addresses else None
|
|
59
|
+
|
|
60
|
+
def _authorizenet_create_customer_profile(self, email: str, desc: str = "") -> int:
|
|
61
|
+
"""Executes a :py:obj:`~authorizenet.apicontractsv1.createCustomerProfileRequest` using the Authorize.NET API."""
|
|
62
|
+
request = createCustomerProfileRequest(
|
|
63
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
64
|
+
profile=customerProfileType(
|
|
65
|
+
merchantCustomerId=self.merchantCustomerId,
|
|
66
|
+
email=email,
|
|
67
|
+
description=desc,
|
|
68
|
+
),
|
|
69
|
+
)
|
|
70
|
+
controller = createCustomerProfileController(request)
|
|
71
|
+
response = self.execute_controller(controller)
|
|
72
|
+
return int(response.customerProfileId)
|
|
73
|
+
|
|
74
|
+
def _authorizenet_delete_customer_profile(self) -> None:
|
|
75
|
+
"""Executes a :py:obj:`~authorizenet.apicontractsv1.deleteCustomerProfileRequest` using the Authorize.NET API."""
|
|
76
|
+
assert self.id, "'id' was not set."
|
|
77
|
+
request = deleteCustomerProfileRequest(
|
|
78
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
79
|
+
customerProfileId=str(self.id),
|
|
80
|
+
)
|
|
81
|
+
controller = deleteCustomerProfileController(request)
|
|
82
|
+
self.execute_controller(controller)
|
|
83
|
+
|
|
84
|
+
def _authorizenet_get_customer_profile(self, issuer_info: bool = True) -> dict:
|
|
85
|
+
"""Executes a :py:obj:`~authorizenet.apicontractsv1.getCustomerProfileRequest` using the Authorize.NET API."""
|
|
86
|
+
assert self.id, "'id' was not set."
|
|
87
|
+
request = getCustomerProfileRequest(
|
|
88
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
89
|
+
customerProfileId=self.id,
|
|
90
|
+
includeIssuerInfo=str(issuer_info).lower(),
|
|
91
|
+
)
|
|
92
|
+
controller = getCustomerProfileController(request)
|
|
93
|
+
response = self.execute_controller(controller)
|
|
94
|
+
return response
|
|
95
|
+
|
|
96
|
+
def _authorizenet_update_customer_profile(self, email: str, desc: str = "") -> None:
|
|
97
|
+
"""Executes an :py:obj:`~authorizenet.apicontractsv1.updateCustomerProfileRequest` using the Authorize.NET API."""
|
|
98
|
+
assert self.id, "'id' was not set."
|
|
99
|
+
request = updateCustomerProfileRequest(
|
|
100
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
101
|
+
profile=customerProfileType(
|
|
102
|
+
merchantCustomerId=self.merchantCustomerId,
|
|
103
|
+
email=email,
|
|
104
|
+
description=desc,
|
|
105
|
+
customerProfileId=self.id,
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
controller = updateCustomerProfileController(request)
|
|
109
|
+
self.execute_controller(controller)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
from authorizenet.apicontractsv1 import (
|
|
2
|
+
createCustomerPaymentProfileRequest,
|
|
3
|
+
customerAddressType,
|
|
4
|
+
deleteCustomerPaymentProfileRequest,
|
|
5
|
+
getCustomerPaymentProfileRequest,
|
|
6
|
+
paymentProfile,
|
|
7
|
+
paymentType,
|
|
8
|
+
validateCustomerPaymentProfileRequest,
|
|
9
|
+
updateCustomerPaymentProfileRequest,
|
|
10
|
+
)
|
|
11
|
+
from authorizenet.apicontrollers import (
|
|
12
|
+
createCustomerPaymentProfileController,
|
|
13
|
+
deleteCustomerPaymentProfileController,
|
|
14
|
+
getCustomerPaymentProfileController,
|
|
15
|
+
updateCustomerPaymentProfileController,
|
|
16
|
+
validateCustomerPaymentProfileController,
|
|
17
|
+
)
|
|
18
|
+
from terminusgps.authorizenet.profiles.base import AuthorizenetCustomerProfileBase
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class PaymentProfile(AuthorizenetCustomerProfileBase):
|
|
22
|
+
def create(self, **kwargs) -> int:
|
|
23
|
+
billing_addr = kwargs.get("billing_addr")
|
|
24
|
+
payment = kwargs.get("payment")
|
|
25
|
+
if not billing_addr:
|
|
26
|
+
raise ValueError("'billing_addr' is required on creation.")
|
|
27
|
+
if not payment:
|
|
28
|
+
raise ValueError("'payment' is required on creation.")
|
|
29
|
+
|
|
30
|
+
if not isinstance(billing_addr, customerAddressType):
|
|
31
|
+
raise TypeError(
|
|
32
|
+
f"'billing_addr' must be customerAddressType, got '{type(billing_addr)}'"
|
|
33
|
+
)
|
|
34
|
+
if not isinstance(payment, paymentType):
|
|
35
|
+
raise TypeError(
|
|
36
|
+
f"'payment' must be customerAddressType, got '{type(payment)}'"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
return self._authorizenet_create_payment_profile(billing_addr, payment)
|
|
40
|
+
|
|
41
|
+
def update(self, billing_addr: customerAddressType, payment: paymentType) -> None:
|
|
42
|
+
self._authorizenet_update_payment_profile(billing_addr, payment)
|
|
43
|
+
|
|
44
|
+
def delete(self) -> None:
|
|
45
|
+
self._authorizenet_delete_payment_profile()
|
|
46
|
+
|
|
47
|
+
def get_details(self, issuer_info: bool = False) -> dict:
|
|
48
|
+
return self._authorizenet_get_payment_profile(issuer_info)
|
|
49
|
+
|
|
50
|
+
def _authorizenet_create_payment_profile(
|
|
51
|
+
self, billing_addr: customerAddressType, payment: paymentType
|
|
52
|
+
) -> int:
|
|
53
|
+
"""Executes a :py:obj:`~authorizenet.apicontractsv1.createCustomerPaymentProfileRequest` using the Authorize.NET API."""
|
|
54
|
+
request = createCustomerPaymentProfileRequest(
|
|
55
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
56
|
+
customerProfileId=self.customerProfileId,
|
|
57
|
+
paymentProfile=paymentProfile(
|
|
58
|
+
billTo=billing_addr, payment=payment, default=self.default
|
|
59
|
+
),
|
|
60
|
+
validationMode=self.validationMode,
|
|
61
|
+
)
|
|
62
|
+
controller = createCustomerPaymentProfileController(request)
|
|
63
|
+
response = self.execute_controller(controller)
|
|
64
|
+
return int(response.get("customerPaymentProfileId"))
|
|
65
|
+
|
|
66
|
+
def _authorizenet_update_payment_profile(
|
|
67
|
+
self, billing_addr: customerAddressType, payment: paymentType
|
|
68
|
+
) -> None:
|
|
69
|
+
"""Executes an :py:obj:`~authorizenet.apicontractsv1.updateCustomerPaymentProfileRequest` using the Authorize.NET API."""
|
|
70
|
+
assert self.id, "'id' was not set."
|
|
71
|
+
request = updateCustomerPaymentProfileRequest(
|
|
72
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
73
|
+
customerProfileId=self.customerProfileId,
|
|
74
|
+
paymentProfile=paymentProfile(
|
|
75
|
+
billTo=billing_addr,
|
|
76
|
+
payment=payment,
|
|
77
|
+
defaultPaymentProfile=self.default,
|
|
78
|
+
customerPaymentProfileId=self.id,
|
|
79
|
+
),
|
|
80
|
+
validationMode=self.validationMode,
|
|
81
|
+
)
|
|
82
|
+
controller = updateCustomerPaymentProfileController(request)
|
|
83
|
+
self.execute_controller(controller)
|
|
84
|
+
|
|
85
|
+
def _authorizenet_get_payment_profile(self, issuer_info: bool = False) -> dict:
|
|
86
|
+
"""Executes a :py:obj:`~authorizenet.apicontractsv1.getCustomerPaymentProfileRequest` using the Authorize.NET API."""
|
|
87
|
+
assert self.id, "'id' was not set."
|
|
88
|
+
request = getCustomerPaymentProfileRequest(
|
|
89
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
90
|
+
customerProfileId=self.customerProfileId,
|
|
91
|
+
customerPaymentProfileId=self.id,
|
|
92
|
+
includeIssuerInfo=str(issuer_info).lower(),
|
|
93
|
+
)
|
|
94
|
+
controller = getCustomerPaymentProfileController(request)
|
|
95
|
+
return self.execute_controller(controller)
|
|
96
|
+
|
|
97
|
+
def _authorizenet_validate_payment_profile(self) -> None:
|
|
98
|
+
"""Executes a :py:obj:`~authorizenet.apicontractsv1.validateCustomerPaymentProfileRequest` using the Authorize.NET API."""
|
|
99
|
+
assert self.id, "'id' was not set."
|
|
100
|
+
request = validateCustomerPaymentProfileRequest(
|
|
101
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
102
|
+
customerProfileId=self.customerProfileId,
|
|
103
|
+
customerPaymentProfileId=self.id,
|
|
104
|
+
validationMode=self.validationMode,
|
|
105
|
+
)
|
|
106
|
+
controller = validateCustomerPaymentProfileController(request)
|
|
107
|
+
self.execute_controller(controller)
|
|
108
|
+
|
|
109
|
+
def _authorizenet_delete_payment_profile(self) -> None:
|
|
110
|
+
"""Executes a :py:obj:`~authorizenet.apicontractsv1.deleteCustomerPaymentProfileRequest` using the Authorize.NET API."""
|
|
111
|
+
assert self.id, "'id' was not set."
|
|
112
|
+
request = deleteCustomerPaymentProfileRequest(
|
|
113
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
114
|
+
customerProfileId=self.customerProfileId,
|
|
115
|
+
customerPaymentProfileId=self.id,
|
|
116
|
+
)
|
|
117
|
+
controller = deleteCustomerPaymentProfileController(request)
|
|
118
|
+
self.execute_controller(controller)
|
|
@@ -6,3 +6,5 @@ WIALON_ADMIN_ID = getenv("WIALON_ADMIN_ID")
|
|
|
6
6
|
WIALON_TOKEN = getenv("WIALON_TOKEN")
|
|
7
7
|
MERCHANT_AUTH_LOGIN_ID = getenv("MERCHANT_AUTH_LOGIN_ID")
|
|
8
8
|
MERCHANT_AUTH_TRANSACTION_KEY = getenv("MERCHANT_AUTH_TRANSACTION_KEY")
|
|
9
|
+
QB_CLIENT_ID = getenv("QB_CLIENT_ID")
|
|
10
|
+
QB_CLIENT_SECRET = getenv("QB_CLIENT_ID")
|
|
@@ -50,30 +50,30 @@ wheels = [
|
|
|
50
50
|
|
|
51
51
|
[[package]]
|
|
52
52
|
name = "boto3"
|
|
53
|
-
version = "1.36.
|
|
53
|
+
version = "1.36.12"
|
|
54
54
|
source = { registry = "https://pypi.org/simple" }
|
|
55
55
|
dependencies = [
|
|
56
56
|
{ name = "botocore" },
|
|
57
57
|
{ name = "jmespath" },
|
|
58
58
|
{ name = "s3transfer" },
|
|
59
59
|
]
|
|
60
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
60
|
+
sdist = { url = "https://files.pythonhosted.org/packages/04/2b/7365aab02b6768a9694ff43e0e5f1f83f205fc7fe253a410cda990425048/boto3-1.36.12.tar.gz", hash = "sha256:287d84f49bba3255a17b374578127d42b6251e72f55914a62e0ad9ca78c0954b", size = 111048 }
|
|
61
61
|
wheels = [
|
|
62
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
62
|
+
{ url = "https://files.pythonhosted.org/packages/d0/0b/eb4d244ea84b0fd9e255286a30c98f37f8f28bbf6ea85f7f4b734bf929a9/boto3-1.36.12-py3-none-any.whl", hash = "sha256:32cdf0967287f3ec25a9dc09df0d29cb86b8900c3e0546a63d672775d8127abf", size = 139178 },
|
|
63
63
|
]
|
|
64
64
|
|
|
65
65
|
[[package]]
|
|
66
66
|
name = "botocore"
|
|
67
|
-
version = "1.36.
|
|
67
|
+
version = "1.36.12"
|
|
68
68
|
source = { registry = "https://pypi.org/simple" }
|
|
69
69
|
dependencies = [
|
|
70
70
|
{ name = "jmespath" },
|
|
71
71
|
{ name = "python-dateutil" },
|
|
72
72
|
{ name = "urllib3" },
|
|
73
73
|
]
|
|
74
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
74
|
+
sdist = { url = "https://files.pythonhosted.org/packages/fe/54/cc9a665f92534aa105a49dd867f18d4eff4687835994a70a32a103fa11ae/botocore-1.36.12.tar.gz", hash = "sha256:86ed88beb4f244c96529435c868d3940073c2774116f0023fb7691f6e7053bd9", size = 13498321 }
|
|
75
75
|
wheels = [
|
|
76
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
76
|
+
{ url = "https://files.pythonhosted.org/packages/92/3a/5e19d1d1896e86bb9c25f31f5f05ff2e8f40727aa66ee6149b545d3e28b0/botocore-1.36.12-py3-none-any.whl", hash = "sha256:5ae1ed362c8ed908a6ced8cdd12b21e2196c100bc79f9e95c9c1fc7f9ea74f5a", size = 13328293 },
|
|
77
77
|
]
|
|
78
78
|
|
|
79
79
|
[[package]]
|
|
@@ -285,7 +285,7 @@ wheels = [
|
|
|
285
285
|
|
|
286
286
|
[[package]]
|
|
287
287
|
name = "python-terminusgps"
|
|
288
|
-
version = "1.
|
|
288
|
+
version = "1.9.0"
|
|
289
289
|
source = { editable = "." }
|
|
290
290
|
dependencies = [
|
|
291
291
|
{ name = "argparse" },
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
from authorizenet.apicontrollers import (
|
|
2
|
-
createCustomerProfileController,
|
|
3
|
-
deleteCustomerProfileController,
|
|
4
|
-
getCustomerProfileController,
|
|
5
|
-
updateCustomerProfileController,
|
|
6
|
-
)
|
|
7
|
-
from authorizenet.apicontractsv1 import (
|
|
8
|
-
customerProfileType,
|
|
9
|
-
createCustomerProfileRequest,
|
|
10
|
-
deleteCustomerProfileRequest,
|
|
11
|
-
getCustomerProfileRequest,
|
|
12
|
-
updateCustomerProfileRequest,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
from terminusgps.authorizenet.profiles.base import AuthorizenetProfileBase
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class CustomerProfile(AuthorizenetProfileBase):
|
|
19
|
-
def create(self, **kwargs) -> int:
|
|
20
|
-
if not kwargs.get("email"):
|
|
21
|
-
raise ValueError("'email' is required for creation.")
|
|
22
|
-
|
|
23
|
-
request = createCustomerProfileRequest(
|
|
24
|
-
merchantAuthentication=self.merchantAuthentication,
|
|
25
|
-
profile=customerProfileType(
|
|
26
|
-
merchantCustomerId=self.merchantCustomerId,
|
|
27
|
-
email=kwargs["email"],
|
|
28
|
-
description=kwargs.get("desc", ""),
|
|
29
|
-
),
|
|
30
|
-
)
|
|
31
|
-
controller = createCustomerProfileController(request)
|
|
32
|
-
response = self.execute_controller(controller)
|
|
33
|
-
return int(response.customerProfileId)
|
|
34
|
-
|
|
35
|
-
def update(self, merchant_id: str, email: str, desc: str = "") -> None:
|
|
36
|
-
request = updateCustomerProfileRequest(
|
|
37
|
-
merchantAuthentication=self.merchantAuthentication,
|
|
38
|
-
profile=CustomerProfile(
|
|
39
|
-
self.id, merchantCustomerId=merchant_id, email=email, description=desc
|
|
40
|
-
),
|
|
41
|
-
)
|
|
42
|
-
controller = updateCustomerProfileController(request)
|
|
43
|
-
self.execute_controller(controller)
|
|
44
|
-
|
|
45
|
-
def delete(self) -> None:
|
|
46
|
-
request = deleteCustomerProfileRequest(
|
|
47
|
-
merchantAuthentication=self.merchantAuthentication,
|
|
48
|
-
customerProfileId=str(self.id),
|
|
49
|
-
)
|
|
50
|
-
controller = deleteCustomerProfileController(request)
|
|
51
|
-
self.execute_controller(controller)
|
|
52
|
-
|
|
53
|
-
@property
|
|
54
|
-
def payment_profiles(self) -> list[dict]:
|
|
55
|
-
request = getCustomerProfileRequest(
|
|
56
|
-
merchantAuthentication=self.merchantAuthentication,
|
|
57
|
-
customerProfileId=self.id,
|
|
58
|
-
includeIssuerInfo="true",
|
|
59
|
-
)
|
|
60
|
-
controller = getCustomerProfileController(request)
|
|
61
|
-
response = self.execute_controller(controller)
|
|
62
|
-
return response
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def main() -> None:
|
|
66
|
-
profile = CustomerProfile(merchant_id=55, id=522226003)
|
|
67
|
-
profile.delete()
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if __name__ == "__main__":
|
|
72
|
-
main()
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
from authorizenet.apicontractsv1 import (
|
|
2
|
-
createCustomerPaymentProfileRequest,
|
|
3
|
-
getCustomerPaymentProfileRequest,
|
|
4
|
-
deleteCustomerPaymentProfileRequest,
|
|
5
|
-
paymentProfile,
|
|
6
|
-
validateCustomerPaymentProfileRequest,
|
|
7
|
-
)
|
|
8
|
-
from authorizenet.apicontrollers import (
|
|
9
|
-
createCustomerPaymentProfileController,
|
|
10
|
-
deleteCustomerPaymentProfileController,
|
|
11
|
-
getCustomerPaymentProfileController,
|
|
12
|
-
validateCustomerPaymentProfileController,
|
|
13
|
-
)
|
|
14
|
-
from terminusgps.authorizenet.profiles.base import AuthorizenetCustomerProfileBase
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class PaymentProfile(AuthorizenetCustomerProfileBase):
|
|
18
|
-
def create(self, **kwargs) -> int:
|
|
19
|
-
"""
|
|
20
|
-
Creates an Authorize.NET payment profile.
|
|
21
|
-
|
|
22
|
-
:param billing_address: A billing address for the payment profile.
|
|
23
|
-
:type billing_address: :py:obj:`~authorizenet.apicontractsv1.customerAddressType`
|
|
24
|
-
:param payment: An Authorize.NET API payment object. Usually a credit card, but could be a bank account.
|
|
25
|
-
:type payment: :py:obj:`~authorizenet.apicontractsv1.paymentType`
|
|
26
|
-
:param default: Whether or not the payment method should be marked as default. Default is :py:obj:`False`.
|
|
27
|
-
:type default: :py:obj:`bool`
|
|
28
|
-
:returns: The new payment profile id.
|
|
29
|
-
:rtype: :py:obj:`int`
|
|
30
|
-
|
|
31
|
-
"""
|
|
32
|
-
if not kwargs.get("billing_address"):
|
|
33
|
-
raise ValueError("'billing_address' is required on creation.")
|
|
34
|
-
if not kwargs.get("payment"):
|
|
35
|
-
raise ValueError("'payment' is required on creation.")
|
|
36
|
-
|
|
37
|
-
request = createCustomerPaymentProfileRequest(
|
|
38
|
-
merchantAuthentication=self.merchantAuthentication,
|
|
39
|
-
customerProfileId=self.customerProfileId,
|
|
40
|
-
paymentProfile=paymentProfile(
|
|
41
|
-
billTo=kwargs["billing_address"],
|
|
42
|
-
payment=kwargs["payment"],
|
|
43
|
-
defaultPaymentProfile=self.default,
|
|
44
|
-
),
|
|
45
|
-
validationMode=self.validationMode,
|
|
46
|
-
)
|
|
47
|
-
controller = createCustomerPaymentProfileController(request)
|
|
48
|
-
response = self.execute_controller(controller)
|
|
49
|
-
return int(response.get("customerPaymentProfileId"))
|
|
50
|
-
|
|
51
|
-
def delete(self) -> None:
|
|
52
|
-
"""Deletes the Authorize.NET payment profile."""
|
|
53
|
-
request = deleteCustomerPaymentProfileRequest(
|
|
54
|
-
merchantAuthentication=self.merchantAuthentication,
|
|
55
|
-
customerProfileId=self.customerProfileId,
|
|
56
|
-
customerPaymentProfileId=self.id,
|
|
57
|
-
)
|
|
58
|
-
controller = deleteCustomerPaymentProfileController(request)
|
|
59
|
-
self.execute_controller(controller)
|
|
60
|
-
|
|
61
|
-
def validate(self) -> None:
|
|
62
|
-
"""Validates the Authorize.NET payment profile."""
|
|
63
|
-
request = validateCustomerPaymentProfileRequest(
|
|
64
|
-
merchantAuthentication=self.merchantAuthentication,
|
|
65
|
-
customerProfileId=self.customerProfileId,
|
|
66
|
-
customerPaymentProfileId=self.id,
|
|
67
|
-
validationMode=self.validationMode,
|
|
68
|
-
)
|
|
69
|
-
controller = validateCustomerPaymentProfileController(request)
|
|
70
|
-
self.execute_controller(controller)
|
|
71
|
-
|
|
72
|
-
def get_details(self, issuer_info: bool = False) -> dict:
|
|
73
|
-
"""
|
|
74
|
-
Calls the Authorize.NET API and retrieves the payment profile.
|
|
75
|
-
|
|
76
|
-
:param issuer_info: Whether or not Authorize.NET should return issuer info for the payment profile.
|
|
77
|
-
:type issuer_info: :py:obj:`bool`
|
|
78
|
-
:returns: The Authorize.NET API payment profile.
|
|
79
|
-
:rtype: :py:obj:`~authorizenet.apicontractsv1.paymentProfile`
|
|
80
|
-
|
|
81
|
-
"""
|
|
82
|
-
request = getCustomerPaymentProfileRequest(
|
|
83
|
-
merchantAuthentication=self.merchantAuthentication,
|
|
84
|
-
customerProfileId=self.customerProfileId,
|
|
85
|
-
customerPaymentProfileId=self.id,
|
|
86
|
-
includeIssuerInfo="true" if issuer_info else "false",
|
|
87
|
-
)
|
|
88
|
-
controller = getCustomerPaymentProfileController(request)
|
|
89
|
-
response = self.execute_controller(controller)
|
|
90
|
-
return response
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
from django.utils import timezone
|
|
2
|
-
from terminusgps.wialon.session import WialonSession
|
|
3
|
-
from terminusgps.wialon.utils import get_hw_type_id, gen_wialon_password
|
|
4
|
-
from terminusgps.wialon.items import WialonUser, WialonResource, WialonUnit
|
|
5
|
-
from terminusgps.wialon import constants
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def registration_test() -> None:
|
|
9
|
-
timestamp = f"{timezone.now():%y-%m-%d-%H:%M:%S}"
|
|
10
|
-
|
|
11
|
-
with WialonSession() as session:
|
|
12
|
-
print(f"Running test '{registration_test.__name__}' as '{session.username}'...")
|
|
13
|
-
hw_type_id = get_hw_type_id(name="Test HW", session=session)
|
|
14
|
-
|
|
15
|
-
super_user = WialonUser(
|
|
16
|
-
creator_id=session.uid,
|
|
17
|
-
name=f"super_user_{timestamp}",
|
|
18
|
-
password=gen_wialon_password(length=32),
|
|
19
|
-
session=session,
|
|
20
|
-
)
|
|
21
|
-
resource = WialonResource(
|
|
22
|
-
creator_id=super_user.id, name=f"resource_{timestamp}", session=session
|
|
23
|
-
)
|
|
24
|
-
unit = WialonUnit(
|
|
25
|
-
creator_id=session.uid,
|
|
26
|
-
name=f"test_unit_{timestamp}",
|
|
27
|
-
hw_type_id=hw_type_id,
|
|
28
|
-
session=session,
|
|
29
|
-
)
|
|
30
|
-
super_user.grant_access(unit, access_mask=constants.ACCESSMASK_UNIT_MIGRATION)
|
|
31
|
-
resource.create_account("terminusgps_ext_hist")
|
|
32
|
-
resource.migrate_unit(unit)
|
|
33
|
-
end_user = WialonUser(
|
|
34
|
-
creator_id=super_user.id,
|
|
35
|
-
name=f"end_user_{timestamp}",
|
|
36
|
-
password=gen_wialon_password(length=32),
|
|
37
|
-
session=session,
|
|
38
|
-
)
|
|
39
|
-
end_user.grant_access(unit, access_mask=constants.ACCESSMASK_UNIT_BASIC)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def account_days_test() -> None:
|
|
43
|
-
timestamp = f"{timezone.now():%y-%m-%d-%H:%M:%S}"
|
|
44
|
-
|
|
45
|
-
with WialonSession() as session:
|
|
46
|
-
print(f"Running test '{account_days_test.__name__}' as '{session.username}'...")
|
|
47
|
-
account = WialonResource(id="28990259", session=session)
|
|
48
|
-
account.set_settings_flags(0x20)
|
|
49
|
-
account.set_minimum_days(0)
|
|
50
|
-
account.add_days(30)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if __name__ == "__main__":
|
|
54
|
-
registration_test()
|
|
55
|
-
account_days_test()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/items/retranslator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_terminusgps-1.8.0 → python_terminusgps-1.9.1}/terminusgps/wialon/items/unit_group.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|