python-terminusgps 37.5.0__py3-none-any.whl → 37.5.2__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-37.5.0.dist-info → python_terminusgps-37.5.2.dist-info}/METADATA +1 -1
- {python_terminusgps-37.5.0.dist-info → python_terminusgps-37.5.2.dist-info}/RECORD +10 -10
- terminusgps/authorizenet/constants.py +3 -0
- terminusgps/authorizenet/profiles/addresses.py +18 -9
- terminusgps/authorizenet/profiles/customers.py +48 -21
- terminusgps/authorizenet/profiles/payments.py +29 -16
- terminusgps/authorizenet/profiles/subscriptions.py +70 -30
- terminusgps/authorizenet/tests/test_auth.py +2 -2
- {python_terminusgps-37.5.0.dist-info → python_terminusgps-37.5.2.dist-info}/WHEEL +0 -0
- {python_terminusgps-37.5.0.dist-info → python_terminusgps-37.5.2.dist-info}/licenses/COPYING +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version: 37.5.
|
|
3
|
+
Version: 37.5.2
|
|
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
terminusgps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
terminusgps/authorizenet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
terminusgps/authorizenet/auth.py,sha256=g2tJPxP9V1nXnUcKzhHSRSs6ruSIHej5_hcf8P7bod8,1262
|
|
4
|
-
terminusgps/authorizenet/constants.py,sha256=
|
|
4
|
+
terminusgps/authorizenet/constants.py,sha256=uXkYVmQPrnYBDfGahVEmzwTny21A8jGcrH7qfSdLhvc,512
|
|
5
5
|
terminusgps/authorizenet/controllers.py,sha256=rMuBwSoKJjte7wVuB1ewaqnzfuDXxwus-d5mkqbfnGE,2193
|
|
6
6
|
terminusgps/authorizenet/utils.py,sha256=lkXjKfegFFN8TgtjlyI03416X6oqFIciFnWgSEuIgSM,6800
|
|
7
7
|
terminusgps/authorizenet/items/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -10,13 +10,13 @@ terminusgps/authorizenet/items/base.py,sha256=fcO0RRrOXytlSbBDLLFajfdkxYtqmniJ5F
|
|
|
10
10
|
terminusgps/authorizenet/items/customer_profiles.py,sha256=53cqXooXszTqMv2PuifDsDknuDxGtA73jZkquWZl0zs,9262
|
|
11
11
|
terminusgps/authorizenet/items/payment_profiles.py,sha256=kYvuq1xCmeIUmmXgbOapbA01roQ4k0zOLafcBtG-eM0,10830
|
|
12
12
|
terminusgps/authorizenet/profiles/__init__.py,sha256=IG4XCEEYtHKqXOatlZlob6J3ukAgF7cFR-RXxOSMS1c,161
|
|
13
|
-
terminusgps/authorizenet/profiles/addresses.py,sha256=
|
|
13
|
+
terminusgps/authorizenet/profiles/addresses.py,sha256=MwJQzq3IrjYCLJzOglLfJIcMvH5osDu1MzN6_XGO0Tc,6376
|
|
14
14
|
terminusgps/authorizenet/profiles/base.py,sha256=Pu1NGrvC5Ox2W1oZuVcPqUw3aUoSK191Evexw1U6_3k,3940
|
|
15
|
-
terminusgps/authorizenet/profiles/customers.py,sha256=
|
|
16
|
-
terminusgps/authorizenet/profiles/payments.py,sha256=
|
|
17
|
-
terminusgps/authorizenet/profiles/subscriptions.py,sha256=
|
|
15
|
+
terminusgps/authorizenet/profiles/customers.py,sha256=GFSG5hPsShLCrqa40eDtdxxVIwJUqcgSFyhxsN5tbhw,12185
|
|
16
|
+
terminusgps/authorizenet/profiles/payments.py,sha256=57qtiPKGS6loPMccLXQJoHV3fGyNNQ0AXcR9ukDNrXE,11313
|
|
17
|
+
terminusgps/authorizenet/profiles/subscriptions.py,sha256=TKTGeYCNSiDMAQGwMnFOL7E_SKt3GsiwgtIfGJE3yHc,10256
|
|
18
18
|
terminusgps/authorizenet/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
terminusgps/authorizenet/tests/test_auth.py,sha256=
|
|
19
|
+
terminusgps/authorizenet/tests/test_auth.py,sha256=qwACQK6R4mu7i6IoSlY015X2ABB9jkTJE9JcHpfiZaQ,1601
|
|
20
20
|
terminusgps/authorizenet/tests/test_profiles.py,sha256=MkpMSU9cgSeLy9bBuZdhdFiPxFT5858u9C8BqAmRhGY,7537
|
|
21
21
|
terminusgps/authorizenet/tests/test_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
terminusgps/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -59,7 +59,7 @@ terminusgps/wialon/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
59
59
|
terminusgps/wialon/tests/test_items.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
60
60
|
terminusgps/wialon/tests/test_session.py,sha256=9mBlYchMo9NeqRIZsmxYzrM1zBHorqu4ooxqSNppLpI,1336
|
|
61
61
|
terminusgps/wialon/tests/test_utils.py,sha256=SK4PxJQGECFnzx_EQeRAQfsQ5_3FLaVcis2W9u_ibuI,1730
|
|
62
|
-
python_terminusgps-37.5.
|
|
63
|
-
python_terminusgps-37.5.
|
|
64
|
-
python_terminusgps-37.5.
|
|
65
|
-
python_terminusgps-37.5.
|
|
62
|
+
python_terminusgps-37.5.2.dist-info/METADATA,sha256=rs7iVZ9GR7e21fCHspgV86OVQ2cKErylAeGzzsFMk9c,1329
|
|
63
|
+
python_terminusgps-37.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
64
|
+
python_terminusgps-37.5.2.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
65
|
+
python_terminusgps-37.5.2.dist-info/RECORD,,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from authorizenet import apicontractsv1, apicontrollers
|
|
2
2
|
|
|
3
|
+
from terminusgps.authorizenet.constants import ANET_XMLNS
|
|
3
4
|
from terminusgps.authorizenet.profiles.base import AuthorizenetSubProfileBase
|
|
4
5
|
|
|
5
6
|
|
|
@@ -17,7 +18,9 @@ class AddressProfile(AuthorizenetSubProfileBase):
|
|
|
17
18
|
|
|
18
19
|
"""
|
|
19
20
|
return int(
|
|
20
|
-
self._authorizenet_create_shipping_address(address).
|
|
21
|
+
self._authorizenet_create_shipping_address(address).find(
|
|
22
|
+
f"{ANET_XMLNS}customerAddressId"
|
|
23
|
+
)
|
|
21
24
|
)
|
|
22
25
|
|
|
23
26
|
def update(self, address: apicontractsv1.customerAddressType) -> None:
|
|
@@ -66,8 +69,10 @@ class AddressProfile(AuthorizenetSubProfileBase):
|
|
|
66
69
|
customerProfileId=self.customerProfileId,
|
|
67
70
|
customerAddressId=self.id,
|
|
68
71
|
)
|
|
69
|
-
|
|
70
|
-
return self.execute_controller(
|
|
72
|
+
|
|
73
|
+
return self.execute_controller(
|
|
74
|
+
apicontrollers.getCustomerShippingAddressController(request)
|
|
75
|
+
)
|
|
71
76
|
|
|
72
77
|
def _authorizenet_create_shipping_address(
|
|
73
78
|
self, address: apicontractsv1.customerAddressType
|
|
@@ -89,8 +94,9 @@ class AddressProfile(AuthorizenetSubProfileBase):
|
|
|
89
94
|
defaultShippingAddress=self.default,
|
|
90
95
|
)
|
|
91
96
|
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
return self.execute_controller(
|
|
98
|
+
apicontrollers.createCustomerShippingAddressController(request)
|
|
99
|
+
)
|
|
94
100
|
|
|
95
101
|
def _authorizenet_update_shipping_address(
|
|
96
102
|
self, address: apicontractsv1.customerAddressType
|
|
@@ -117,8 +123,10 @@ class AddressProfile(AuthorizenetSubProfileBase):
|
|
|
117
123
|
address=address,
|
|
118
124
|
default=self.default,
|
|
119
125
|
)
|
|
120
|
-
|
|
121
|
-
return self.execute_controller(
|
|
126
|
+
|
|
127
|
+
return self.execute_controller(
|
|
128
|
+
apicontrollers.updateCustomerShippingAddressController(request)
|
|
129
|
+
)
|
|
122
130
|
|
|
123
131
|
def _authorizenet_delete_shipping_address(self) -> dict | None:
|
|
124
132
|
"""
|
|
@@ -142,5 +150,6 @@ class AddressProfile(AuthorizenetSubProfileBase):
|
|
|
142
150
|
customerAddressId=self.id,
|
|
143
151
|
)
|
|
144
152
|
|
|
145
|
-
|
|
146
|
-
|
|
153
|
+
return self.execute_controller(
|
|
154
|
+
apicontrollers.deleteCustomerShippingAddressController(request)
|
|
155
|
+
)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from authorizenet import apicontractsv1, apicontrollers
|
|
2
2
|
|
|
3
3
|
from terminusgps.authorizenet.auth import get_validation_mode
|
|
4
|
+
from terminusgps.authorizenet.constants import ANET_XMLNS
|
|
4
5
|
from terminusgps.authorizenet.controllers import AuthorizenetControllerExecutionError
|
|
5
6
|
from terminusgps.authorizenet.profiles.base import AuthorizenetProfileBase
|
|
6
7
|
|
|
@@ -29,8 +30,11 @@ class CustomerProfile(AuthorizenetProfileBase):
|
|
|
29
30
|
|
|
30
31
|
if not self.id:
|
|
31
32
|
try:
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
self.id = int(
|
|
34
|
+
self._authorizenet_get_customer_profile()
|
|
35
|
+
.find(f"{ANET_XMLNS}profile")
|
|
36
|
+
.find(f"{ANET_XMLNS}customerProfileId")
|
|
37
|
+
)
|
|
34
38
|
except AuthorizenetControllerExecutionError:
|
|
35
39
|
self.id = self.create()
|
|
36
40
|
|
|
@@ -124,7 +128,11 @@ class CustomerProfile(AuthorizenetProfileBase):
|
|
|
124
128
|
assert self.merchant_id or self.email, (
|
|
125
129
|
"Neither 'merchant_id' nor 'email' were set."
|
|
126
130
|
)
|
|
127
|
-
return int(
|
|
131
|
+
return int(
|
|
132
|
+
self._authorizenet_create_customer_profile().find(
|
|
133
|
+
f"{ANET_XMLNS}customerProfileId"
|
|
134
|
+
)
|
|
135
|
+
)
|
|
128
136
|
|
|
129
137
|
def update(self) -> None:
|
|
130
138
|
"""
|
|
@@ -157,13 +165,19 @@ class CustomerProfile(AuthorizenetProfileBase):
|
|
|
157
165
|
:rtype: :py:obj:`list`
|
|
158
166
|
|
|
159
167
|
"""
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
168
|
+
payment_profiles = (
|
|
169
|
+
self._authorizenet_get_customer_profile()
|
|
170
|
+
.find(f"{ANET_XMLNS}profile")
|
|
171
|
+
.findall(f"{ANET_XMLNS}paymentProfiles")
|
|
172
|
+
)
|
|
173
|
+
return (
|
|
174
|
+
[
|
|
175
|
+
int(profile.find(f"{ANET_XMLNS}customerPaymentProfileId"))
|
|
176
|
+
for profile in payment_profiles
|
|
165
177
|
]
|
|
166
|
-
|
|
178
|
+
if payment_profiles is not None
|
|
179
|
+
else []
|
|
180
|
+
)
|
|
167
181
|
|
|
168
182
|
def get_address_profile_ids(self) -> list[int]:
|
|
169
183
|
"""
|
|
@@ -173,10 +187,19 @@ class CustomerProfile(AuthorizenetProfileBase):
|
|
|
173
187
|
:rtype: :py:obj:`list`
|
|
174
188
|
|
|
175
189
|
"""
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
190
|
+
address_profiles = (
|
|
191
|
+
self._authorizenet_get_customer_profile()
|
|
192
|
+
.find(f"{ANET_XMLNS}profile")
|
|
193
|
+
.findall(f"{ANET_XMLNS}shipToList")
|
|
194
|
+
)
|
|
195
|
+
return (
|
|
196
|
+
[
|
|
197
|
+
int(profile.find(f"{ANET_XMLNS}customerAddressId"))
|
|
198
|
+
for profile in address_profiles
|
|
199
|
+
]
|
|
200
|
+
if address_profiles is not None
|
|
201
|
+
else []
|
|
202
|
+
)
|
|
180
203
|
|
|
181
204
|
def _generate_customer_profile_ex_type(
|
|
182
205
|
self,
|
|
@@ -247,8 +270,9 @@ class CustomerProfile(AuthorizenetProfileBase):
|
|
|
247
270
|
if self._email:
|
|
248
271
|
request.email = self._email
|
|
249
272
|
|
|
250
|
-
|
|
251
|
-
|
|
273
|
+
return self.execute_controller(
|
|
274
|
+
apicontrollers.getCustomerProfileController(request)
|
|
275
|
+
)
|
|
252
276
|
|
|
253
277
|
def _authorizenet_create_customer_profile(
|
|
254
278
|
self, validate: bool = False
|
|
@@ -277,8 +301,9 @@ class CustomerProfile(AuthorizenetProfileBase):
|
|
|
277
301
|
if validate:
|
|
278
302
|
request.validationMode = self.validationMode
|
|
279
303
|
|
|
280
|
-
|
|
281
|
-
|
|
304
|
+
return self.execute_controller(
|
|
305
|
+
apicontrollers.createCustomerProfileController(request)
|
|
306
|
+
)
|
|
282
307
|
|
|
283
308
|
def _authorizenet_update_customer_profile(
|
|
284
309
|
self, validate: bool = False
|
|
@@ -305,8 +330,9 @@ class CustomerProfile(AuthorizenetProfileBase):
|
|
|
305
330
|
if validate:
|
|
306
331
|
request.validationMode = self.validationMode
|
|
307
332
|
|
|
308
|
-
|
|
309
|
-
|
|
333
|
+
return self.execute_controller(
|
|
334
|
+
apicontrollers.updateCustomerProfileController(request)
|
|
335
|
+
)
|
|
310
336
|
|
|
311
337
|
def _authorizenet_delete_customer_profile(self) -> dict | None:
|
|
312
338
|
"""
|
|
@@ -327,5 +353,6 @@ class CustomerProfile(AuthorizenetProfileBase):
|
|
|
327
353
|
customerProfileId=self.id,
|
|
328
354
|
)
|
|
329
355
|
|
|
330
|
-
|
|
331
|
-
|
|
356
|
+
return self.execute_controller(
|
|
357
|
+
apicontrollers.deleteCustomerProfileController(request)
|
|
358
|
+
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from authorizenet import apicontractsv1, apicontrollers
|
|
2
2
|
|
|
3
|
+
from terminusgps.authorizenet.constants import ANET_XMLNS
|
|
3
4
|
from terminusgps.authorizenet.profiles.base import AuthorizenetSubProfileBase
|
|
4
5
|
|
|
5
6
|
|
|
@@ -7,7 +8,7 @@ class PaymentProfile(AuthorizenetSubProfileBase):
|
|
|
7
8
|
"""An Authorizenet customer payment profile."""
|
|
8
9
|
|
|
9
10
|
@property
|
|
10
|
-
def last_4(self) ->
|
|
11
|
+
def last_4(self) -> int | None:
|
|
11
12
|
"""
|
|
12
13
|
Last 4 digits of the payment profile credit card.
|
|
13
14
|
|
|
@@ -15,8 +16,14 @@ class PaymentProfile(AuthorizenetSubProfileBase):
|
|
|
15
16
|
|
|
16
17
|
"""
|
|
17
18
|
if self.id:
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
cc_num = (
|
|
20
|
+
self._authorizenet_get_payment_profile()
|
|
21
|
+
.find(f"{ANET_XMLNS}paymentProfile")
|
|
22
|
+
.find(f"{ANET_XMLNS}payment")
|
|
23
|
+
.find(f"{ANET_XMLNS}creditCard")
|
|
24
|
+
.find(f"{ANET_XMLNS}cardNumber")
|
|
25
|
+
) # returns string like: "XXXX<last_4>"
|
|
26
|
+
return int(str(cc_num[-4:])) if cc_num is not None else None
|
|
20
27
|
|
|
21
28
|
def create(
|
|
22
29
|
self,
|
|
@@ -37,7 +44,7 @@ class PaymentProfile(AuthorizenetSubProfileBase):
|
|
|
37
44
|
return int(
|
|
38
45
|
self._authorizenet_create_payment_profile(
|
|
39
46
|
address=address, payment=payment
|
|
40
|
-
).customerPaymentProfileId
|
|
47
|
+
).find(f"{ANET_XMLNS}customerPaymentProfileId")
|
|
41
48
|
)
|
|
42
49
|
|
|
43
50
|
def update(
|
|
@@ -112,8 +119,9 @@ class PaymentProfile(AuthorizenetSubProfileBase):
|
|
|
112
119
|
paging={"limit": str(limit), "offset": str(offset)},
|
|
113
120
|
)
|
|
114
121
|
|
|
115
|
-
|
|
116
|
-
|
|
122
|
+
return self.execute_controller(
|
|
123
|
+
apicontrollers.getTransactionListForCustomerController(request)
|
|
124
|
+
)
|
|
117
125
|
|
|
118
126
|
def _authorizenet_create_payment_profile(
|
|
119
127
|
self,
|
|
@@ -143,8 +151,9 @@ class PaymentProfile(AuthorizenetSubProfileBase):
|
|
|
143
151
|
validationMode=self.validationMode,
|
|
144
152
|
)
|
|
145
153
|
|
|
146
|
-
|
|
147
|
-
|
|
154
|
+
return self.execute_controller(
|
|
155
|
+
apicontrollers.createCustomerPaymentProfileController(request)
|
|
156
|
+
)
|
|
148
157
|
|
|
149
158
|
def _authorizenet_get_payment_profile(
|
|
150
159
|
self, issuer_info: bool = True
|
|
@@ -171,8 +180,9 @@ class PaymentProfile(AuthorizenetSubProfileBase):
|
|
|
171
180
|
includeIssuerInfo=str(issuer_info).lower(),
|
|
172
181
|
)
|
|
173
182
|
|
|
174
|
-
|
|
175
|
-
|
|
183
|
+
return self.execute_controller(
|
|
184
|
+
apicontrollers.getCustomerPaymentProfileController(request)
|
|
185
|
+
)
|
|
176
186
|
|
|
177
187
|
def _authorizenet_update_payment_profile(
|
|
178
188
|
self,
|
|
@@ -208,8 +218,9 @@ class PaymentProfile(AuthorizenetSubProfileBase):
|
|
|
208
218
|
validationMode=self.validationMode,
|
|
209
219
|
)
|
|
210
220
|
|
|
211
|
-
|
|
212
|
-
|
|
221
|
+
return self.execute_controller(
|
|
222
|
+
apicontrollers.updateCustomerPaymentProfileController(request)
|
|
223
|
+
)
|
|
213
224
|
|
|
214
225
|
def _authorizenet_validate_payment_profile(self) -> dict | None:
|
|
215
226
|
"""
|
|
@@ -233,8 +244,9 @@ class PaymentProfile(AuthorizenetSubProfileBase):
|
|
|
233
244
|
validationMode=self.validationMode,
|
|
234
245
|
)
|
|
235
246
|
|
|
236
|
-
|
|
237
|
-
|
|
247
|
+
return self.execute_controller(
|
|
248
|
+
apicontrollers.validateCustomerPaymentProfileController(request)
|
|
249
|
+
)
|
|
238
250
|
|
|
239
251
|
def _authorizenet_delete_payment_profile(self) -> dict | None:
|
|
240
252
|
"""
|
|
@@ -256,5 +268,6 @@ class PaymentProfile(AuthorizenetSubProfileBase):
|
|
|
256
268
|
customerPaymentProfileId=self.id,
|
|
257
269
|
)
|
|
258
270
|
|
|
259
|
-
|
|
260
|
-
|
|
271
|
+
return self.execute_controller(
|
|
272
|
+
apicontrollers.deleteCustomerPaymentProfileController(request)
|
|
273
|
+
)
|
|
@@ -2,7 +2,10 @@ import decimal
|
|
|
2
2
|
|
|
3
3
|
from authorizenet import apicontractsv1, apicontrollers
|
|
4
4
|
|
|
5
|
-
from terminusgps.authorizenet.constants import
|
|
5
|
+
from terminusgps.authorizenet.constants import (
|
|
6
|
+
ANET_XMLNS,
|
|
7
|
+
AuthorizenetSubscriptionStatus,
|
|
8
|
+
)
|
|
6
9
|
from terminusgps.authorizenet.profiles.base import AuthorizenetSubProfileBase
|
|
7
10
|
|
|
8
11
|
|
|
@@ -18,8 +21,12 @@ class SubscriptionProfile(AuthorizenetSubProfileBase):
|
|
|
18
21
|
|
|
19
22
|
"""
|
|
20
23
|
if self.id:
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
name = (
|
|
25
|
+
self._authorizenet_get_subscription()
|
|
26
|
+
.find(f"{ANET_XMLNS}subscription")
|
|
27
|
+
.find(f"{ANET_XMLNS}name")
|
|
28
|
+
)
|
|
29
|
+
return str(name) if name is not None else None
|
|
23
30
|
|
|
24
31
|
@property
|
|
25
32
|
def amount(self) -> decimal.Decimal | None:
|
|
@@ -30,9 +37,13 @@ class SubscriptionProfile(AuthorizenetSubProfileBase):
|
|
|
30
37
|
|
|
31
38
|
"""
|
|
32
39
|
if self.id:
|
|
40
|
+
amount = (
|
|
41
|
+
self._authorizenet_get_subscription()
|
|
42
|
+
.find(f"{ANET_XMLNS}subscription")
|
|
43
|
+
.find(f"{ANET_XMLNS}amount")
|
|
44
|
+
)
|
|
33
45
|
decimal.getcontext().prec = 4
|
|
34
|
-
|
|
35
|
-
return decimal.Decimal(float(sub.amount)) * 1
|
|
46
|
+
return decimal.Decimal(float(amount)) * 1 if amount is not None else None
|
|
36
47
|
|
|
37
48
|
@property
|
|
38
49
|
def status(self) -> AuthorizenetSubscriptionStatus | None:
|
|
@@ -43,47 +54,67 @@ class SubscriptionProfile(AuthorizenetSubProfileBase):
|
|
|
43
54
|
|
|
44
55
|
"""
|
|
45
56
|
if self.id:
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
status = self._authorizenet_get_subscription_status().find(
|
|
58
|
+
f"{ANET_XMLNS}status"
|
|
59
|
+
)
|
|
60
|
+
return (
|
|
61
|
+
AuthorizenetSubscriptionStatus(status) if status is not None else None
|
|
48
62
|
)
|
|
49
63
|
|
|
50
64
|
@property
|
|
51
65
|
def transactions(self) -> list[dict[str, str]]:
|
|
52
66
|
"""
|
|
53
|
-
Subscription
|
|
67
|
+
Subscription transaction list.
|
|
54
68
|
|
|
55
69
|
:type: :py:obj:`list`
|
|
70
|
+
|
|
56
71
|
"""
|
|
57
72
|
if not self.id:
|
|
58
|
-
return []
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
return [{}]
|
|
74
|
+
|
|
75
|
+
transactions = (
|
|
76
|
+
self._authorizenet_get_subscription(include_transactions=True)
|
|
77
|
+
.find(f"{ANET_XMLNS}subscription")
|
|
78
|
+
.find(f"{ANET_XMLNS}arbTransactions")
|
|
79
|
+
.findall(f"{ANET_XMLNS}arbTransaction")
|
|
80
|
+
)
|
|
81
|
+
return transactions if transactions is not None else [{}]
|
|
63
82
|
|
|
64
83
|
@property
|
|
65
84
|
def address_id(self) -> int | None:
|
|
66
85
|
"""
|
|
67
|
-
|
|
86
|
+
Subscription address id.
|
|
68
87
|
|
|
69
88
|
:type: :py:obj:`int` | :py:obj:`None`
|
|
70
89
|
|
|
71
90
|
"""
|
|
72
91
|
if self.id:
|
|
73
|
-
|
|
74
|
-
|
|
92
|
+
address_id = (
|
|
93
|
+
self._authorizenet_get_subscription()
|
|
94
|
+
.find(f"{ANET_XMLNS}subscription")
|
|
95
|
+
.find(f"{ANET_XMLNS}profile")
|
|
96
|
+
.find(f"{ANET_XMLNS}shippingProfile")
|
|
97
|
+
.find(f"{ANET_XMLNS}customerAddressId")
|
|
98
|
+
)
|
|
99
|
+
return int(address_id) if address_id is not None else None
|
|
75
100
|
|
|
76
101
|
@property
|
|
77
102
|
def payment_id(self) -> int | None:
|
|
78
103
|
"""
|
|
79
|
-
|
|
104
|
+
Subscription payment id.
|
|
80
105
|
|
|
81
106
|
:type: :py:obj:`int` | :py:obj:`None`
|
|
82
107
|
|
|
83
108
|
"""
|
|
84
109
|
if self.id:
|
|
85
|
-
|
|
86
|
-
|
|
110
|
+
payment_id = (
|
|
111
|
+
self._authorizenet_get_subscription()
|
|
112
|
+
.find(f"{ANET_XMLNS}subscription")
|
|
113
|
+
.find(f"{ANET_XMLNS}profile")
|
|
114
|
+
.find(f"{ANET_XMLNS}paymentProfile")
|
|
115
|
+
.find(f"{ANET_XMLNS}customerPaymentProfileId")
|
|
116
|
+
)
|
|
117
|
+
return int(payment_id) if payment_id is not None else None
|
|
87
118
|
|
|
88
119
|
def create(self, subscription: apicontractsv1.ARBSubscriptionType) -> int:
|
|
89
120
|
"""
|
|
@@ -96,7 +127,11 @@ class SubscriptionProfile(AuthorizenetSubProfileBase):
|
|
|
96
127
|
:rtype: :py:obj:`int`
|
|
97
128
|
|
|
98
129
|
"""
|
|
99
|
-
return int(
|
|
130
|
+
return int(
|
|
131
|
+
self._authorizenet_create_subscription(subscription).find(
|
|
132
|
+
f"{ANET_XMLNS}subscriptionId"
|
|
133
|
+
)
|
|
134
|
+
)
|
|
100
135
|
|
|
101
136
|
def update(self, subscription: apicontractsv1.ARBSubscriptionType) -> None:
|
|
102
137
|
"""
|
|
@@ -143,8 +178,9 @@ class SubscriptionProfile(AuthorizenetSubProfileBase):
|
|
|
143
178
|
subscription=subscription,
|
|
144
179
|
)
|
|
145
180
|
|
|
146
|
-
|
|
147
|
-
|
|
181
|
+
return self.execute_controller(
|
|
182
|
+
apicontrollers.ARBCreateSubscriptionController(request)
|
|
183
|
+
)
|
|
148
184
|
|
|
149
185
|
def _authorizenet_get_subscription(
|
|
150
186
|
self, include_transactions: bool = False
|
|
@@ -170,8 +206,9 @@ class SubscriptionProfile(AuthorizenetSubProfileBase):
|
|
|
170
206
|
includeTransactions=str(include_transactions).lower(),
|
|
171
207
|
)
|
|
172
208
|
|
|
173
|
-
|
|
174
|
-
|
|
209
|
+
return self.execute_controller(
|
|
210
|
+
apicontrollers.ARBGetSubscriptionController(request)
|
|
211
|
+
)
|
|
175
212
|
|
|
176
213
|
def _authorizenet_get_subscription_status(self) -> dict | None:
|
|
177
214
|
"""
|
|
@@ -191,8 +228,9 @@ class SubscriptionProfile(AuthorizenetSubProfileBase):
|
|
|
191
228
|
merchantAuthentication=self.merchantAuthentication, subscriptionId=self.id
|
|
192
229
|
)
|
|
193
230
|
|
|
194
|
-
|
|
195
|
-
|
|
231
|
+
return self.execute_controller(
|
|
232
|
+
apicontrollers.ARBGetSubscriptionStatusController(request)
|
|
233
|
+
)
|
|
196
234
|
|
|
197
235
|
def _authorizenet_update_subscription(
|
|
198
236
|
self, subscription: apicontractsv1.ARBSubscriptionType
|
|
@@ -216,8 +254,9 @@ class SubscriptionProfile(AuthorizenetSubProfileBase):
|
|
|
216
254
|
subscription=subscription,
|
|
217
255
|
)
|
|
218
256
|
|
|
219
|
-
|
|
220
|
-
|
|
257
|
+
return self.execute_controller(
|
|
258
|
+
apicontrollers.ARBUpdateSubscriptionController(request)
|
|
259
|
+
)
|
|
221
260
|
|
|
222
261
|
def _authorizenet_cancel_subscription(self) -> dict | None:
|
|
223
262
|
"""
|
|
@@ -237,5 +276,6 @@ class SubscriptionProfile(AuthorizenetSubProfileBase):
|
|
|
237
276
|
merchantAuthentication=self.merchantAuthentication, subscriptionId=self.id
|
|
238
277
|
)
|
|
239
278
|
|
|
240
|
-
|
|
241
|
-
|
|
279
|
+
return self.execute_controller(
|
|
280
|
+
apicontrollers.ARBCancelSubscriptionController(request)
|
|
281
|
+
)
|
|
@@ -16,8 +16,8 @@ class MerchantAuthenticationTestCase(TestCase):
|
|
|
16
16
|
MERCHANT_AUTH_TRANSACTION_KEY=TEST_MERCHANT_AUTH_TRANSACTION_KEY,
|
|
17
17
|
DEBUG=True,
|
|
18
18
|
)
|
|
19
|
-
def
|
|
20
|
-
auth_obj
|
|
19
|
+
def test_merchant_authentication_init(self) -> None:
|
|
20
|
+
auth_obj = auth.get_merchant_auth()
|
|
21
21
|
self.assertIsInstance(auth_obj, merchantAuthenticationType)
|
|
22
22
|
self.assertTrue(auth_obj.name == TEST_MERCHANT_AUTH_LOGIN_ID)
|
|
23
23
|
self.assertTrue(auth_obj.transactionKey == TEST_MERCHANT_AUTH_TRANSACTION_KEY)
|
|
File without changes
|
{python_terminusgps-37.5.0.dist-info → python_terminusgps-37.5.2.dist-info}/licenses/COPYING
RENAMED
|
File without changes
|