python-terminusgps 1.7.0__py3-none-any.whl → 1.8.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.
Potentially problematic release.
This version of python-terminusgps might be problematic. Click here for more details.
- {python_terminusgps-1.7.0.dist-info → python_terminusgps-1.8.0.dist-info}/METADATA +1 -1
- {python_terminusgps-1.7.0.dist-info → python_terminusgps-1.8.0.dist-info}/RECORD +11 -7
- terminusgps/authorizenet/auth.py +20 -6
- terminusgps/authorizenet/profiles/addresses.py +60 -0
- terminusgps/authorizenet/profiles/base.py +62 -0
- terminusgps/authorizenet/profiles/customers.py +72 -0
- terminusgps/authorizenet/profiles/payments.py +90 -0
- terminusgps/settings.py +3 -1
- terminusgps/wialon/utils.py +26 -16
- {python_terminusgps-1.7.0.dist-info → python_terminusgps-1.8.0.dist-info}/WHEEL +0 -0
- {python_terminusgps-1.7.0.dist-info → python_terminusgps-1.8.0.dist-info}/licenses/COPYING +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.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://app.terminusgps.com/docs/apps/python-terminusgps/index.html
|
|
6
6
|
Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
terminusgps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
terminusgps/settings.py,sha256=
|
|
2
|
+
terminusgps/settings.py,sha256=Mdeuo6ghfW28QVrBqe5mwwX2_Lk79fJ5kLfR9LV7zZM,314
|
|
3
3
|
terminusgps/test.py,sha256=SmvDgRMqLnj_t29eWbckYjK7e9n-Yy-oWwlbN3IdhqE,2004
|
|
4
4
|
terminusgps/authorizenet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
terminusgps/authorizenet/auth.py,sha256=
|
|
5
|
+
terminusgps/authorizenet/auth.py,sha256=yznomWGTRbFiTDiugsRw1HqxJAV4aJKZFN3Bzdt_V8E,1119
|
|
6
|
+
terminusgps/authorizenet/profiles/addresses.py,sha256=WdJGYaQdjyn5QRP3_6lQx8ZseSopPv3hTZnn0fiXw8E,2490
|
|
7
|
+
terminusgps/authorizenet/profiles/base.py,sha256=LDggXdPmZdHtb5FwqPKGev7w9FE5k2XvtQelVRfDZ1I,1979
|
|
8
|
+
terminusgps/authorizenet/profiles/customers.py,sha256=ezyWSlpsLFsLezi11Z8GWzg-Qa36gGU1n9FwyFEmI7Y,2448
|
|
9
|
+
terminusgps/authorizenet/profiles/payments.py,sha256=BudjFkpfycQbhv2L5SPmg82GWyR0-nl-FlRqRQ1HP6U,3918
|
|
6
10
|
terminusgps/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
11
|
terminusgps/aws/secrets.py,sha256=kgRA77rs0mD4berWRLkPtJLOe4Grf--o5f8NzwQqXCk,360
|
|
8
12
|
terminusgps/wialon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -10,7 +14,7 @@ terminusgps/wialon/constants.py,sha256=aybYcNcHyar2lz_6BlQbMWpbcHW6eyJeq05QwuiqZ
|
|
|
10
14
|
terminusgps/wialon/errors.py,sha256=SV9pVwU6FZ_zGlGP6zJN6aLE2auF4TfHFISQLiPMKrI,1758
|
|
11
15
|
terminusgps/wialon/flags.py,sha256=-OoH-eZM54yjRqxsAXL8VImdQu_7C0OAxCrFqaCEuko,13510
|
|
12
16
|
terminusgps/wialon/session.py,sha256=segEjyt-K9AAlMq_OYLVtxFBp_jE5c3KL-AJQhOVa9U,9936
|
|
13
|
-
terminusgps/wialon/utils.py,sha256=
|
|
17
|
+
terminusgps/wialon/utils.py,sha256=9xJq5eAWm-vu0nJVJ7eUcwhJhMCrGjS1p__4CIBXYm4,3407
|
|
14
18
|
terminusgps/wialon/items/__init__.py,sha256=3BVthghekMvhMQSzQgBMlD_phxmKSmp3Zvmo-z0O8Bs,211
|
|
15
19
|
terminusgps/wialon/items/base.py,sha256=Z6aGEC2_m5CPHYCa1rgAvkGtSegbrvZ68mifCqo-07A,6617
|
|
16
20
|
terminusgps/wialon/items/resource.py,sha256=xElMYSMyKA5y8rIP0EeF429MBV2hbLZcS6SokftvrOs,5641
|
|
@@ -19,7 +23,7 @@ terminusgps/wialon/items/route.py,sha256=qOHPN_rejwiGqvwWzlwmUIAIyc3lKavCalf8ki6
|
|
|
19
23
|
terminusgps/wialon/items/unit.py,sha256=wzcLa0adMTKX6rtO4Vz6ntaxgY50rLk2KK_VBXlW_lQ,4680
|
|
20
24
|
terminusgps/wialon/items/unit_group.py,sha256=1yc7ldPIgGbtiTj0djRDWmt6Q9K_VT9sxOaioasbbLY,5212
|
|
21
25
|
terminusgps/wialon/items/user.py,sha256=bkcMw_YiocaMuhP_pBfB7apjAZwnsOzGScnGkn8Ybbw,6107
|
|
22
|
-
python_terminusgps-1.
|
|
23
|
-
python_terminusgps-1.
|
|
24
|
-
python_terminusgps-1.
|
|
25
|
-
python_terminusgps-1.
|
|
26
|
+
python_terminusgps-1.8.0.dist-info/METADATA,sha256=Zg3Ou8OA-8MVM32m2MIMnmq7uV7qUR2t4UPavYYFFE4,882
|
|
27
|
+
python_terminusgps-1.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
28
|
+
python_terminusgps-1.8.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
29
|
+
python_terminusgps-1.8.0.dist-info/RECORD,,
|
terminusgps/authorizenet/auth.py
CHANGED
|
@@ -4,18 +4,32 @@ from authorizenet.constants import constants
|
|
|
4
4
|
from django.conf import ImproperlyConfigured, settings
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
def settings_required(settings_list: list[str]):
|
|
8
|
+
def decorator(func):
|
|
9
|
+
def wrapped(*args, **kwargs):
|
|
10
|
+
for setting_name in settings_list:
|
|
11
|
+
if not hasattr(settings, setting_name):
|
|
12
|
+
raise ImproperlyConfigured(f"'{setting_name}' setting is required.")
|
|
13
|
+
return func(*args, **kwargs)
|
|
14
|
+
|
|
15
|
+
return wrapped
|
|
16
|
+
|
|
17
|
+
return decorator
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@settings_required(["MERCHANT_AUTH_LOGIN_ID", "MERCHANT_AUTH_TRANSACTION_KEY"])
|
|
7
21
|
def get_merchant_auth() -> merchantAuthenticationType:
|
|
8
|
-
if not hasattr(settings, "MERCHANT_AUTH_LOGIN_ID"):
|
|
9
|
-
raise ImproperlyConfigured("'MERCHANT_AUTH_LOGIN_ID' is required.")
|
|
10
|
-
if not hasattr(settings, "MERCHANT_AUTH_TRANSACTION_KEY"):
|
|
11
|
-
raise ImproperlyConfigured("'MERCHANT_AUTH_TRANSACTION_KEY' is required.")
|
|
12
22
|
return merchantAuthenticationType(
|
|
13
23
|
name=str(settings.MERCHANT_AUTH_LOGIN_ID),
|
|
14
24
|
transactionKey=str(settings.MERCHANT_AUTH_TRANSACTION_KEY),
|
|
15
25
|
)
|
|
16
26
|
|
|
17
27
|
|
|
28
|
+
@settings_required(["DEBUG"])
|
|
18
29
|
def get_environment() -> str:
|
|
19
|
-
if not hasattr(settings, "DEBUG"):
|
|
20
|
-
raise ImproperlyConfigured("'DEBUG' is required.")
|
|
21
30
|
return constants.SANDBOX if settings.DEBUG else constants.PRODUCTION
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@settings_required(["DEBUG"])
|
|
34
|
+
def get_validation_mode() -> str:
|
|
35
|
+
return "testMode" if settings.DEBUG else "liveMode"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from authorizenet.apicontractsv1 import (
|
|
2
|
+
createCustomerShippingAddressRequest,
|
|
3
|
+
customerAddressType,
|
|
4
|
+
deleteCustomerShippingAddressRequest,
|
|
5
|
+
updateCustomerShippingAddressRequest,
|
|
6
|
+
getCustomerShippingAddressRequest,
|
|
7
|
+
getCustomerShippingAddressResponse,
|
|
8
|
+
)
|
|
9
|
+
from authorizenet.apicontrollers import (
|
|
10
|
+
createCustomerShippingAddressController,
|
|
11
|
+
deleteCustomerShippingAddressController,
|
|
12
|
+
getCustomerShippingAddressController,
|
|
13
|
+
updateCustomerShippingAddressController,
|
|
14
|
+
)
|
|
15
|
+
from terminusgps.authorizenet.profiles.base import AuthorizenetCustomerProfileBase
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AddressProfile(AuthorizenetCustomerProfileBase):
|
|
19
|
+
def create(self, **kwargs) -> int:
|
|
20
|
+
if not kwargs.get("address"):
|
|
21
|
+
raise ValueError("'address' is required on creation.")
|
|
22
|
+
|
|
23
|
+
request = createCustomerShippingAddressRequest(
|
|
24
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
25
|
+
customerProfileId=self.customerProfileId,
|
|
26
|
+
address=kwargs["address"],
|
|
27
|
+
defaultShippingAddress=self.default,
|
|
28
|
+
)
|
|
29
|
+
controller = createCustomerShippingAddressController(request)
|
|
30
|
+
response = self.execute_controller(controller)
|
|
31
|
+
return int(response.get("customerAddressId"))
|
|
32
|
+
|
|
33
|
+
def delete(self) -> None:
|
|
34
|
+
request = deleteCustomerShippingAddressRequest(
|
|
35
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
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:
|
|
43
|
+
request = updateCustomerShippingAddressRequest(
|
|
44
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
45
|
+
customerProfileId=self.customerProfileId,
|
|
46
|
+
address=address,
|
|
47
|
+
defaultShippingAddress=default,
|
|
48
|
+
)
|
|
49
|
+
controller = updateCustomerShippingAddressController(request)
|
|
50
|
+
self.execute_controller(controller)
|
|
51
|
+
self._default = default
|
|
52
|
+
|
|
53
|
+
def get_details(self) -> getCustomerShippingAddressResponse:
|
|
54
|
+
request = getCustomerShippingAddressRequest(
|
|
55
|
+
merchantAuthentication=self.merchantAuthentication,
|
|
56
|
+
customerProfileId=self.customerProfileId,
|
|
57
|
+
customerAddressId=self.id,
|
|
58
|
+
)
|
|
59
|
+
controller = getCustomerShippingAddressController(request)
|
|
60
|
+
return self.execute_controller(controller)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from authorizenet.apicontractsv1 import merchantAuthenticationType
|
|
2
|
+
from ..auth import get_environment, get_merchant_auth, get_validation_mode
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class AuthorizenetProfileBase:
|
|
6
|
+
def __init__(
|
|
7
|
+
self, merchant_id: int | str, id: int | str | None = None, **kwargs
|
|
8
|
+
) -> None:
|
|
9
|
+
self.merchant_id = merchant_id
|
|
10
|
+
self.id = id if id else str(self.create(**kwargs))
|
|
11
|
+
|
|
12
|
+
def __str__(self) -> str:
|
|
13
|
+
return f"#{self.id}"
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def environment(self) -> str:
|
|
17
|
+
return get_environment()
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def merchantAuthentication(self) -> merchantAuthenticationType:
|
|
21
|
+
return get_merchant_auth()
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def validationMode(self) -> str:
|
|
25
|
+
return get_validation_mode()
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def merchantCustomerId(self) -> str:
|
|
29
|
+
return str(self.merchant_id)
|
|
30
|
+
|
|
31
|
+
def create(self, **kwargs) -> int:
|
|
32
|
+
raise NotImplementedError("Subclasses must implement this method.")
|
|
33
|
+
|
|
34
|
+
def execute_controller(self, controller):
|
|
35
|
+
controller.setenvironment(self.environment)
|
|
36
|
+
controller.execute()
|
|
37
|
+
response = controller.getresponse()
|
|
38
|
+
if response.messages.resultCode != "Ok":
|
|
39
|
+
raise ValueError(response.messages.message[0]["text"].text)
|
|
40
|
+
return response
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class AuthorizenetCustomerProfileBase(AuthorizenetProfileBase):
|
|
44
|
+
def __init__(
|
|
45
|
+
self, customer_profile_id: int | str, default: bool = False, **kwargs
|
|
46
|
+
) -> None:
|
|
47
|
+
if isinstance(customer_profile_id, str) and not customer_profile_id.isdigit():
|
|
48
|
+
raise ValueError(
|
|
49
|
+
f"'customer_profile_id' must be a digit, got '{customer_profile_id}'."
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
self._default = default
|
|
53
|
+
self.customer_profile_id = customer_profile_id
|
|
54
|
+
return super().__init__(**kwargs)
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def customerProfileId(self) -> str:
|
|
58
|
+
return str(self.customer_profile_id)
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def default(self) -> str:
|
|
62
|
+
return "true" if self._default else "false"
|
|
@@ -0,0 +1,72 @@
|
|
|
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()
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
terminusgps/settings.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from os import getenv
|
|
2
2
|
|
|
3
|
-
DEBUG =
|
|
3
|
+
DEBUG = True
|
|
4
4
|
SECRET_KEY = "xem*6no%8d9%^qzt2f3x3ar-uq4_+7h9myc$t0!+4%bj5us6f)"
|
|
5
5
|
WIALON_ADMIN_ID = getenv("WIALON_ADMIN_ID")
|
|
6
6
|
WIALON_TOKEN = getenv("WIALON_TOKEN")
|
|
7
|
+
MERCHANT_AUTH_LOGIN_ID = getenv("MERCHANT_AUTH_LOGIN_ID")
|
|
8
|
+
MERCHANT_AUTH_TRANSACTION_KEY = getenv("MERCHANT_AUTH_TRANSACTION_KEY")
|
terminusgps/wialon/utils.py
CHANGED
|
@@ -50,23 +50,33 @@ def is_unique(value: str, session: WialonSession, items_type: str = "avl_unit")
|
|
|
50
50
|
return not bool(result)
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
def gen_wialon_password(length: int =
|
|
53
|
+
def gen_wialon_password(length: int = 32) -> str:
|
|
54
54
|
"""Generates a Wialon compliant password."""
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
min_length, max_length = 4, 64
|
|
56
|
+
if length > max_length:
|
|
57
|
+
raise ValueError(
|
|
58
|
+
f"Password cannot be greater than {max_length} characters in length. Got {length}."
|
|
59
|
+
)
|
|
60
|
+
elif length < min_length:
|
|
61
|
+
raise ValueError(
|
|
62
|
+
f"Password cannot be less than {min_length} characters in length. Got {length}."
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
s0 = list(string.ascii_uppercase)
|
|
66
|
+
s1 = list(string.ascii_lowercase)
|
|
67
|
+
s2 = list(string.digits)
|
|
68
|
+
s3 = list("!@#$%^*()[]-_+")
|
|
69
|
+
|
|
70
|
+
while True:
|
|
71
|
+
password = "".join([secrets.choice(s0 + s1 + s2 + s3) for _ in range(length)])
|
|
72
|
+
if (
|
|
73
|
+
any(c.islower() for c in password)
|
|
74
|
+
and any(c.isupper() for c in password)
|
|
75
|
+
and sum(c.isdigit() for c in password) >= 3
|
|
76
|
+
and any(c in s3 for c in password)
|
|
77
|
+
):
|
|
78
|
+
break
|
|
79
|
+
return password
|
|
70
80
|
|
|
71
81
|
|
|
72
82
|
def get_id_from_iccid(iccid: str, session: WialonSession) -> str | None:
|
|
File without changes
|
|
File without changes
|