@@ -23,8 +23,8 @@ describe('AuthorizeNet service', function () {
23
23
assert . equal ( transaction . transactionResponse . responseCode , '1' ) ;
24
24
done ( ) ;
25
25
} , function ( rejection ) {
26
- done ( rejection ) ;
27
- } )
26
+ done ( JSON . stringify ( rejection ) ) ;
27
+ } ) ;
28
28
} ) ;
29
29
30
30
it ( 'should submit authorizationCapture request with some extra params' , function ( done ) {
@@ -97,18 +97,18 @@ describe('AuthorizeNet service', function () {
97
97
service . authOnlyTransaction ( randomAmount ( ) , 4007000000027 , 2016 , 2 ) . then ( function ( transaction ) {
98
98
assert . equal ( transaction . transactionResponse . responseCode , '1' ) ;
99
99
done ( ) ;
100
- } ) . catch ( function ( err ) {
101
- done ( err ) ;
100
+ } ) . catch ( function ( rejection ) {
101
+ done ( JSON . stringify ( rejection ) ) ;
102
102
} )
103
103
} ) ;
104
104
105
105
it ( 'should submit authorization only request with extra params' , function ( done ) {
106
106
service . authOnlyTransaction ( randomAmount ( ) , 4007000000027 , 2017 , 11 , { transactionRequest : { payment : { creditCard : { cardCode : 666 } } } } ) . then ( function ( transaction ) {
107
107
assert . equal ( transaction . transactionResponse . responseCode , '1' ) ;
108
108
done ( ) ;
109
- } ) . catch ( function ( err ) {
110
- done ( err ) ;
111
- } )
109
+ } ) . catch ( function ( rejection ) {
110
+ done ( JSON . stringify ( rejection ) ) ;
111
+ } ) ;
112
112
} ) ;
113
113
114
114
it ( 'should reject the promise when web service send an error code' , function ( done ) {
@@ -147,9 +147,8 @@ describe('AuthorizeNet service', function () {
147
147
assert . equal ( trans . transactionResponse . responseCode , '1' ) ;
148
148
done ( ) ;
149
149
} )
150
- . catch ( function ( err ) {
151
- console . log ( err ) ;
152
- done ( err ) ;
150
+ . catch ( function ( rejection ) {
151
+ done ( JSON . stringify ( rejection ) ) ;
153
152
} ) ;
154
153
} ) ;
155
154
@@ -215,9 +214,9 @@ describe('AuthorizeNet service', function () {
215
214
assert . equal ( trans . transactionResponse . responseCode , '1' ) ;
216
215
done ( ) ;
217
216
} )
218
- . catch ( function ( err ) {
219
- done ( err ) ;
220
- } )
217
+ . catch ( function ( rejection ) {
218
+ done ( JSON . stringify ( rejection ) ) ;
219
+ } ) ;
221
220
} ) ;
222
221
223
222
it ( 'should reject the promise when web service send an error code' , function ( done ) {
@@ -258,9 +257,9 @@ describe('AuthorizeNet service', function () {
258
257
assert . equal ( trans . transaction . transId , transId ) ;
259
258
done ( ) ;
260
259
} )
261
- . catch ( function ( err ) {
262
- done ( err ) ;
263
- } )
260
+ . catch ( function ( rejection ) {
261
+ done ( JSON . stringify ( rejection ) ) ;
262
+ } ) ;
264
263
} ) ;
265
264
266
265
it ( 'should reject the promise when web service return error code' , function ( done ) {
@@ -292,9 +291,9 @@ describe('AuthorizeNet service', function () {
292
291
service . getUnsettledTransactionList ( ) . then ( function ( response ) {
293
292
assert ( response . transactions , 'transactions field should be defined' ) ;
294
293
done ( ) ;
295
- } ) . catch ( function ( err ) {
296
- done ( err ) ;
297
- } )
294
+ } ) . catch ( function ( rejection ) {
295
+ done ( JSON . stringify ( rejection ) ) ;
296
+ } ) ;
298
297
} ) ;
299
298
300
299
} ) ;
@@ -305,9 +304,9 @@ describe('AuthorizeNet service', function () {
305
304
service . getSettledBatchList ( true , new Date ( Date . now ( ) - 7 * 24 * 3600 * 1000 ) , new Date ( ) ) . then ( function ( response ) {
306
305
assert ( response . batchList , 'batchList should be defined' ) ;
307
306
done ( ) ;
308
- } ) . catch ( function ( err ) {
309
- done ( err ) ;
310
- } )
307
+ } ) . catch ( function ( rejection ) {
308
+ done ( JSON . stringify ( rejection ) ) ;
309
+ } ) ;
311
310
} ) ;
312
311
313
312
} ) ;
@@ -322,9 +321,9 @@ describe('AuthorizeNet service', function () {
322
321
. then ( function ( response ) {
323
322
assert ( response . batch , 'batch should be defined' ) ;
324
323
done ( ) ;
325
- } ) . catch ( function ( err ) {
326
- done ( err ) ;
327
- } )
324
+ } ) . catch ( function ( rejection ) {
325
+ done ( JSON . stringify ( rejection ) ) ;
326
+ } ) ;
328
327
} ) ;
329
328
330
329
it ( 'should reject the promise if any error happens' , function ( done ) {
@@ -349,10 +348,10 @@ describe('AuthorizeNet service', function () {
349
348
. then ( function ( response ) {
350
349
assert ( response . transactions . transaction , 'it should have a list of transactions' ) ;
351
350
done ( ) ;
352
- } ) . catch ( function ( err ) {
353
- done ( err ) ;
354
- } )
351
+ } ) . catch ( function ( rejection ) {
352
+ done ( JSON . stringify ( rejection ) ) ;
353
+ } ) ;
355
354
} ) ;
356
- } ) ;
355
+ } ) ;
357
356
358
357
} ) ;
0 commit comments