@@ -4,7 +4,10 @@ import captureFalse from "../__mocks__/notification/captureFalse.json";
4
4
import refundTrue from "../__mocks__/notification/refundTrue.json" ;
5
5
import refundFalse from "../__mocks__/notification/refundFalse.json" ;
6
6
import NotificationRequest from "../notification/notificationRequest" ;
7
- import { Notification , NotificationEnum , NotificationRequestItem } from "../typings/notification" ;
7
+ import { Notification , NotificationRequestItem } from "../typings/notification/models" ;
8
+
9
+ import NotificationEnum = NotificationRequestItem . EventCodeEnum ;
10
+ import SuccessEnum = NotificationRequestItem . SuccessEnum ;
8
11
9
12
describe ( "Notification Test" , function ( ) : void {
10
13
it ( "should return authorisation success" , function ( ) : void {
@@ -13,8 +16,8 @@ describe("Notification Test", function (): void {
13
16
14
17
if ( notificationRequest . notificationItems ) {
15
18
const notificationRequestItem : NotificationRequestItem = notificationRequest . notificationItems [ 0 ] ;
16
- expect ( NotificationEnum . EVENT_CODE_AUTHORISATION ) . toEqual ( notificationRequestItem . eventCode ) ;
17
- expect ( notificationRequestItem . success === "true" ) . toBeTruthy ( ) ;
19
+ expect ( NotificationEnum . AUTHORISATION ) . toEqual ( notificationRequestItem . eventCode ) ;
20
+ expect ( notificationRequestItem . success === SuccessEnum . True ) . toBeTruthy ( ) ;
18
21
expect ( notificationRequestItem . pspReference ) . toEqual ( "123456789" ) ;
19
22
} else {
20
23
fail ( ) ;
@@ -27,8 +30,8 @@ describe("Notification Test", function (): void {
27
30
28
31
if ( notificationRequest . notificationItems ) {
29
32
const notificationRequestItem = notificationRequest . notificationItems [ 0 ] ;
30
- expect ( NotificationEnum . EVENT_CODE_CAPTURE ) . toEqual ( notificationRequestItem . eventCode ) ;
31
- expect ( notificationRequestItem . success === "true" ) . toBeTruthy ( ) ;
33
+ expect ( NotificationEnum . CAPTURE ) . toEqual ( notificationRequestItem . eventCode ) ;
34
+ expect ( notificationRequestItem . success === SuccessEnum . True ) . toBeTruthy ( ) ;
32
35
expect ( notificationRequestItem . pspReference ) . toEqual ( "PSP_REFERENCE" ) ;
33
36
expect ( notificationRequestItem . originalReference ) . toEqual ( "ORIGINAL_PSP" ) ;
34
37
} else {
@@ -42,8 +45,8 @@ describe("Notification Test", function (): void {
42
45
43
46
if ( notificationRequest . notificationItems ) {
44
47
const notificationRequestItem = notificationRequest . notificationItems [ 0 ] ;
45
- expect ( NotificationEnum . EVENT_CODE_CAPTURE ) . toEqual ( notificationRequestItem . eventCode ) ;
46
- expect ( notificationRequestItem . success === "true" ) . toBeFalsy ( ) ;
48
+ expect ( NotificationEnum . CAPTURE ) . toEqual ( notificationRequestItem . eventCode ) ;
49
+ expect ( notificationRequestItem . success === SuccessEnum . True ) . toBeFalsy ( ) ;
47
50
expect ( notificationRequestItem . pspReference ) . toEqual ( "PSP_REFERENCE" ) ;
48
51
expect ( notificationRequestItem . originalReference ) . toEqual ( "ORIGINAL_PSP" ) ;
49
52
} else {
@@ -57,8 +60,8 @@ describe("Notification Test", function (): void {
57
60
58
61
if ( notificationRequest . notificationItems ) {
59
62
const notificationRequestItem = notificationRequest . notificationItems [ 0 ] ;
60
- expect ( NotificationEnum . EVENT_CODE_REFUND ) . toEqual ( notificationRequestItem . eventCode ) ;
61
- expect ( notificationRequestItem . success === "true" ) . toBeTruthy ( ) ;
63
+ expect ( NotificationEnum . REFUND ) . toEqual ( notificationRequestItem . eventCode ) ;
64
+ expect ( notificationRequestItem . success === SuccessEnum . True ) . toBeTruthy ( ) ;
62
65
expect ( notificationRequestItem . pspReference ) . toEqual ( "PSP_REFERENCE" ) ;
63
66
expect ( notificationRequestItem . originalReference ) . toEqual ( "ORIGINAL_PSP" ) ;
64
67
expect ( notificationRequestItem . eventDate ) . toBeDefined ( ) ;
@@ -73,8 +76,8 @@ describe("Notification Test", function (): void {
73
76
74
77
if ( notificationRequest . notificationItems ) {
75
78
const notificationRequestItem = notificationRequest . notificationItems [ 0 ] ;
76
- expect ( NotificationEnum . EVENT_CODE_REFUND ) . toEqual ( notificationRequestItem . eventCode ) ;
77
- expect ( notificationRequestItem . success === "true" ) . toBeFalsy ( ) ;
79
+ expect ( NotificationEnum . REFUND ) . toEqual ( notificationRequestItem . eventCode ) ;
80
+ expect ( notificationRequestItem . success === SuccessEnum . True ) . toBeFalsy ( ) ;
78
81
expect ( notificationRequestItem . pspReference ) . toEqual ( "PSP_REFERENCE" ) ;
79
82
expect ( notificationRequestItem . originalReference ) . toEqual ( "ORIGINAL_PSP" ) ;
80
83
expect ( notificationRequestItem . eventDate ) . toBeDefined ( ) ;
0 commit comments