@@ -2,8 +2,9 @@ import nock from "nock";
22import { createClient } from "../__mocks__/base" ;
33import Client from "../client" ;
44import ClassicIntegration from "../services/paymentApi" ;
5- import { payments } from "../typings" ;
5+ import { payment } from "../typings" ;
66import HttpClientException from "../httpClient/httpClientException" ;
7+ import { PaymentResult } from "../typings/payment/paymentResult" ;
78
89let client : Client ;
910let classicIntegration : ClassicIntegration ;
@@ -35,7 +36,7 @@ describe("Classic Integration", (): void => {
3536 "authCode" : "011381"
3637 }
3738 ) ;
38- const paymentRequest : payments . PaymentRequest = {
39+ const paymentRequest : payment . PaymentRequest = {
3940 "card" : {
4041 "number" : "4111111111111111" ,
4142 "expiryMonth" : "03" ,
@@ -51,7 +52,7 @@ describe("Classic Integration", (): void => {
5152 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
5253 } ;
5354
54- const paymentResult : payments . PaymentResult = await classicIntegration . authorise ( paymentRequest ) ;
55+ const paymentResult : PaymentResult = await classicIntegration . authorise ( paymentRequest ) ;
5556 expect ( paymentResult . pspReference ) . toEqual ( "JVBXGSDM53RZNN82" ) ;
5657 } ) ;
5758
@@ -65,7 +66,7 @@ describe("Classic Integration", (): void => {
6566 "errorType" : "security"
6667 }
6768 ) ;
68- const paymentRequest : payments . PaymentRequest = {
69+ const paymentRequest : payment . PaymentRequest = {
6970 "card" : {
7071 "number" : "4111111111111111" ,
7172 "expiryMonth" : "03" ,
@@ -104,14 +105,14 @@ describe("Classic Integration", (): void => {
104105 "authCode" : "011381"
105106 }
106107 ) ;
107- const paymentRequest : payments . PaymentRequest3d = {
108+ const paymentRequest : payment . PaymentRequest3d = {
108109 "md" : "31h..........vOXek7w" ,
109110 "paResponse" : "eNqtmF........wGVA4Ch" ,
110111 "shopperIP" : "61.294.12.12" ,
111112 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
112113 } ;
113114
114- const paymentResult : payments . PaymentResult = await classicIntegration . authorise3d ( paymentRequest ) ;
115+ const paymentResult : payment . PaymentResult = await classicIntegration . authorise3d ( paymentRequest ) ;
115116 expect ( paymentResult . pspReference ) . toEqual ( "JVBXGSDM53RZNN82" ) ;
116117 } ) ;
117118
@@ -127,7 +128,7 @@ describe("Classic Integration", (): void => {
127128 "authCode" : "011381"
128129 }
129130 ) ;
130- const paymentRequest : payments . PaymentRequest3ds2 = {
131+ const paymentRequest : payment . PaymentRequest3ds2 = {
131132 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT" ,
132133 "amount" : {
133134 "value" : 1500 ,
@@ -141,7 +142,7 @@ describe("Classic Integration", (): void => {
141142 "threeDS2Token" : "— - BINARY DATA - -"
142143 } ;
143144
144- const paymentResult : payments . PaymentResult = await classicIntegration . authorise3ds2 ( paymentRequest ) ;
145+ const paymentResult : payment . PaymentResult = await classicIntegration . authorise3ds2 ( paymentRequest ) ;
145146 expect ( paymentResult . pspReference ) . toEqual ( "JVBXGSDM53RZNN82" ) ;
146147 } ) ;
147148
@@ -150,25 +151,25 @@ describe("Classic Integration", (): void => {
150151 "threeDS2Result" : { "authenticationValue" : "THREEDS2RESULT" }
151152 } ) ;
152153
153- const getAuthenticationResultrequest : payments . AuthenticationResultRequest = {
154+ const getAuthenticationResultrequest : payment . AuthenticationResultRequest = {
154155 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT" ,
155156 "pspReference" : "9935272408535455"
156157 } ;
157158
158- const getAuthenticationResultResponse : payments . AuthenticationResultResponse = await classicIntegration . getAuthenticationResult ( getAuthenticationResultrequest ) ;
159+ const getAuthenticationResultResponse : payment . AuthenticationResultResponse = await classicIntegration . getAuthenticationResult ( getAuthenticationResultrequest ) ;
159160 expect ( getAuthenticationResultResponse ?. threeDS2Result ?. authenticationValue ) . toEqual ( "THREEDS2RESULT" ) ;
160161 } ) ;
161162
162163 test ( "Should retrieve 3DS2 result" , async ( ) : Promise < void > => {
163164 scope . post ( "/retrieve3ds2Result" ) . reply ( 200 , {
164165 "threeDS2Result" : { "authenticationValue" : "THREEDS2RESULT" }
165166 } ) ;
166- const retrieve3ds2ResultRequest : payments . ThreeDS2ResultRequest = {
167+ const retrieve3ds2ResultRequest : payment . ThreeDS2ResultRequest = {
167168 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT" ,
168169 "pspReference" : "9935272408535455"
169170 } ;
170171
171- const retrieve3ds2ResultResponse : payments . ThreeDS2ResultResponse = await classicIntegration . retrieve3ds2Result ( retrieve3ds2ResultRequest ) ;
172+ const retrieve3ds2ResultResponse : payment . ThreeDS2ResultResponse = await classicIntegration . retrieve3ds2Result ( retrieve3ds2ResultRequest ) ;
172173 expect ( retrieve3ds2ResultResponse ?. threeDS2Result ?. authenticationValue ) . toEqual ( "THREEDS2RESULT" ) ;
173174 } ) ;
174175
@@ -179,7 +180,7 @@ describe("Classic Integration", (): void => {
179180 "response" : "[capture-received]"
180181 } ) ;
181182
182- const modificationRequest : payments . CaptureRequest = {
183+ const modificationRequest : payment . CaptureRequest = {
183184 "originalReference" : "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE" ,
184185 "modificationAmount" : {
185186 "value" : 500 ,
@@ -189,8 +190,8 @@ describe("Classic Integration", (): void => {
189190 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
190191 } ;
191192
192- const modificationResult : payments . ModificationResult = await classicIntegration . capture ( modificationRequest ) ;
193- expect ( modificationResult . response ) . toEqual ( payments . ModificationResult . ResponseEnum . CaptureReceived ) ;
193+ const modificationResult : payment . ModificationResult = await classicIntegration . capture ( modificationRequest ) ;
194+ expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . CaptureReceived ) ;
194195 } ) ;
195196
196197 test ( "Should successfully send Cancel request" , async ( ) : Promise < void > => {
@@ -200,14 +201,14 @@ describe("Classic Integration", (): void => {
200201 "response" : "[cancel-received]"
201202 } ) ;
202203
203- const modificationRequest : payments . CancelRequest = {
204+ const modificationRequest : payment . CancelRequest = {
204205 "originalReference" : "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE" ,
205206 "reference" : "YourModificationReference" ,
206207 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
207208 } ;
208209
209- const modificationResult : payments . ModificationResult = await classicIntegration . cancel ( modificationRequest ) ;
210- expect ( modificationResult . response ) . toEqual ( payments . ModificationResult . ResponseEnum . CancelReceived ) ;
210+ const modificationResult : payment . ModificationResult = await classicIntegration . cancel ( modificationRequest ) ;
211+ expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . CancelReceived ) ;
211212 } ) ;
212213
213214 test ( "Should successfully send Refund request" , async ( ) : Promise < void > => {
@@ -217,7 +218,7 @@ describe("Classic Integration", (): void => {
217218 "response" : "[refund-received]"
218219 } ) ;
219220
220- const modificationRequest : payments . RefundRequest = {
221+ const modificationRequest : payment . RefundRequest = {
221222 "originalReference" : "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE" ,
222223 "modificationAmount" : {
223224 "value" : 500 ,
@@ -227,8 +228,8 @@ describe("Classic Integration", (): void => {
227228 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
228229 } ;
229230
230- const modificationResult : payments . ModificationResult = await classicIntegration . refund ( modificationRequest ) ;
231- expect ( modificationResult . response ) . toEqual ( payments . ModificationResult . ResponseEnum . RefundReceived ) ;
231+ const modificationResult : payment . ModificationResult = await classicIntegration . refund ( modificationRequest ) ;
232+ expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . RefundReceived ) ;
232233 } ) ;
233234
234235 test ( "Should successfully send CancelOrRefund request" , async ( ) : Promise < void > => {
@@ -238,14 +239,14 @@ describe("Classic Integration", (): void => {
238239 "response" : "[cancelOrRefund-received]"
239240 } ) ;
240241
241- const modificationRequest : payments . CancelOrRefundRequest = {
242+ const modificationRequest : payment . CancelOrRefundRequest = {
242243 "originalReference" : "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE" ,
243244 "reference" : "YourModificationReference" ,
244245 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
245246 } ;
246247
247- const modificationResult : payments . ModificationResult = await classicIntegration . cancelOrRefund ( modificationRequest ) ;
248- expect ( modificationResult . response ) . toEqual ( payments . ModificationResult . ResponseEnum . CancelOrRefundReceived ) ;
248+ const modificationResult : payment . ModificationResult = await classicIntegration . cancelOrRefund ( modificationRequest ) ;
249+ expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . CancelOrRefundReceived ) ;
249250 } ) ;
250251
251252 test ( "Should successfully send TechnicalCancel request" , async ( ) : Promise < void > => {
@@ -255,7 +256,7 @@ describe("Classic Integration", (): void => {
255256 "response" : "[technical-cancel-received]"
256257 } ) ;
257258
258- const modificationRequest : payments . TechnicalCancelRequest = {
259+ const modificationRequest : payment . TechnicalCancelRequest = {
259260 "originalMerchantReference" : "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE" ,
260261 "modificationAmount" : {
261262 "value" : 500 ,
@@ -265,8 +266,8 @@ describe("Classic Integration", (): void => {
265266 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
266267 } ;
267268
268- const modificationResult : payments . ModificationResult = await classicIntegration . technicalCancel ( modificationRequest ) ;
269- expect ( modificationResult . response ) . toEqual ( payments . ModificationResult . ResponseEnum . TechnicalCancelReceived ) ;
269+ const modificationResult : payment . ModificationResult = await classicIntegration . technicalCancel ( modificationRequest ) ;
270+ expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . TechnicalCancelReceived ) ;
270271 } ) ;
271272
272273 test ( "Should successfully send AdjustAuthorisation request" , async ( ) : Promise < void > => {
@@ -276,7 +277,7 @@ describe("Classic Integration", (): void => {
276277 "response" : "[adjustAuthorisation-received]"
277278 } ) ;
278279
279- const modificationRequest : payments . AdjustAuthorisationRequest = {
280+ const modificationRequest : payment . AdjustAuthorisationRequest = {
280281 "originalReference" : "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE" ,
281282 "modificationAmount" : {
282283 "value" : 500 ,
@@ -286,8 +287,8 @@ describe("Classic Integration", (): void => {
286287 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
287288 } ;
288289
289- const modificationResult : payments . ModificationResult = await classicIntegration . adjustAuthorisation ( modificationRequest ) ;
290- expect ( modificationResult . response ) . toEqual ( payments . ModificationResult . ResponseEnum . AdjustAuthorisationReceived ) ;
290+ const modificationResult : payment . ModificationResult = await classicIntegration . adjustAuthorisation ( modificationRequest ) ;
291+ expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . AdjustAuthorisationReceived ) ;
291292 } ) ;
292293
293294 test ( "Should successfully send Donate request" , async ( ) : Promise < void > => {
@@ -297,7 +298,7 @@ describe("Classic Integration", (): void => {
297298 "response" : "[donation-received]"
298299 } ) ;
299300
300- const modificationRequest : payments . DonationRequest = {
301+ const modificationRequest : payment . DonationRequest = {
301302 "originalReference" : "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE" ,
302303 "modificationAmount" : {
303304 "value" : 500 ,
@@ -308,8 +309,8 @@ describe("Classic Integration", (): void => {
308309 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT"
309310 } ;
310311
311- const modificationResult : payments . ModificationResult = await classicIntegration . donate ( modificationRequest ) ;
312- expect ( modificationResult . response ) . toEqual ( payments . ModificationResult . ResponseEnum . DonationReceived ) ;
312+ const modificationResult : payment . ModificationResult = await classicIntegration . donate ( modificationRequest ) ;
313+ expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . DonationReceived ) ;
313314 } ) ;
314315
315316 test ( "Should successfully send VoidPendingRefund request" , async ( ) : Promise < void > => {
@@ -319,13 +320,13 @@ describe("Classic Integration", (): void => {
319320 "response" : "[voidPendingRefund-received]"
320321 } ) ;
321322
322- const modificationRequest : payments . VoidPendingRefundRequest = {
323+ const modificationRequest : payment . VoidPendingRefundRequest = {
323324 "merchantAccount" : "YOUR_MERCHANT_ACCOUNT" ,
324325 "tenderReference" : "5Iw8001176969533005" ,
325326 "uniqueTerminalId" : "VX820-123456789"
326327 } ;
327328
328- const modificationResult : payments . ModificationResult = await classicIntegration . voidPendingRefund ( modificationRequest ) ;
329- expect ( modificationResult . response ) . toEqual ( payments . ModificationResult . ResponseEnum . VoidPendingRefundReceived ) ;
329+ const modificationResult : payment . ModificationResult = await classicIntegration . voidPendingRefund ( modificationRequest ) ;
330+ expect ( modificationResult . response ) . toEqual ( payment . ModificationResult . ResponseEnum . VoidPendingRefundReceived ) ;
330331 } ) ;
331332} ) ;
0 commit comments