python-terminusgps 36.1.3__py3-none-any.whl → 36.3.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: 36.1.3
3
+ Version: 36.3.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
@@ -7,7 +7,7 @@ terminusgps/authorizenet/utils.py,sha256=FrKqXWrplcgiET1rDTmUaqmN_ze7j93jWgfFeJR
7
7
  terminusgps/authorizenet/profiles/__init__.py,sha256=IG4XCEEYtHKqXOatlZlob6J3ukAgF7cFR-RXxOSMS1c,161
8
8
  terminusgps/authorizenet/profiles/addresses.py,sha256=5GudJStBa4P0Hd7G_hRFH2C-WpICAH_k3MT9YJkicKw,6305
9
9
  terminusgps/authorizenet/profiles/base.py,sha256=Pu1NGrvC5Ox2W1oZuVcPqUw3aUoSK191Evexw1U6_3k,3940
10
- terminusgps/authorizenet/profiles/customers.py,sha256=lLzQPJByu_oEck8u3h4vzoV_uVOKKeLr6qhFAV5uQ_E,12793
10
+ terminusgps/authorizenet/profiles/customers.py,sha256=qd09bUD2TWOwrHYXpKax5iMQb5X0tSDje4oxTXNJAyM,11691
11
11
  terminusgps/authorizenet/profiles/payments.py,sha256=nhudGuJ6RzmK0MrhDVuYL2BxvyzKNpliBIfIpFU5Y-4,11038
12
12
  terminusgps/authorizenet/profiles/subscriptions.py,sha256=m_jb9GqeD1tLmeqSnaGwJrzPcQOulEkF8K1wCaqKR24,7924
13
13
  terminusgps/authorizenet/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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.1.3.dist-info/METADATA,sha256=3DwmldpvpHiF5EBQbdnTXHXqHqOrOqV2y7ELuX_PKTU,1616
56
- python_terminusgps-36.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
- python_terminusgps-36.1.3.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
58
- python_terminusgps-36.1.3.dist-info/RECORD,,
55
+ python_terminusgps-36.3.0.dist-info/METADATA,sha256=Eh0fcycyihRRmz9QvYlgZX1Mm2LE4ntv9zkUhkgPnxM,1616
56
+ python_terminusgps-36.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
+ python_terminusgps-36.3.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
58
+ python_terminusgps-36.3.0.dist-info/RECORD,,
@@ -11,7 +11,7 @@ class CustomerProfile(AuthorizenetProfileBase):
11
11
  def __init__(
12
12
  self,
13
13
  id: int | str | None = None,
14
- merchant_id: int | str | None = None,
14
+ merchant_id: str | None = None,
15
15
  email: str | None = None,
16
16
  desc: str | None = None,
17
17
  ) -> None:
@@ -23,117 +23,106 @@ class CustomerProfile(AuthorizenetProfileBase):
23
23
 
24
24
  """
25
25
  super().__init__(id=id)
26
- self._merchantCustomerId = str(merchant_id) if merchant_id else None
26
+ self._merchant_id = merchant_id
27
27
  self._email = email
28
28
  self._desc = desc
29
29
 
30
- if not self.id and self.merchantCustomerId or self.email:
30
+ if not self.id:
31
31
  try:
32
- response = self._authorizenet_get_customer_profile(issuer_info=False)
33
- self.id = response.profile.customerProfileId
32
+ response = self._authorizenet_get_customer_profile()
33
+ self.id = int(response.profile.customerProfileId)
34
34
  except AuthorizenetControllerExecutionError:
35
35
  self.id = self.create()
36
36
 
37
37
  @property
38
- def validationMode(self) -> str:
38
+ def merchant_id(self) -> str:
39
39
  """
40
- The current Authorizenet validation mode.
40
+ A merchant designated id.
41
41
 
42
42
  :type: :py:obj:`str`
43
43
 
44
44
  """
45
- return get_validation_mode()
46
-
47
- @property
48
- def merchantCustomerId(self) -> str | None:
49
- """
50
- A merchant designated customer id.
51
-
52
- :type: :py:obj:`str` | :py:obj:`None`
53
-
54
- """
55
- if self.id and not self._merchantCustomerId:
56
- response = self._authorizenet_get_customer_profile(issuer_info=False)
57
- self._merchantCustomerId: str | None = (
58
- str(response.profile.merchantCustomerId)
45
+ if self.id and not self._merchant_id:
46
+ response = self._authorizenet_get_customer_profile()
47
+ self._merchant_id = (
48
+ response.profile.merchantCustomerId
59
49
  if response is not None
60
50
  and hasattr(response.profile, "merchantCustomerId")
61
51
  else None
62
52
  )
63
- return self._merchantCustomerId
53
+ return str(self._merchant_id)
64
54
 
65
- @merchantCustomerId.setter
66
- def merchantCustomerId(self, other: int | str | None) -> None:
67
- """Sets :py:attr:`merchantCustomerId` to ``other``."""
68
- updated: bool = other is not None and str(other) != str(
69
- self._merchantCustomerId
70
- )
71
- self._merchantCustomerId = str(other) if other else None
72
- if updated and self.id is not None:
73
- self._authorizenet_update_customer_profile()
55
+ @merchant_id.setter
56
+ def merchant_id(self, other: str | int) -> None:
57
+ self._merchant_id = other
58
+ self._authorizenet_update_customer_profile()
74
59
 
75
60
  @property
76
- def email(self) -> str | None:
61
+ def email(self) -> str:
77
62
  """
78
63
  A customer email address.
79
64
 
80
- :type: :py:obj:`str` | :py:obj:`None`
65
+ :type: :py:obj:`str`
81
66
 
82
67
  """
83
- if self.id and self._email is None:
84
- response = self._authorizenet_get_customer_profile(issuer_info=False)
85
- self._email: str | None = (
86
- str(response.profile.email)
68
+ if self.id and not self._email:
69
+ response = self._authorizenet_get_customer_profile()
70
+ self._email = (
71
+ response.profile.email
87
72
  if response is not None and hasattr(response.profile, "email")
88
73
  else None
89
74
  )
90
- return self._email
75
+ return str(self._email)
91
76
 
92
77
  @email.setter
93
- def email(self, other: str | None) -> None:
94
- """Sets :py:attr:`email` to ``other``."""
95
- updated: bool = other is not None and other != self.email
78
+ def email(self, other: str) -> None:
96
79
  self._email = other
97
- if updated and self.id is not None:
98
- self._authorizenet_update_customer_profile()
80
+ self._authorizenet_update_customer_profile()
99
81
 
100
82
  @property
101
- def desc(self) -> str | None:
83
+ def desc(self) -> str:
102
84
  """
103
- A customer description.
85
+ A customer profile description.
104
86
 
105
- :type: :py:obj:`str` | :py:obj:`None`
87
+ :type: :py:obj:`str`
106
88
 
107
89
  """
108
- if self.id and self._desc is None:
109
- response = self._authorizenet_get_customer_profile(issuer_info=False)
110
- self._desc: str | None = (
111
- str(response.profile.description)
90
+ if self.id and not self._desc:
91
+ response = self._authorizenet_get_customer_profile()
92
+ self._desc = (
93
+ response.profile.description
112
94
  if response is not None and hasattr(response.profile, "description")
113
95
  else None
114
96
  )
115
- return self._desc
97
+ return str(self._desc)
116
98
 
117
99
  @desc.setter
118
- def desc(self, other: str | None) -> None:
119
- """Sets :py:attr:`desc` to ``other``."""
120
- updated: bool = other is not None and other != self.desc
100
+ def desc(self, other: str) -> None:
121
101
  self._desc = other
122
- if updated and self.id is not None:
123
- self._authorizenet_update_customer_profile()
102
+ self._authorizenet_update_customer_profile()
103
+
104
+ @property
105
+ def validationMode(self) -> str:
106
+ """
107
+ The current Authorizenet validation mode.
108
+
109
+ :type: :py:obj:`str`
110
+
111
+ """
112
+ return get_validation_mode()
124
113
 
125
114
  def create(self) -> int:
126
115
  """
127
116
  Creates the customer profile in Authorizenet.
128
117
 
129
- :raises AssertionError: If neither :py:attr:`merchantCustomerId` nor :py:attr:`email` were set.
118
+ :raises AssertionError: If neither :py:attr:`merchant_id` nor :py:attr:`email` were set.
130
119
  :raises AuthorizenetControllerExecutionError: If something goes wrong during an Authorizenet API call.
131
120
  :returns: An id for the new customer profile.
132
121
  :rtype: :py:obj:`int`
133
122
 
134
123
  """
135
- assert self.merchantCustomerId or self.email, (
136
- "Neither 'merchantCustomerId' nor 'email' were set."
124
+ assert self.merchant_id or self.email, (
125
+ "Neither 'merchant_id' nor 'email' were set."
137
126
  )
138
127
  return int(self._authorizenet_create_customer_profile().customerProfileId)
139
128
 
@@ -169,12 +158,12 @@ class CustomerProfile(AuthorizenetProfileBase):
169
158
 
170
159
  """
171
160
  response = self._authorizenet_get_customer_profile()
172
- if response is not None:
161
+ if response is not None and hasattr(response.profile, "paymentProfiles"):
173
162
  return [
174
163
  int(p.customerPaymentProfileId)
175
164
  for p in response.profile.paymentProfiles
176
- if hasattr(response.profile, "paymentProfiles")
177
165
  ]
166
+ return []
178
167
 
179
168
  def get_address_profile_ids(self) -> list[int]:
180
169
  """
@@ -185,12 +174,9 @@ class CustomerProfile(AuthorizenetProfileBase):
185
174
 
186
175
  """
187
176
  response = self._authorizenet_get_customer_profile()
188
- if response is not None:
189
- return [
190
- int(p.customerAddressId)
191
- for p in response.profile.shipToList
192
- if hasattr(response.profile, "shipToList")
193
- ]
177
+ if response is not None and hasattr(response.profile, "shipToList"):
178
+ return [int(p.customerAddressId) for p in response.profile.shipToList]
179
+ return []
194
180
 
195
181
  def _generate_customer_profile_ex_type(
196
182
  self,
@@ -202,18 +188,18 @@ class CustomerProfile(AuthorizenetProfileBase):
202
188
  :rtype: :py:obj:`~authorizenet.apicontractsv1.customerProfileExType`
203
189
 
204
190
  """
205
- cprofile = apicontractsv1.customerProfileExType()
191
+ cprofile_obj = apicontractsv1.customerProfileExType()
206
192
 
207
- if self.id is not None:
208
- cprofile.customerProfileId = self.id
209
- if self.merchantCustomerId is not None:
210
- cprofile.merchantCustomerId = self.merchantCustomerId
211
- if self.email is not None:
212
- cprofile.email = self.email
213
- if self.desc is not None:
214
- cprofile.description = self.desc
193
+ if self.id:
194
+ cprofile_obj.customerProfileId = self.id
195
+ if self.merchant_id:
196
+ cprofile_obj.merchantCustomerId = self.merchant_id
197
+ if self.email:
198
+ cprofile_obj.email = self.email
199
+ if self.desc:
200
+ cprofile_obj.description = self.desc
215
201
 
216
- return cprofile
202
+ return cprofile_obj
217
203
 
218
204
  def _generate_customer_profile_type(self) -> apicontractsv1.customerProfileType:
219
205
  """
@@ -223,16 +209,16 @@ class CustomerProfile(AuthorizenetProfileBase):
223
209
  :rtype: :py:obj:`~authorizenet.apicontractsv1.customerProfileType`
224
210
 
225
211
  """
226
- cprofile = apicontractsv1.customerProfileType()
212
+ cprofile_obj = apicontractsv1.customerProfileType()
227
213
 
228
- if self.merchantCustomerId is not None:
229
- cprofile.merchantCustomerId = self.merchantCustomerId
230
- if self.email is not None:
231
- cprofile.email = self.email
232
- if self.desc is not None:
233
- cprofile.description = self.desc
214
+ if self.merchant_id:
215
+ cprofile_obj.merchantCustomerId = self.merchant_id
216
+ if self.email:
217
+ cprofile_obj.email = self.email
218
+ if self.desc:
219
+ cprofile_obj.description = self.desc
234
220
 
235
- return cprofile
221
+ return cprofile_obj
236
222
 
237
223
  def _authorizenet_get_customer_profile(
238
224
  self, issuer_info: bool = True
@@ -256,12 +242,10 @@ class CustomerProfile(AuthorizenetProfileBase):
256
242
 
257
243
  if self.id:
258
244
  request.customerProfileId = self.id
259
- elif self.merchantCustomerId:
260
- request.merchantCustomerId = self.merchantCustomerId
261
- elif self.email:
245
+ if self.merchant_id:
246
+ request.merchantCustomerId = self.merchant_id
247
+ if self.email:
262
248
  request.email = self.email
263
- else:
264
- return
265
249
 
266
250
  controller = apicontrollers.getCustomerProfileController(request)
267
251
  return self.execute_controller(controller)
@@ -282,8 +266,8 @@ class CustomerProfile(AuthorizenetProfileBase):
282
266
  :rtype: :py:obj:`dict` | :py:obj:`None`
283
267
 
284
268
  """
285
- assert self.merchantCustomerId or self.email, (
286
- "Neither 'merchantCustomerId' nor 'email' were set."
269
+ assert self.merchant_id or self.email, (
270
+ "Neither 'merchant_id' nor 'email' were set."
287
271
  )
288
272
 
289
273
  request = apicontractsv1.createCustomerProfileRequest(