FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sample-code-csharp/SampleCodeTest/TestRunner.cs at master · AuthorizeNet/sample-code-csharp · GitHub
AuthorizeNet
/
sample-code-csharp
Public
Notifications
You must be signed in to change notification settings
Fork
132
Star
77
Code
Issues
5
Pull requests
7
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Security and quality
Insights
Expand file tree
Breadcrumbs
sample-code-csharp
/
SampleCodeTest
/
TestRunner.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
471 lines (387 loc) · 22.3 KB
Breadcrumbs
sample-code-csharp
/
SampleCodeTest
/
TestRunner.cs
Copy path
File metadata and controls
471 lines (387 loc) · 22.3 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
using
System
;
using
NUnit
.
Framework
;
using
AuthorizeNet
.
Api
.
Controllers
;
using
AuthorizeNet
.
Api
.
Contracts
.
V1
;
using
AuthorizeNet
.
Api
.
Controllers
.
Bases
;
using
net
.
authorize
.
sample
;
using
System
.
IO
;
using
System
.
Reflection
;
using
AuthorizeNet
;
using
net
.
authorize
.
sample
.
PaymentTransactions
;
using
System
.
Threading
;
using
net
.
authorize
.
sample
.
CustomerProfiles
;
#if
NETCOREAPP2_0
using
AuthorizeNet
.
Utilities
;
#endif
namespace
SampleCodeTest
{
[
TestFixture
]
public
class
TestRunner
{
string
apiLoginId
=
Constants
.
API_LOGIN_ID
;
string
transactionKey
=
Constants
.
TRANSACTION_KEY
;
string
TransactionID
=
Constants
.
TRANSACTION_ID
;
string
payerID
=
Constants
.
PAYER_ID
;
static
CryptoRandom
r
=
new
CryptoRandom
(
)
;
private
static
string
GetEmail
(
)
{
return
r
.
Next
(
1000
,
89999999
)
+
"@test.com"
;
}
private
static
decimal
GetAmount
(
)
{
return
r
.
Next
(
10
,
200
)
;
}
private
static
short
GetMonth
(
)
{
return
(
Int16
)
r
.
Next
(
7
,
365
)
;
}
[
Test
]
public
void
TestAllSampleCodes
(
)
{
#if
NETCOREAPP2_0
// DOTNET CORE SPECIFIC
#region DOTNET CORE SPECIFIC
ApiOperationBase
<
ANetApiRequest
,
ANetApiResponse
>
.
RunEnvironment
=
AuthorizeNet
.
Environment
.
SANDBOX
;
ApiOperationBase
<
ANetApiRequest
,
ANetApiResponse
>
.
RunEnvironment
.
HttpUseProxy
=
AuthorizeNet
.
Environment
.
getBooleanProperty
(
AuthorizeNet
.
Utilities
.
Constants
.
HttpsUseProxy
)
;
if
(
ApiOperationBase
<
ANetApiRequest
,
ANetApiResponse
>
.
RunEnvironment
.
HttpUseProxy
)
{
ApiOperationBase
<
ANetApiRequest
,
ANetApiResponse
>
.
RunEnvironment
.
HttpUseProxy
=
AuthorizeNet
.
Environment
.
getBooleanProperty
(
AuthorizeNet
.
Utilities
.
Constants
.
HttpsUseProxy
)
;
ApiOperationBase
<
ANetApiRequest
,
ANetApiResponse
>
.
RunEnvironment
.
HttpsProxyUsername
=
AuthorizeNet
.
Environment
.
GetProperty
(
AuthorizeNet
.
Utilities
.
Constants
.
HttpsProxyUsername
)
;
ApiOperationBase
<
ANetApiRequest
,
ANetApiResponse
>
.
RunEnvironment
.
HttpsProxyPassword
=
AuthorizeNet
.
Environment
.
GetProperty
(
AuthorizeNet
.
Utilities
.
Constants
.
HttpsProxyPassword
)
;
ApiOperationBase
<
ANetApiRequest
,
ANetApiResponse
>
.
RunEnvironment
.
HttpProxyHost
=
AuthorizeNet
.
Environment
.
GetProperty
(
AuthorizeNet
.
Utilities
.
Constants
.
HttpsProxyHost
)
;
ApiOperationBase
<
ANetApiRequest
,
ANetApiResponse
>
.
RunEnvironment
.
HttpProxyPort
=
AuthorizeNet
.
Environment
.
getIntProperty
(
AuthorizeNet
.
Utilities
.
Constants
.
HttpsProxyPort
)
;
}
#endregion
#endif
try
{
string
fileName
=
Constants
.
CONFIG_FILE
;
using
(
StreamReader
reader
=
File
.
OpenText
(
fileName
)
)
{
TestRunner
tr
=
new
TestRunner
(
)
;
var
numRetries
=
3
;
string
line
;
while
(
(
line
=
reader
.
ReadLine
(
)
)
!=
null
)
{
string
[
]
items
=
line
.
Split
(
'
\t
'
)
;
string
apiName
=
items
[
0
]
;
string
isDependent
=
items
[
1
]
;
string
shouldApiRun
=
items
[
2
]
;
if
(
!
shouldApiRun
.
Equals
(
"1"
)
)
continue
;
Console
.
WriteLine
(
new
String
(
'-'
,
20
)
)
;
Console
.
WriteLine
(
"Running test case for :: "
+
apiName
)
;
Console
.
WriteLine
(
new
String
(
'-'
,
20
)
)
;
ANetApiResponse
response
=
null
;
for
(
int
i
=
0
;
i
<
numRetries
;
++
i
)
{
try
{
if
(
isDependent
.
Equals
(
"0"
)
)
{
response
=
InvokeRunMethod
(
apiName
)
;
}
else
{
response
=
(
ANetApiResponse
)
typeof
(
TestRunner
)
.
GetMethod
(
"Test"
+
apiName
)
.
Invoke
(
tr
,
new
Object
[
]
{
}
)
;
}
if
(
(
response
!=
null
)
&&
(
response
.
messages
.
resultCode
==
messageTypeEnum
.
Ok
)
)
break
;
}
catch
(
Exception
e
)
{
Console
.
WriteLine
(
apiName
)
;
Console
.
WriteLine
(
e
.
ToString
(
)
)
;
}
}
Assert
.
IsNotNull
(
response
)
;
Assert
.
AreEqual
(
response
.
messages
.
resultCode
,
messageTypeEnum
.
Ok
)
;
}
}
}
catch
(
Exception
ex
)
{
throw
ex
;
}
}
public
ANetApiResponse
InvokeRunMethod
(
string
className
)
{
string
namespaceString
=
"net.authorize.sample."
;
if
(
className
.
Equals
(
typeof
(
UpdateSplitTenderGroup
)
.
Name
)
)
namespaceString
=
namespaceString
+
"PaymentTransactions."
;
if
(
className
.
Equals
(
typeof
(
CreateAnApplePayTransaction
)
.
Name
)
)
namespaceString
=
namespaceString
+
"ApplePayTransactions."
;
Type
classType
=
null
;
#if
NETCOREAPP2_0
classType
=
Type
.
GetType
(
namespaceString
+
className
+
",SampleCode_DotNet_Core"
)
;
#else
classType
=
Type
.
GetType
(
namespaceString
+
className
+
",SampleCode"
)
;
#endif
return
(
ANetApiResponse
)
classType
.
GetMethod
(
"Run"
)
.
Invoke
(
null
,
new
Object
[
]
{
apiLoginId
,
transactionKey
}
)
;
}
public
ANetApiResponse
TestValidateCustomerPaymentProfile
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
customerPaymentProfile
=
(
createCustomerPaymentProfileResponse
)
CreateCustomerPaymentProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
var
validateResponse
=
ValidateCustomerPaymentProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
,
customerPaymentProfile
.
customerPaymentProfileId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
validateResponse
;
}
public
ANetApiResponse
TestCaptureFundsAuthorizedThroughAnotherChannel
(
)
{
return
CaptureFundsAuthorizedThroughAnotherChannel
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
}
public
ANetApiResponse
TestDebitBankAccount
(
)
{
return
DebitBankAccount
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
}
public
ANetApiResponse
TestUpdateCustomerShippingAddress
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
shippingResponse
=
(
createCustomerShippingAddressResponse
)
CreateCustomerShippingAddress
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
var
updateResponse
=
(
updateCustomerShippingAddressResponse
)
UpdateCustomerShippingAddress
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
,
shippingResponse
.
customerAddressId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
updateResponse
;
}
public
ANetApiResponse
TestUpdateCustomerProfile
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
updateResponse
=
UpdateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
updateResponse
;
}
public
ANetApiResponse
TestUpdateCustomerPaymentProfile
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
paymentProfileResponse
=
(
createCustomerPaymentProfileResponse
)
CreateCustomerPaymentProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
var
updateResponse
=
UpdateCustomerPaymentProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
,
paymentProfileResponse
.
customerPaymentProfileId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
updateResponse
;
}
public
ANetApiResponse
TestGetCustomerShippingAddress
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
shippingResponse
=
(
createCustomerShippingAddressResponse
)
CreateCustomerShippingAddress
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
var
getResponse
=
GetCustomerShippingAddress
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
,
shippingResponse
.
customerAddressId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
getResponse
;
}
public
ANetApiResponse
TestGetCustomerProfileIds
(
)
{
return
GetCustomerProfileIds
.
Run
(
apiLoginId
,
transactionKey
)
;
}
public
ANetApiResponse
TestGetCustomerProfile
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
profileResponse
=
GetCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
profileResponse
;
}
public
ANetApiResponse
TestGetAcceptCustomerProfilePage
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
profileResponse
=
GetAcceptCustomerProfilePage
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
profileResponse
;
}
public
ANetApiResponse
TestGetCustomerPaymentProfile
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
paymentProfileResponse
=
(
createCustomerPaymentProfileResponse
)
CreateCustomerPaymentProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
var
getResponse
=
GetCustomerPaymentProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
,
paymentProfileResponse
.
customerPaymentProfileId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
getResponse
;
}
public
ANetApiResponse
TestDeleteCustomerShippingAddress
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
shippingResponse
=
(
createCustomerShippingAddressResponse
)
CreateCustomerShippingAddress
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
var
deleteResponse
=
DeleteCustomerShippingAddress
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
,
shippingResponse
.
customerAddressId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
deleteResponse
;
}
public
ANetApiResponse
TestDeleteCustomerProfile
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
return
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
}
public
ANetApiResponse
TestDeleteCustomerPaymentProfile
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
paymentProfileResponse
=
(
createCustomerPaymentProfileResponse
)
CreateCustomerPaymentProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
var
deleteResponse
=
DeleteCustomerPaymentProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
,
paymentProfileResponse
.
customerPaymentProfileId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
deleteResponse
;
}
public
ANetApiResponse
TestCreateCustomerShippingAddress
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
shippingResponse
=
(
createCustomerShippingAddressResponse
)
CreateCustomerShippingAddress
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
shippingResponse
;
}
public
ANetApiResponse
TestAuthorizeCreditCard
(
)
{
var
response
=
(
createTransactionResponse
)
AuthorizeCreditCard
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
return
response
;
}
public
ANetApiResponse
TestCreateCustomerProfileFromTransaction
(
)
{
var
response
=
(
createTransactionResponse
)
AuthorizeCreditCard
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
var
profileResponse
=
(
createCustomerProfileResponse
)
CreateCustomerProfileFromTransaction
.
Run
(
apiLoginId
,
transactionKey
,
response
.
transactionResponse
.
transId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
profileResponse
.
customerProfileId
)
;
return
profileResponse
;
}
public
ANetApiResponse
TestGetTransactionDetails
(
)
{
var
response
=
(
createTransactionResponse
)
AuthorizeCreditCard
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
return
GetTransactionDetails
.
Run
(
apiLoginId
,
transactionKey
,
response
.
transactionResponse
.
transId
)
;
}
public
ANetApiResponse
TestChargeCreditCard
(
)
{
return
ChargeCreditCard
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
}
public
ANetApiResponse
TestCapturePreviouslyAuthorizedgetAmount
(
)
{
var
response
=
(
createTransactionResponse
)
AuthorizeCreditCard
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
return
CapturePreviouslyAuthorizedAmount
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
,
response
.
transactionResponse
.
transId
)
;
}
public
ANetApiResponse
TestRefund
(
)
{
var
response
=
(
createTransactionResponse
)
AuthorizeCreditCard
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
response
=
(
createTransactionResponse
)
CapturePreviouslyAuthorizedAmount
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
,
response
.
transactionResponse
.
transId
)
;
return
RefundTransaction
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
,
response
.
transactionResponse
.
transId
)
;
}
public
ANetApiResponse
TestVoid
(
)
{
var
response
=
(
createTransactionResponse
)
AuthorizeCreditCard
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
return
VoidTransaction
.
Run
(
apiLoginId
,
transactionKey
,
response
.
transactionResponse
.
transId
)
;
}
public
ANetApiResponse
TestCreditBankAccount
(
)
{
return
CreditBankAccount
.
Run
(
apiLoginId
,
transactionKey
,
TransactionID
)
;
}
public
ANetApiResponse
TestChargeCustomerProfile
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
paymentProfileResponse
=
(
createCustomerPaymentProfileResponse
)
CreateCustomerPaymentProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
var
chargeResponse
=
ChargeCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
,
paymentProfileResponse
.
customerPaymentProfileId
,
GetAmount
(
)
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
return
chargeResponse
;
}
public
ANetApiResponse
TestPayPalAuthorizeOnly
(
)
{
return
PayPalAuthorizeOnly
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
}
public
ANetApiResponse
TestPayPalVoid
(
)
{
var
response
=
(
createTransactionResponse
)
PayPalAuthorizeCapture
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
return
PayPalVoid
.
Run
(
apiLoginId
,
transactionKey
,
response
.
transactionResponse
.
transId
)
;
}
public
ANetApiResponse
TestPayPalAuthorizeCapture
(
)
{
return
PayPalAuthorizeCapture
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
}
public
ANetApiResponse
TestPayPalAuthorizeCaptureContinued
(
)
{
var
response
=
(
createTransactionResponse
)
PayPalAuthorizeCapture
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
return
PayPalAuthorizeCaptureContinued
.
Run
(
apiLoginId
,
transactionKey
,
response
.
transactionResponse
.
transId
,
payerID
)
;
}
public
ANetApiResponse
TestPayPalAuthorizeOnlyContinued
(
)
{
return
PayPalAuthorizeOnlyContinued
.
Run
(
apiLoginId
,
transactionKey
,
TransactionID
,
payerID
)
;
}
public
ANetApiResponse
TestPayPalCredit
(
)
{
return
PayPalCredit
.
Run
(
apiLoginId
,
transactionKey
,
TransactionID
)
;
}
public
ANetApiResponse
TestPayPalGetDetails
(
)
{
var
response
=
(
createTransactionResponse
)
PayPalAuthorizeCapture
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
return
PayPalGetDetails
.
Run
(
apiLoginId
,
transactionKey
,
response
.
transactionResponse
.
transId
)
;
}
public
ANetApiResponse
TestPayPalPriorAuthorizationCapture
(
)
{
var
response
=
(
createTransactionResponse
)
PayPalAuthorizeCapture
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
return
PayPalPriorAuthorizationCapture
.
Run
(
apiLoginId
,
transactionKey
,
response
.
transactionResponse
.
transId
)
;
}
public
ANetApiResponse
TestCancelSubscription
(
)
{
var
response
=
(
ARBCreateSubscriptionResponse
)
CreateSubscription
.
Run
(
apiLoginId
,
transactionKey
,
GetMonth
(
)
)
;
return
CancelSubscription
.
Run
(
apiLoginId
,
transactionKey
,
response
.
subscriptionId
)
;
}
public
ANetApiResponse
TestCreateSubscriptionFromCustomerProfile
(
)
{
var
profileResponse
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
var
paymentProfileResponse
=
(
createCustomerPaymentProfileResponse
)
CreateCustomerPaymentProfile
.
Run
(
apiLoginId
,
transactionKey
,
profileResponse
.
customerProfileId
)
;
var
shippingResponse
=
(
createCustomerShippingAddressResponse
)
CreateCustomerShippingAddress
.
Run
(
apiLoginId
,
transactionKey
,
profileResponse
.
customerProfileId
)
;
Thread
.
Sleep
(
10000
)
;
var
response
=
(
ARBCreateSubscriptionResponse
)
CreateSubscriptionFromCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetMonth
(
)
,
profileResponse
.
customerProfileId
,
paymentProfileResponse
.
customerPaymentProfileId
,
shippingResponse
.
customerAddressId
)
;
CancelSubscription
.
Run
(
apiLoginId
,
transactionKey
,
response
.
subscriptionId
)
;
DeleteCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
profileResponse
.
customerProfileId
)
;
return
response
;
}
public
ANetApiResponse
TestCreateSubscription
(
)
{
var
response
=
(
ARBCreateSubscriptionResponse
)
CreateSubscription
.
Run
(
apiLoginId
,
transactionKey
,
GetMonth
(
)
)
;
CancelSubscription
.
Run
(
apiLoginId
,
transactionKey
,
response
.
subscriptionId
)
;
return
response
;
}
public
ANetApiResponse
TestGetSubscriptionStatus
(
)
{
var
response
=
(
ARBCreateSubscriptionResponse
)
CreateSubscription
.
Run
(
apiLoginId
,
transactionKey
,
GetMonth
(
)
)
;
var
subscriptionResponse
=
GetSubscriptionStatus
.
Run
(
apiLoginId
,
transactionKey
,
response
.
subscriptionId
)
;
return
subscriptionResponse
;
}
public
ANetApiResponse
TestGetSubscription
(
)
{
var
response
=
(
ARBCreateSubscriptionResponse
)
CreateSubscription
.
Run
(
apiLoginId
,
transactionKey
,
GetMonth
(
)
)
;
var
getResponse
=
GetSubscription
.
Run
(
apiLoginId
,
transactionKey
,
response
.
subscriptionId
)
;
CancelSubscription
.
Run
(
apiLoginId
,
transactionKey
,
response
.
subscriptionId
)
;
return
getResponse
;
}
public
ANetApiResponse
TestUpdateSubscription
(
)
{
var
response
=
(
ARBCreateSubscriptionResponse
)
CreateSubscription
.
Run
(
apiLoginId
,
transactionKey
,
GetMonth
(
)
)
;
var
updateResponse
=
UpdateSubscription
.
Run
(
apiLoginId
,
transactionKey
,
response
.
subscriptionId
)
;
CancelSubscription
.
Run
(
apiLoginId
,
transactionKey
,
response
.
subscriptionId
)
;
return
updateResponse
;
}
public
ANetApiResponse
TestCreateCustomerProfile
(
)
{
return
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
}
public
ANetApiResponse
TestCreateCustomerPaymentProfile
(
)
{
var
response
=
(
createCustomerProfileResponse
)
CreateCustomerProfile
.
Run
(
apiLoginId
,
transactionKey
,
GetEmail
(
)
)
;
return
CreateCustomerPaymentProfile
.
Run
(
apiLoginId
,
transactionKey
,
response
.
customerProfileId
)
;
}
public
ANetApiResponse
TestCreateAnApplePayTransaction
(
)
{
var
response
=
(
createTransactionResponse
)
CreateAnApplePayTransaction
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
return
response
;
}
public
ANetApiResponse
TestCreateAnAndroidPayTransaction
(
)
{
var
response
=
(
createTransactionResponse
)
CreateAnAndroidPayTransaction
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
return
response
;
}
public
ANetApiResponse
TestCreateAnAcceptTransaction
(
)
{
var
response
=
(
createTransactionResponse
)
CreateAnAcceptTransaction
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
return
response
;
}
public
ANetApiResponse
TestGetAnAcceptPaymentPage
(
)
{
return
GetAnAcceptPaymentPage
.
Run
(
apiLoginId
,
transactionKey
,
GetAmount
(
)
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL