python-terminusgps 36.4.1__py3-none-any.whl → 36.4.3__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: 36.4.1
3
+ Version: 36.4.3
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
@@ -9,7 +9,7 @@ terminusgps/authorizenet/profiles/addresses.py,sha256=5GudJStBa4P0Hd7G_hRFH2C-Wp
9
9
  terminusgps/authorizenet/profiles/base.py,sha256=Pu1NGrvC5Ox2W1oZuVcPqUw3aUoSK191Evexw1U6_3k,3940
10
10
  terminusgps/authorizenet/profiles/customers.py,sha256=mKPHSFoDqJqHL1CvTximNVRb1myRwQ9NvMkA2-iswOg,11701
11
11
  terminusgps/authorizenet/profiles/payments.py,sha256=nhudGuJ6RzmK0MrhDVuYL2BxvyzKNpliBIfIpFU5Y-4,11038
12
- terminusgps/authorizenet/profiles/subscriptions.py,sha256=m_jb9GqeD1tLmeqSnaGwJrzPcQOulEkF8K1wCaqKR24,7924
12
+ terminusgps/authorizenet/profiles/subscriptions.py,sha256=Egai25gxKUt7nER2teUNFkz8s6WKBIpq86UYIvHzTz4,8265
13
13
  terminusgps/authorizenet/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  terminusgps/authorizenet/tests/test_auth.py,sha256=sdByYrcv8RKjcJckOHbyHH1z_M4qrATFI3qj_XDQXbk,1624
15
15
  terminusgps/authorizenet/tests/test_profiles.py,sha256=tvLBY0iSAC33RlWiBP_NSnPskUQBjfrf0YHMpR-m22k,7566
@@ -38,7 +38,7 @@ terminusgps/wialon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
38
38
  terminusgps/wialon/constants.py,sha256=05pLc_0S-x0tT87cQcxOmr8plesjOQxoXfUdjIHwI90,7732
39
39
  terminusgps/wialon/flags.py,sha256=M50EdhxQ8IMnJnU0mrHK7-h8Asc6tvNiTOOfd1dBW6A,12815
40
40
  terminusgps/wialon/session.py,sha256=BN8GBfYNIJcjvev9-qOam2Sbkf7EyCoQXTudRrmA3vc,10533
41
- terminusgps/wialon/utils.py,sha256=SwpcxLPBLy0u3AT84G-Co4wxmhRrPFyW3jo_9O6ICvk,11008
41
+ terminusgps/wialon/utils.py,sha256=iGOY8v7cNaSoA9Mo17d1bKAQMBtcotGq3FEQrghgvCo,11222
42
42
  terminusgps/wialon/validators.py,sha256=j5vrtcfClAzRdRkWTvRRAmrne1t0R6cKkmYdE7fAkSs,4247
43
43
  terminusgps/wialon/items/__init__.py,sha256=3BVthghekMvhMQSzQgBMlD_phxmKSmp3Zvmo-z0O8Bs,211
44
44
  terminusgps/wialon/items/base.py,sha256=ZhndkcVWTOjsEKe5L0NQsLvvXj2Fs0Xv-qBjjm1Xmpk,10421
@@ -52,7 +52,7 @@ terminusgps/wialon/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
52
52
  terminusgps/wialon/tests/test_items.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  terminusgps/wialon/tests/test_session.py,sha256=9mBlYchMo9NeqRIZsmxYzrM1zBHorqu4ooxqSNppLpI,1336
54
54
  terminusgps/wialon/tests/test_utils.py,sha256=SK4PxJQGECFnzx_EQeRAQfsQ5_3FLaVcis2W9u_ibuI,1730
55
- python_terminusgps-36.4.1.dist-info/METADATA,sha256=MoYb6Vwu-FQT8KvAoeNbClAfe1JI4MM5HwFTdfOLPIY,1616
56
- python_terminusgps-36.4.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
- python_terminusgps-36.4.1.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
58
- python_terminusgps-36.4.1.dist-info/RECORD,,
55
+ python_terminusgps-36.4.3.dist-info/METADATA,sha256=5rqaL8BQ4WUSaedjoJd52HgmixonzQw6IrZHupI3Itg,1616
56
+ python_terminusgps-36.4.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
+ python_terminusgps-36.4.3.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
58
+ python_terminusgps-36.4.3.dist-info/RECORD,,
@@ -1,3 +1,5 @@
1
+ import decimal
2
+
1
3
  from authorizenet import apicontractsv1, apicontrollers
2
4
 
3
5
  from terminusgps.authorizenet.constants import AuthorizenetSubscriptionStatus
@@ -7,6 +9,19 @@ from terminusgps.authorizenet.profiles.base import AuthorizenetSubProfileBase
7
9
  class SubscriptionProfile(AuthorizenetSubProfileBase):
8
10
  """An Authorizenet subscription profile."""
9
11
 
12
+ @property
13
+ def amount(self) -> decimal.Decimal | None:
14
+ """
15
+ The subscription amount.
16
+
17
+ :type: :py:obj:`~decimal.Decimal` | :py:obj:`None`
18
+
19
+ """
20
+ if self.id:
21
+ decimal.getcontext().prec = 4
22
+ sub = self._authorizenet_get_subscription().subscription
23
+ return decimal.Decimal(float(sub.amount)) * 1
24
+
10
25
  @property
11
26
  def status(self) -> AuthorizenetSubscriptionStatus | None:
12
27
  """
@@ -15,13 +30,10 @@ class SubscriptionProfile(AuthorizenetSubProfileBase):
15
30
  :type: :py:obj:`~terminusgps.authorizenet.constants.AuthorizenetSubscriptionStatus` | :py:obj:`None`
16
31
 
17
32
  """
18
- return (
19
- AuthorizenetSubscriptionStatus(
33
+ if self.id:
34
+ return AuthorizenetSubscriptionStatus(
20
35
  self._authorizenet_get_subscription_status().status
21
36
  )
22
- if self.id
23
- else None
24
- )
25
37
 
26
38
  @property
27
39
  def transactions(self) -> list[dict[str, str]]:
@@ -204,6 +204,7 @@ def get_unit_by_imei(imei: str, session: WialonSession) -> WialonUnit | None:
204
204
  :param session: A valid Wialon API session.
205
205
  :type session: :py:obj:`~terminusgps.wialon.session.WialonSession`
206
206
  :raises ValueError: If ``imei`` contains non-digit characters.
207
+ :raises ValueError: If ``imei`` points to multiple Wialon units.
207
208
  :raises WialonError: If something goes wrong during a Wialon API call.
208
209
  :returns: A Wialon object id, if it was found.
209
210
  :rtype: :py:obj:`str` | :py:obj:`None`
@@ -217,19 +218,21 @@ def get_unit_by_imei(imei: str, session: WialonSession) -> WialonUnit | None:
217
218
  "spec": {
218
219
  "itemsType": "avl_unit",
219
220
  "propName": "sys_unique_id",
220
- "propValueMask": f"*{imei}*",
221
+ "propValueMask": imei,
221
222
  "sortType": "sys_unique_id",
222
223
  "propType": "property",
223
224
  "or_logic": 0,
224
225
  },
225
226
  "force": 0,
226
- "flags": flags.DataFlag.UNIT_BASE.value,
227
+ "flags": flags.DataFlag.UNIT_BASE,
227
228
  "from": 0,
228
229
  "to": 0,
229
230
  }
230
231
  )
231
232
 
232
- if results and results.get("totalItemsCount", 0) == 1:
233
+ if results is not None and results.get("totalItemsCount", 0) != 1:
234
+ raise ValueError(f"Multiple units found with IMEI #: '{imei}'.")
235
+ elif results is not None and results.get("totalItemsCount", 0) == 1:
233
236
  return WialonUnit(id=results["items"][0].get("id"), session=session)
234
237
 
235
238