python-terminusgps 27.0.0__py3-none-any.whl → 27.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 27.0.0
3
+ Version: 27.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://app.terminusgps.com/docs/apps/python-terminusgps/index.html
6
6
  Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
@@ -3,14 +3,14 @@ terminusgps/settings.py,sha256=UBj2tvuBzQDEz05PeFqHG4_ise3Bl6Iu7pxcrtjNaYE,568
3
3
  terminusgps/authorizenet/__init__.py,sha256=LiGLlWNNiqS7RSOP4Apabx-b9EBYyNbxRY_a0mvJoaE,466
4
4
  terminusgps/authorizenet/auth.py,sha256=ICxPPzoUc64VbsIIemEWKrn8xjHGwbNdo2VbtaFCFss,1107
5
5
  terminusgps/authorizenet/errors.py,sha256=HG5NwVxQCtOYidVl30y49PC0Ovw5VYdsy9wTgUFMw9M,949
6
- terminusgps/authorizenet/utils.py,sha256=5aczO2EcMX2bi-kRg8_fnzLzE7qMA9K1qBxAo2AJz1c,2021
6
+ terminusgps/authorizenet/utils.py,sha256=RQ_R9YEoNGYQNV7vePmNxbYyhf_DImumATyROckX66I,2770
7
7
  terminusgps/authorizenet/profiles/__init__.py,sha256=QKjMKcXpCSCEhv6LBCz0yGP8t0VxAyKyYRS4_HLYnxQ,114
8
8
  terminusgps/authorizenet/profiles/addresses.py,sha256=7yrOrb9kIsiiazgWbeH8v_YUBiWG3Y61g46R3S5DD-k,6592
9
9
  terminusgps/authorizenet/profiles/base.py,sha256=TOUHr22QRQBLErdysOkfcpJBusTjrUTqOmWEyNvMacA,2240
10
10
  terminusgps/authorizenet/profiles/customers.py,sha256=kxYj9naCsHhFkHdWl8dLk0ketORMxMMhO2XzVOyGd4g,8363
11
11
  terminusgps/authorizenet/profiles/payments.py,sha256=O_oZGUwO8XTApzr0itu-1XQYnWFR4gDpNCusWNzBh7A,11152
12
12
  terminusgps/authorizenet/subscriptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- terminusgps/authorizenet/subscriptions/subscriptions.py,sha256=yg0rZw0Zzm3v7daLPR0PsdfCWBU6RyoE_gNPDBMkCjM,1621
13
+ terminusgps/authorizenet/subscriptions/subscriptions.py,sha256=t1yNGMnfVEhSLMerZmEr479XDgOY-ksqvCn3FNcymVE,1609
14
14
  terminusgps/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  terminusgps/aws/secrets.py,sha256=MxQEmmBLpMUQ2tYAsHdCYf-7RZ84LiogdKcTsACX5dw,361
16
16
  terminusgps/twilio/__init__.py,sha256=dYo41F2jft_eHDWSUtSpKGSRG1bewq_qClqilUJZkYM,33
@@ -30,7 +30,7 @@ terminusgps/wialon/items/route.py,sha256=8SzlqNmpYVdt-ZAY--B_KHoDIHgN0Zb7KBsBWAz
30
30
  terminusgps/wialon/items/unit.py,sha256=i7sQiRu3N0XxyTHVN2RnmjYy9X48KdnZLSB18ic37w8,9363
31
31
  terminusgps/wialon/items/unit_group.py,sha256=YsYh34l2DjSKcv5SIZkEVi5FSjveGB1gxU2fwdLyvl4,4101
32
32
  terminusgps/wialon/items/user.py,sha256=PFYBie04F16YE2B5364PLxkmlTmQr4sZXpItvRBxsDc,7143
33
- python_terminusgps-27.0.0.dist-info/METADATA,sha256=z36oD2rqxZYskS3SuUT3pqdXzt8ZWmIjVL3MUOBhmZs,946
34
- python_terminusgps-27.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
- python_terminusgps-27.0.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
36
- python_terminusgps-27.0.0.dist-info/RECORD,,
33
+ python_terminusgps-27.1.0.dist-info/METADATA,sha256=PmwwAFyRtpYJ_JXzdG6klAw7nF-EAyUDIds1lKx1UAE,946
34
+ python_terminusgps-27.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
+ python_terminusgps-27.1.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
36
+ python_terminusgps-27.1.0.dist-info/RECORD,,
@@ -6,9 +6,9 @@ from ..utils import ControllerExecutionMixin
6
6
 
7
7
  class Subscription(ControllerExecutionMixin):
8
8
  def __init__(self, id: str | int | None = None, *args, **kwargs) -> None:
9
- if id is not None and isinstance(id, str) and not id.isdigit():
9
+ if id and isinstance(id, str) and not id.isdigit():
10
10
  raise ValueError(f"'id' must be a digit, got '{id}'.")
11
- self.id = int(id) if id else self.create(*args, **kwargs)
11
+ self.id = int(id if id else self.create(*args, **kwargs))
12
12
 
13
13
  def create(
14
14
  self,
@@ -1,5 +1,6 @@
1
1
  from authorizenet import apicontractsv1, apicontrollers
2
2
  from authorizenet.apicontrollersbase import APIOperationBase
3
+ from django import forms
3
4
 
4
5
  from .auth import get_environment, get_merchant_auth
5
6
  from .errors import ControllerExecutionError
@@ -52,3 +53,18 @@ def get_customer_profile_ids() -> list[int]:
52
53
  code=response.messages.message[0]["code"].text,
53
54
  )
54
55
  return [int(id) for id in response.ids.getchildren()]
56
+
57
+
58
+ def generate_customer_address(form: forms.Form) -> apicontractsv1.customerAddressType:
59
+ """Takes a form and returns a :py:obj:`~authorizenet.apicontractsv1.customerAddressType`."""
60
+ address: apicontractsv1.customerAddressType = form.cleaned_data["address"]
61
+ address.firstName = form.cleaned_data["first_name"]
62
+ address.lastName = form.cleaned_data["last_name"]
63
+ address.phone = form.cleaned_data["phone"]
64
+ return address
65
+
66
+
67
+ def generate_customer_payment(form: forms.Form) -> apicontractsv1.paymentType:
68
+ """Takes a form and returns a :py:obj:`~authorizenet.apicontractsv1.paymentType`."""
69
+ credit_card = form.cleaned_data["credit_card"]
70
+ return apicontractsv1.paymentType(creditCard=credit_card)