FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sample-code-python/test-runner.py at master · omwami999/sample-code-python · GitHub
omwami999
/
sample-code-python
Public
forked from
AuthorizeNet/sample-code-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
sample-code-python
/
test-runner.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
667 lines (482 loc) · 28.6 KB
Breadcrumbs
sample-code-python
/
test-runner.py
Copy path
File metadata and controls
667 lines (482 loc) · 28.6 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
import
unittest
import
sys
import
imp
import
random
from
authorizenet
import
apicontractsv1
import
pyxb
import
time
class
TestRunner
(
unittest
.
TestCase
):
#pyxb.GlobalValidationConfig._setForBinding(False)
def
getEmail
(
self
):
return
str
(
random
.
randint
(
0
,
10000
))
+
"@test.com"
def
getAmount
(
self
):
return
random
.
randint
(
0
,
10000
)
def
getDay
(
self
):
return
random
.
randint
(
7
,
365
)
def
create_an_apple_pay_transaction
(
self
):
print
(
"create_an_apple_pay_transaction"
)
modl
=
imp
.
load_source
(
'modulename'
,
'MobileInappTransactions/create-an-apple-pay-transaction.py'
)
return
modl
.
create_an_apple_pay_transaction
()
def
create_an_accept_transaction
(
self
):
print
(
"create_an_accept_transaction"
)
modl
=
imp
.
load_source
(
'modulename'
,
'MobileInappTransactions/create-an-accept-transaction.py'
)
return
modl
.
create_an_accept_transaction
()
def
create_an_android_pay_transaction
(
self
):
print
(
"create_an_android_pay_transaction"
)
modl
=
imp
.
load_source
(
'modulename'
,
'MobileInappTransactions/create-an-android-pay-transaction.py'
)
return
modl
.
create_an_android_pay_transaction
()
def
create_customer_payment_profile
(
self
):
print
(
"create_customer_payment_profile"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
#create customer payment profile for that above profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-payment-profile.py'
)
response
=
modl
.
create_customer_payment_profile
(
str
(
response
.
customerProfileId
))
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
str
(
response
.
customerProfileId
))
return
response
def
create_customer_profile_from_transaction
(
self
):
print
(
"create_customer_profile_from_transaction"
)
#Create transaction
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/authorize-credit-card.py'
)
response
=
modl
.
authorize_credit_card
(
self
.
getAmount
())
#create customer payment profile for above transaction
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile-from-transaction.py'
)
response
=
modl
.
create_customer_profile_from_transaction
(
str
(
response
.
transactionResponse
.
transId
))
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
str
(
response
.
customerProfileId
))
return
response
def
create_customer_profile
(
self
):
print
(
"create_customer_profile"
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
str
(
response
.
customerProfileId
))
return
response
def
create_customer_shipping_address
(
self
):
print
(
"create_customer_shipping_address"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-shipping-address.py'
)
response
=
modl
.
create_customer_shipping_address
(
str
(
response
.
customerProfileId
))
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
str
(
response
.
customerProfileId
))
return
response
def
delete_customer_payment_profile
(
self
):
print
(
"delete_customer_payment_profile"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
customerProfileId
=
str
(
response
.
customerProfileId
)
#create customer payment profile for that above profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-payment-profile.py'
)
response
=
modl
.
create_customer_payment_profile
(
str
(
response
.
customerProfileId
))
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-payment-profile.py'
)
response
=
modl
.
delete_customer_payment_profile
(
customerProfileId
,
str
(
response
.
customerPaymentProfileId
))
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
customerProfileId
)
return
response
def
delete_customer_profile
(
self
):
print
(
"delete_customer_profile"
)
#Create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
return
modl
.
delete_customer_profile
(
str
(
response
.
customerProfileId
))
def
delete_customer_shipping_address
(
self
):
print
(
"delete_customer_shipping_address"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
customerProfileId
=
str
(
response
.
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-shipping-address.py'
)
response
=
modl
.
create_customer_shipping_address
(
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-shipping-address.py'
)
response
=
modl
.
delete_customer_shipping_address
(
customerProfileId
,
str
(
response
.
customerAddressId
))
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
customerProfileId
)
return
response
def
get_customer_payment_profile
(
self
):
print
(
"get_customer_payment_profile"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
customerProfileId
=
str
(
response
.
customerProfileId
)
#create customer payment profile for that above profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-payment-profile.py'
)
response
=
modl
.
create_customer_payment_profile
(
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/get-customer-payment-profile.py'
)
response
=
modl
.
get_customer_payment_profile
(
customerProfileId
,
str
(
response
.
customerPaymentProfileId
))
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
customerProfileId
)
return
response
def
get_customer_payment_profile_list
(
self
):
print
(
"get_customer_payment_profile_list"
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/get-customer-payment-profile-list.py'
)
return
modl
.
get_customer_payment_profile_list
()
def
get_customer_profile_ids
(
self
):
print
(
"get_customer_profile_ids"
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/get-customer-profile-ids.py'
)
return
modl
.
get_customer_profile_ids
()
def
get_customer_profile
(
self
):
print
(
"get_customer_profile"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
customerProfileId
=
str
(
response
.
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/get-customer-profile.py'
)
response
=
modl
.
get_customer_profile
(
customerProfileId
)
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
customerProfileId
)
return
response
def
get_customer_shipping_address
(
self
):
print
(
"get_customer_shipping_address"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
customerProfileId
=
str
(
response
.
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-shipping-address.py'
)
response
=
modl
.
create_customer_shipping_address
(
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/get-customer-shipping-address.py'
)
response
=
modl
.
get_customer_shipping_address
(
customerProfileId
,
str
(
response
.
customerAddressId
))
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
customerProfileId
)
return
response
def
get_hosted_profile_page
(
self
):
print
(
"get_hosted_profile_page"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
customerProfileId
=
str
(
response
.
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/get-hosted-profile-page.py'
)
response
=
modl
.
get_hosted_profile_page
(
customerProfileId
)
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
customerProfileId
)
return
response
def
update_customer_payment_profile
(
self
):
print
(
"update_customer_payment_profile"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
customerProfileId
=
str
(
response
.
customerProfileId
)
#create customer payment profile for that above profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-payment-profile.py'
)
response
=
modl
.
create_customer_payment_profile
(
customerProfileId
)
if
hasattr
(
response
,
'customerProfileId'
)
==
True
:
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/update-customer-payment-profile.py'
)
response
=
modl
.
update_customer_payment_profile
(
customerProfileId
,
str
(
response
.
customerPaymentProfileId
))
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
customerProfileId
)
return
response
def
update_customer_profile
(
self
):
print
(
"update_customer_profile"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
customerProfileId
=
str
(
response
.
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/update-customer-profile.py'
)
response
=
modl
.
update_customer_profile
(
customerProfileId
)
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
customerProfileId
)
return
response
def
update_customer_shipping_address
(
self
):
print
(
"update_customer_shipping_address"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
customerProfileId
=
str
(
response
.
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-shipping-address.py'
)
response
=
modl
.
create_customer_shipping_address
(
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/update-customer-shipping-address.py'
)
response
=
modl
.
update_customer_shipping_address
(
customerProfileId
,
str
(
response
.
customerAddressId
))
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
customerProfileId
)
return
response
def
validate_customer_payment_profile
(
self
):
print
(
"validate_customer_payment_profile"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
customerProfileId
=
str
(
response
.
customerProfileId
)
#create customer payment profile for that above profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-payment-profile.py'
)
response
=
modl
.
create_customer_payment_profile
(
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/validate-customer-payment-profile.py'
)
response
=
modl
.
validate_customer_payment_profile
(
customerProfileId
,
str
(
response
.
customerPaymentProfileId
))
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
customerProfileId
)
return
response
def
authorize_credit_card
(
self
):
print
(
"authorize_credit_card"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/authorize-credit-card.py'
)
return
modl
.
authorize_credit_card
(
self
.
getAmount
())
def
capture_funds_authorized_through_another_channel
(
self
):
print
(
"capture_funds_authorized_through_another_channel"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/capture-funds-authorized-through-another-channel.py'
)
return
modl
.
capture_funds_authorized_through_another_channel
()
def
capture_previously_authorized_amount
(
self
):
print
(
"capture_previously_authorized_amount"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/authorize-credit-card.py'
)
response
=
modl
.
authorize_credit_card
(
self
.
getAmount
())
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/capture-previously-authorized-amount.py'
)
return
modl
.
capture_previously_authorized_amount
(
response
.
transactionResponse
.
transId
)
def
charge_credit_card
(
self
):
print
(
"charge_credit_card"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/charge-credit-card.py'
)
return
modl
.
charge_credit_card
(
self
.
getAmount
())
def
charge_customer_profile
(
self
):
print
(
"charge_customer_profile"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
response
=
modl
.
create_customer_profile
()
customerProfileId
=
str
(
response
.
customerProfileId
)
#create customer payment profile for that above profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-payment-profile.py'
)
response
=
modl
.
create_customer_payment_profile
(
customerProfileId
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/charge-customer-profile.py'
)
response
=
modl
.
charge_customer_profile
(
customerProfileId
,
str
(
response
.
customerPaymentProfileId
),
self
.
getAmount
())
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
customerProfileId
)
return
response
def
charge_tokenized_credit_card
(
self
):
print
(
"charge_tokenized_credit_card"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/charge-tokenized-credit-card.py'
)
return
modl
.
charge_tokenized_credit_card
()
def
credit_bank_account
(
self
):
print
(
"credit_bank_account"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/credit-bank-account.py'
)
return
modl
.
credit_bank_account
()
def
debit_bank_account
(
self
):
print
(
"debit_bank_account"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/debit-bank-account.py'
)
return
modl
.
debit_bank_account
(
str
(
round
(
random
.
random
()
*
100
,
2
)))
def
refund_transaction
(
self
):
print
(
"refund_transaction"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/authorize-credit-card.py'
)
response
=
modl
.
authorize_credit_card
(
self
.
getAmount
())
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/refund-transaction.py'
)
return
modl
.
refund_transaction
(
response
.
transactionResponse
.
transId
)
def
update_split_tender_group
(
self
):
print
(
"update_split_tender_group"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/update-split-tender-group.py'
)
return
modl
.
update_split_tender_group
()
def
void_transaction
(
self
):
print
(
"void_transaction"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/authorize-credit-card.py'
)
response
=
modl
.
authorize_credit_card
(
self
.
getAmount
())
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/void-transaction.py'
)
return
modl
.
void_transaction
(
response
.
transactionResponse
.
transId
)
def
authorization_and_capture_continued
(
self
):
print
(
"authorization_and_capture_continued"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/authorization-and-capture.py'
)
response
=
modl
.
authorization_and_capture
(
self
.
getAmount
())
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/authorization-and-capture-continued.py'
)
return
modl
.
authorization_and_capture_continued
(
str
(
response
.
transactionResponse
.
transId
),
"6ZSCSYG33VP8Q"
)
def
authorization_and_capture
(
self
):
print
(
"authorization_and_capture"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/authorization-and-capture.py'
)
return
modl
.
authorization_and_capture
(
self
.
getAmount
())
def
authorization_only_continued
(
self
):
print
(
"authorization_only_continued"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/authorization-only-continued.py'
)
return
modl
.
authorization_only_continued
()
def
authorization_only
(
self
):
print
(
"authorization_only"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/authorization-only.py'
)
return
modl
.
authorization_only
()
def
credit
(
self
):
print
(
"credit"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/credit.py'
)
return
modl
.
credit
()
def
get_details
(
self
):
print
(
"get_details"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/authorization-and-capture.py'
)
response
=
modl
.
authorization_and_capture
(
self
.
getAmount
())
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/get-details.py'
)
return
modl
.
get_details
(
str
(
response
.
transactionResponse
.
transId
))
def
prior_authorization_capture
(
self
):
print
(
"prior_authorization_capture"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/authorization-and-capture.py'
)
response
=
modl
.
authorization_and_capture
(
self
.
getAmount
())
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/prior-authorization-capture.py'
)
return
modl
.
prior_authorization_capture
(
str
(
response
.
transactionResponse
.
transId
))
def
void
(
self
):
print
(
"void"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/authorization-and-capture.py'
)
response
=
modl
.
authorization_and_capture
(
self
.
getAmount
())
modl
=
imp
.
load_source
(
'modulename'
,
'PayPalExpressCheckout/void.py'
)
return
modl
.
void
(
str
(
response
.
transactionResponse
.
transId
))
def
cancel_subscription
(
self
):
print
(
"cancel_subscription"
)
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/create-subscription.py'
)
response
=
modl
.
create_subscription
(
self
.
getAmount
(),
self
.
getDay
())
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/cancel-subscription.py'
)
return
modl
.
cancel_subscription
(
response
.
subscriptionId
)
def
create_subscription
(
self
):
print
(
"create_subscription"
)
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/create-subscription.py'
)
return
modl
.
create_subscription
(
self
.
getAmount
(),
self
.
getDay
())
def
create_subscription_from_customer_profile
(
self
):
print
(
"create_subscription_from_customer_profile"
)
#create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-profile.py'
)
profileResponse
=
modl
.
create_customer_profile
()
#create customer payment profile for that above profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-payment-profile.py'
)
paymentProfileResponse
=
modl
.
create_customer_payment_profile
(
str
(
profileResponse
.
customerProfileId
))
#Create customer shipping address
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/create-customer-shipping-address.py'
)
shippingResponse
=
modl
.
create_customer_shipping_address
(
str
(
profileResponse
.
customerProfileId
))
time
.
sleep
(
10
)
#Create subscripiton from customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/create-subscription-from-customer-profile.py'
)
response
=
modl
.
create_subscription_from_customer_profile
(
self
.
getAmount
(),
self
.
getDay
(),
str
(
profileResponse
.
customerProfileId
),
str
(
paymentProfileResponse
.
customerPaymentProfileId
),
str
(
shippingResponse
.
customerAddressId
))
#Cancel subscription
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/cancel-subscription.py'
)
modl
.
cancel_subscription
(
str
(
response
.
subscriptionId
))
#delete newly create customer profile
modl
=
imp
.
load_source
(
'modulename'
,
'CustomerProfiles/delete-customer-profile.py'
)
modl
.
delete_customer_profile
(
str
(
profileResponse
.
customerProfileId
))
return
response
def
get_list_of_subscriptions
(
self
):
print
(
"get_list_of_subscriptions"
)
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/get-list-of-subscriptions.py'
)
return
modl
.
get_list_of_subscriptions
()
def
get_subscription_status
(
self
):
print
(
"get_subscription_status"
)
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/create-subscription.py'
)
response
=
modl
.
create_subscription
(
self
.
getAmount
(),
self
.
getDay
())
subscriptionId
=
response
.
subscriptionId
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/get-subscription-status.py'
)
response
=
modl
.
get_subscription_status
(
subscriptionId
)
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/cancel-subscription.py'
)
modl
.
cancel_subscription
(
subscriptionId
)
return
response
def
get_subscription
(
self
):
print
(
"get_subscription"
)
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/create-subscription.py'
)
response
=
modl
.
create_subscription
(
self
.
getAmount
(),
self
.
getDay
())
subscriptionId
=
str
(
response
.
subscriptionId
)
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/get-subscription.py'
)
response
=
modl
.
get_subscription
(
subscriptionId
)
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/cancel-subscription.py'
)
modl
.
cancel_subscription
(
subscriptionId
)
return
response
def
update_subscription
(
self
):
print
(
"update_subscription"
)
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/create-subscription.py'
)
response
=
modl
.
create_subscription
(
self
.
getAmount
(),
self
.
getDay
())
subscriptionId
=
str
(
response
.
subscriptionId
)
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/update-subscription.py'
)
response
=
modl
.
update_subscription
(
subscriptionId
)
modl
=
imp
.
load_source
(
'modulename'
,
'RecurringBilling/cancel-subscription.py'
)
modl
.
cancel_subscription
(
subscriptionId
)
return
response
def
get_batch_statistics
(
self
):
print
(
"get_batch_statistics"
)
modl
=
imp
.
load_source
(
'modulename'
,
'TransactionReporting/get-batch-statistics.py'
)
return
modl
.
get_batch_statistics
()
def
get_settled_batch_list
(
self
):
print
(
"get_settled_batch_list"
)
modl
=
imp
.
load_source
(
'modulename'
,
'TransactionReporting/get-settled-batch-list.py'
)
return
modl
.
get_settled_batch_list
()
def
get_transaction_details
(
self
):
print
(
"get_transaction_details"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/authorize-credit-card.py'
)
response
=
modl
.
authorize_credit_card
(
self
.
getAmount
())
modl
=
imp
.
load_source
(
'modulename'
,
'TransactionReporting/get-transaction-details.py'
)
return
modl
.
get_transaction_details
(
response
.
transactionResponse
.
transId
)
def
get_transaction_list
(
self
):
print
(
"get_transaction_list"
)
modl
=
imp
.
load_source
(
'modulename'
,
'TransactionReporting/get-transaction-list.py'
)
return
modl
.
get_transaction_list
()
def
get_unsettled_transaction_list
(
self
):
print
(
"get_unsettled_transaction_list"
)
modl
=
imp
.
load_source
(
'modulename'
,
'TransactionReporting/get-unsettled-transaction-list.py'
)
return
modl
.
get_unsettled_transaction_list
()
def
create_visa_src_transaction
(
self
):
print
(
"create_visa_src_transaction"
)
modl
=
imp
.
load_source
(
'modulename'
,
'VisaCheckout/create-visa-checkout-transaction.py'
)
return
modl
.
create_visa_src_transaction
()
def
decrypt_visa_src_data
(
self
):
print
(
"decrypt_visa_src_data"
)
modl
=
imp
.
load_source
(
'modulename'
,
'VisaCheckout/decrypt-visa-checkout-data.py'
)
return
modl
.
decrypt_visa_src_data
()
def
get_merchant_details
(
self
):
print
(
"get_merchant_details"
)
modl
=
imp
.
load_source
(
'modulename'
,
'TransactionReporting/get-merchant-details.py'
)
return
modl
.
get_merchant_details
()
def
get_an_accept_payment_page
(
self
):
print
(
"get_an_accept_payment_page"
)
modl
=
imp
.
load_source
(
'modulename'
,
'AcceptSuite/get-an-accept-payment-page.py'
)
return
modl
.
get_an_accept_payment_page
(
self
.
getAmount
())
def
update_held_transaction
(
self
):
print
(
"update_held_transaction"
)
modl
=
imp
.
load_source
(
'modulename'
,
'PaymentTransactions/update-held-transaction.py'
)
return
modl
.
update_held_transaction
(
"12345"
)
# added new method
def
get_account_updater_job_details
(
self
):
print
(
"get_account_updater_job_details"
)
modl
=
imp
.
load_source
(
'modulename'
,
'TransactionReporting/get-account-updater-job-details.py'
)
return
modl
.
get_account_updater_job_details
()
def
validate_response
(
self
,
response
):
if
(
response
is
None
):
return
False
if
(
response
.
messages
.
resultCode
!=
apicontractsv1
.
messageTypeEnum
.
Ok
):
return
False
return
True
def
test_all_sample_codes
(
self
):
failed
=
[]
succeeded
=
[]
with
open
(
'list_of_sample_codes.txt'
,
'r'
)
as
f
:
numRetries
=
3
for
line
in
f
:
#print(line)
items
=
line
.
split
(
'
\t
'
)
apiName
=
items
[
0
]
isDependent
=
items
[
1
]
shouldApiRun
=
items
[
2
].
rstrip
()[
0
]
if
(
shouldApiRun
==
'0'
):
continue
if
(
shouldApiRun
==
'1'
):
for
i
in
range
(
0
,
numRetries
):
try
:
print
(
"-------------------------------"
)
print
(
"Running : "
+
apiName
)
print
(
"-------------------------------"
)
response
=
getattr
(
self
,
apiName
)()
#if(self.validate_response(response)):
# succeeded.append(apiName)
#else:
# failed.append(apiName)
if
self
.
validate_response
(
response
)
==
True
:
break
except
BaseException
as
e
:
print
(
str
(
e
))
self
.
assertTrue
(
self
.
validate_response
(
response
))
#print("-------- Success ----------")
#for line in succeeded:
# print(line)
#print("-------- Failed ----------")
#for line in failed:
# print(line)
#def test_sample(self):
# self.assertTrue(self.get_customer_shipping_address())
unittest
.
main
()
Back
|
FazBrowse Home
|
New Git URL