python-terminusgps 33.0.0__py3-none-any.whl → 33.2.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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 33.0.0
3
+ Version: 33.2.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
@@ -22,6 +22,13 @@ terminusgps/django/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
22
22
  terminusgps/django/mixins.py,sha256=Q9ZJuzpk3d9lDnlVA8ZTVvnZWxB13p08EQ8yVJcztn4,1034
23
23
  terminusgps/django/settings.py,sha256=yJIcBE0xjY60AXF_gonY5hS3ofseqPW2k9uSoELgoho,639
24
24
  terminusgps/django/utils.py,sha256=SYDQyHA5tTuVwdpZGsCtf0LpTTD0ilRKoxa8StfSTpQ,156
25
+ terminusgps/django/forms/__init__.py,sha256=hh8Z9AC_u2m2bu3h6sdmPyndfQneCEVovENPHmoTDC0,21
26
+ terminusgps/django/forms/fields.py,sha256=BfuPzOZyGvWsEzONW2h4i01fhoL0IS0-gDdBKW4jHgI,2225
27
+ terminusgps/django/forms/forms.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
+ terminusgps/django/forms/widgets.py,sha256=Hu6jNVx0i8JOOvAV1tuSHRqNI3mV2wijuKupUhol46c,1765
29
+ terminusgps/django/tests/test_forms.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
30
+ terminusgps/django/tests/test_mixins.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ terminusgps/django/tests/test_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
32
  terminusgps/twilio/__init__.py,sha256=dYo41F2jft_eHDWSUtSpKGSRG1bewq_qClqilUJZkYM,33
26
33
  terminusgps/twilio/caller.py,sha256=l53-IxXn0wXc_oDcDxfhlrKPz-F4_KfMPV1dAzZjNo4,5060
27
34
  terminusgps/twilio/validators.py,sha256=HWCpzgDXTedofty4Zhrm2OenbgtkzrDUC08B1l15gqc,1112
@@ -46,7 +53,7 @@ terminusgps/wialon/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
46
53
  terminusgps/wialon/tests/test_items.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
54
  terminusgps/wialon/tests/test_session.py,sha256=9mBlYchMo9NeqRIZsmxYzrM1zBHorqu4ooxqSNppLpI,1336
48
55
  terminusgps/wialon/tests/test_utils.py,sha256=SK4PxJQGECFnzx_EQeRAQfsQ5_3FLaVcis2W9u_ibuI,1730
49
- python_terminusgps-33.0.0.dist-info/METADATA,sha256=4YbYgxxufZKqEuoRveOGbtRDupqslS3dx_JwW-PzZ9A,1581
50
- python_terminusgps-33.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
51
- python_terminusgps-33.0.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
52
- python_terminusgps-33.0.0.dist-info/RECORD,,
56
+ python_terminusgps-33.2.0.dist-info/METADATA,sha256=zRen2hb6Tb8T0FM81XTAcRPElynhCVAPPt4hoN4hVJY,1581
57
+ python_terminusgps-33.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
58
+ python_terminusgps-33.2.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
59
+ python_terminusgps-33.2.0.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ from .forms import *
@@ -0,0 +1,57 @@
1
+ from collections.abc import Sequence
2
+
3
+ from authorizenet import apicontractsv1
4
+ from django import forms
5
+
6
+ from .widgets import AddressWidget, CreditCardWidget
7
+
8
+
9
+ class CreditCardField(forms.MultiValueField):
10
+ require_all_fields = True
11
+
12
+ def __init__(self, fields=(), widget=CreditCardWidget(), *args, **kwargs) -> None:
13
+ if not fields:
14
+ fields = (
15
+ forms.CharField(label="Card #"),
16
+ forms.IntegerField(label="Expiry Month", min_value=1, max_value=12),
17
+ forms.IntegerField(label="Expiry Year"),
18
+ forms.CharField(label="CCV #"),
19
+ )
20
+ super().__init__(fields=fields, widget=widget, *args, **kwargs)
21
+
22
+ def compress(self, data_list: Sequence[str]) -> apicontractsv1.creditCardType:
23
+ """Compresses ``data_list`` into a :py:obj:`~authorizenet.apicontractsv1.creditCardType`."""
24
+ return apicontractsv1.creditCardType(
25
+ **{
26
+ "cardNumber": data_list[0],
27
+ "expirationDate": f"{data_list[1]}-{data_list[2]}",
28
+ "cardCode": data_list[3],
29
+ }
30
+ )
31
+
32
+
33
+ class AddressField(forms.MultiValueField):
34
+ require_all_fields = True
35
+
36
+ def __init__(self, fields=(), widget=AddressWidget(), *args, **kwargs) -> None:
37
+ if not fields:
38
+ fields = (
39
+ forms.CharField(label="Street", max_length=128),
40
+ forms.CharField(label="City", max_length=128),
41
+ forms.CharField(label="State", max_length=64),
42
+ forms.CharField(label="Zip #", min_length=5, max_length=10),
43
+ forms.CharField(label="Country", max_length=2),
44
+ )
45
+ super().__init__(fields=fields, widget=widget, *args, **kwargs)
46
+
47
+ def compress(self, data_list: Sequence[str]) -> apicontractsv1.customerAddressType:
48
+ """Compresses ``data_list`` into a :py:obj:`~authorizenet.apicontractsv1.customerAddressType`."""
49
+ return apicontractsv1.customerAddressType(
50
+ **{
51
+ "address": data_list[0],
52
+ "city": data_list[1],
53
+ "state": data_list[2],
54
+ "zip": data_list[3],
55
+ "country": data_list[4],
56
+ }
57
+ )
File without changes
@@ -0,0 +1,46 @@
1
+ from authorizenet import apicontractsv1
2
+ from django import forms
3
+
4
+
5
+ class CreditCardWidget(forms.widgets.MultiWidget):
6
+ def __init__(self, widgets=(), attrs: dict | None = None) -> None:
7
+ if not widgets:
8
+ widgets = [
9
+ forms.TextInput(attrs=attrs),
10
+ forms.TextInput(attrs=attrs),
11
+ forms.TextInput(attrs=attrs),
12
+ forms.TextInput(attrs=attrs),
13
+ ]
14
+ super().__init__(widgets=widgets, attrs=attrs)
15
+
16
+ def decompress(
17
+ self, value: apicontractsv1.creditCardType | None
18
+ ) -> list[str | None]:
19
+ """Decompresses a :py:attr:`~authorizenet.apicontractsv1.creditCardType` into a list of strings."""
20
+ if value is None:
21
+ return [None, None, None, None]
22
+
23
+ expiry_parts = value.expirationDate.split("-")
24
+ return [value.cardNumber, expiry_parts[0], expiry_parts[1], value.cardCode]
25
+
26
+
27
+ class AddressWidget(forms.widgets.MultiWidget):
28
+ def __init__(self, widgets=(), attrs: dict | None = None) -> None:
29
+ if not widgets:
30
+ widgets = [
31
+ forms.TextInput(attrs=attrs),
32
+ forms.TextInput(attrs=attrs),
33
+ forms.TextInput(attrs=attrs),
34
+ forms.TextInput(attrs=attrs),
35
+ forms.TextInput(attrs=attrs),
36
+ ]
37
+ super().__init__(widgets=widgets, attrs=attrs)
38
+
39
+ def decompress(
40
+ self, value: apicontractsv1.customerAddressType | None
41
+ ) -> list[str | None]:
42
+ """Decompresses a :py:attr:`~authorizenet.apicontractsv1.customerAddressType` into a list of strings."""
43
+ if value is None:
44
+ return [None, None, None, None, None]
45
+
46
+ return [value.address, value.city, value.state, value.country, value.zip]
@@ -0,0 +1 @@
1
+
File without changes
File without changes