1
1
import nock from "nock" ;
2
2
import { createClient } from "../__mocks__/base" ;
3
3
import Client from "../client" ;
4
- import ClassicIntegration from "../services/paymentApi " ;
4
+ import { PaymentAPI } from "../services" ;
5
5
import { payment } from "../typings" ;
6
6
import HttpClientException from "../httpClient/httpClientException" ;
7
7
import { PaymentResult } from "../typings/payment/paymentResult" ;
8
8
9
9
let client : Client ;
10
- let classicIntegration : ClassicIntegration ;
10
+ let classicIntegration : PaymentAPI ;
11
11
let scope : nock . Scope ;
12
12
13
13
beforeEach ( ( ) : void => {
@@ -16,7 +16,7 @@ beforeEach((): void => {
16
16
}
17
17
client = createClient ( ) ;
18
18
scope = nock ( "https://pal-test.adyen.com/pal/servlet/Payment/v68" ) ;
19
- classicIntegration = new ClassicIntegration ( client ) ;
19
+ classicIntegration = new PaymentAPI ( client ) ;
20
20
} ) ;
21
21
22
22
afterEach ( ( ) => {
@@ -52,7 +52,7 @@ describe("Classic Integration", (): void => {
52
52
"merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
53
53
} ;
54
54
55
- const paymentResult : PaymentResult = await classicIntegration . authorise ( paymentRequest ) ;
55
+ const paymentResult : PaymentResult = await classicIntegration . PaymentsApi . authorise ( paymentRequest ) ;
56
56
expect ( paymentResult . pspReference ) . toEqual ( "JVBXGSDM53RZNN82" ) ;
57
57
} ) ;
58
58
@@ -82,7 +82,7 @@ describe("Classic Integration", (): void => {
82
82
"merchantAccount" : "INVALID_MERCHANT_ACCOUNT"
83
83
} ;
84
84
85
- await classicIntegration . authorise ( paymentRequest ) ;
85
+ await classicIntegration . PaymentsApi . authorise ( paymentRequest ) ;
86
86
} catch ( error ) {
87
87
expect ( error instanceof HttpClientException ) . toBeTruthy ( ) ;
88
88
if ( error instanceof HttpClientException && error . responseBody && error . stack ) {
@@ -112,7 +112,7 @@ describe("Classic Integration", (): void => {
112
112
"merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
113
113
} ;
114
114
115
- const paymentResult : payment . PaymentResult = await classicIntegration . authorise3d ( paymentRequest ) ;
115
+ const paymentResult : payment . PaymentResult = await classicIntegration . PaymentsApi . authorise3d ( paymentRequest ) ;
116
116
expect ( paymentResult . pspReference ) . toEqual ( "JVBXGSDM53RZNN82" ) ;
117
117
} ) ;
118
118
@@ -142,7 +142,7 @@ describe("Classic Integration", (): void => {
142
142
"threeDS2Token" : "— - BINARY DATA - -"
143
143
} ;
144
144
145
- const paymentResult : payment . PaymentResult = await classicIntegration . authorise3ds2 ( paymentRequest ) ;
145
+ const paymentResult : payment . PaymentResult = await classicIntegration . PaymentsApi . authorise3ds2 ( paymentRequest ) ;
146
146
expect ( paymentResult . pspReference ) . toEqual ( "JVBXGSDM53RZNN82" ) ;
147
147
} ) ;
148
148
@@ -156,7 +156,7 @@ describe("Classic Integration", (): void => {
156
156
"pspReference" : "9935272408535455"
157
157
} ;
158
158
159
- const getAuthenticationResultResponse : payment . AuthenticationResultResponse = await classicIntegration . getAuthenticationResult ( getAuthenticationResultrequest ) ;
159
+ const getAuthenticationResultResponse : payment . AuthenticationResultResponse = await classicIntegration . PaymentsApi . getAuthenticationResult ( getAuthenticationResultrequest ) ;
160
160
expect ( getAuthenticationResultResponse ?. threeDS2Result ?. authenticationValue ) . toEqual ( "THREEDS2RESULT" ) ;
161
161
} ) ;
162
162
@@ -169,7 +169,7 @@ describe("Classic Integration", (): void => {
169
169
"pspReference" : "9935272408535455"
170
170
} ;
171
171
172
- const retrieve3ds2ResultResponse : payment . ThreeDS2ResultResponse = await classicIntegration . retrieve3ds2Result ( retrieve3ds2ResultRequest ) ;
172
+ const retrieve3ds2ResultResponse : payment . ThreeDS2ResultResponse = await classicIntegration . PaymentsApi . retrieve3ds2Result ( retrieve3ds2ResultRequest ) ;
173
173
expect ( retrieve3ds2ResultResponse ?. threeDS2Result ?. authenticationValue ) . toEqual ( "THREEDS2RESULT" ) ;
174
174
} ) ;
175
175
@@ -190,7 +190,7 @@ describe("Classic Integration", (): void => {
190
190
"merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
191
191
} ;
192
192
193
- const modificationResult : payment . ModificationResult = await classicIntegration . capture ( modificationRequest ) ;
193
+ const modificationResult : payment . ModificationResult = await classicIntegration . ModificationsApi . capture ( modificationRequest ) ;
194
194
expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . CaptureReceived ) ;
195
195
} ) ;
196
196
@@ -207,7 +207,7 @@ describe("Classic Integration", (): void => {
207
207
"merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
208
208
} ;
209
209
210
- const modificationResult : payment . ModificationResult = await classicIntegration . cancel ( modificationRequest ) ;
210
+ const modificationResult : payment . ModificationResult = await classicIntegration . ModificationsApi . cancel ( modificationRequest ) ;
211
211
expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . CancelReceived ) ;
212
212
} ) ;
213
213
@@ -228,7 +228,7 @@ describe("Classic Integration", (): void => {
228
228
"merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
229
229
} ;
230
230
231
- const modificationResult : payment . ModificationResult = await classicIntegration . refund ( modificationRequest ) ;
231
+ const modificationResult : payment . ModificationResult = await classicIntegration . ModificationsApi . refund ( modificationRequest ) ;
232
232
expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . RefundReceived ) ;
233
233
} ) ;
234
234
@@ -245,7 +245,7 @@ describe("Classic Integration", (): void => {
245
245
"merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
246
246
} ;
247
247
248
- const modificationResult : payment . ModificationResult = await classicIntegration . cancelOrRefund ( modificationRequest ) ;
248
+ const modificationResult : payment . ModificationResult = await classicIntegration . ModificationsApi . cancelOrRefund ( modificationRequest ) ;
249
249
expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . CancelOrRefundReceived ) ;
250
250
} ) ;
251
251
@@ -266,7 +266,7 @@ describe("Classic Integration", (): void => {
266
266
"merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
267
267
} ;
268
268
269
- const modificationResult : payment . ModificationResult = await classicIntegration . technicalCancel ( modificationRequest ) ;
269
+ const modificationResult : payment . ModificationResult = await classicIntegration . ModificationsApi . technicalCancel ( modificationRequest ) ;
270
270
expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . TechnicalCancelReceived ) ;
271
271
} ) ;
272
272
@@ -287,7 +287,7 @@ describe("Classic Integration", (): void => {
287
287
"merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
288
288
} ;
289
289
290
- const modificationResult : payment . ModificationResult = await classicIntegration . adjustAuthorisation ( modificationRequest ) ;
290
+ const modificationResult : payment . ModificationResult = await classicIntegration . ModificationsApi . adjustAuthorisation ( modificationRequest ) ;
291
291
expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . AdjustAuthorisationReceived ) ;
292
292
} ) ;
293
293
@@ -309,7 +309,7 @@ describe("Classic Integration", (): void => {
309
309
"merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
310
310
} ;
311
311
312
- const modificationResult : payment . ModificationResult = await classicIntegration . donate ( modificationRequest ) ;
312
+ const modificationResult : payment . ModificationResult = await classicIntegration . ModificationsApi . donate ( modificationRequest ) ;
313
313
expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . DonationReceived ) ;
314
314
} ) ;
315
315
@@ -326,7 +326,7 @@ describe("Classic Integration", (): void => {
326
326
"uniqueTerminalId" : "VX820-123456789"
327
327
} ;
328
328
329
- const modificationResult : payment . ModificationResult = await classicIntegration . voidPendingRefund ( modificationRequest ) ;
329
+ const modificationResult : payment . ModificationResult = await classicIntegration . ModificationsApi . voidPendingRefund ( modificationRequest ) ;
330
330
expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . VoidPendingRefundReceived ) ;
331
331
} ) ;
332
332
} ) ;
0 commit comments