@@ -20,38 +20,12 @@ export class PredefinedContentHelper {
20
20
getEvent ( ) : DisplayNotificationEvent | null {
21
21
const event = this . params . get ( "event" ) ;
22
22
23
- switch ( event ) {
24
- case "TENDER_CREATED" :
25
- case "CARD_INSERTED" :
26
- case "CARD_PRESENTED" :
27
- case "CARD_SWIPED" :
28
- case "WAIT_FOR_APP_SELECTION" :
29
- case "APPLICATION_SELECTED" :
30
- case "ASK_SIGNATURE" :
31
- case "CHECK_SIGNATURE" :
32
- case "SIGNATURE_CHECKED" :
33
- case "WAIT_FOR_PIN" :
34
- case "PIN_ENTERED" :
35
- case "PRINT_RECEIPT" :
36
- case "RECEIPT_PRINTED" :
37
- case "CARD_REMOVED" :
38
- case "TENDER_FINAL" :
39
- case "ASK_DCC" :
40
- case "DCC_ACCEPTED" :
41
- case "DCC_REJECTED" :
42
- case "ASK_GRATUITY" :
43
- case "GRATUITY_ENTERED" :
44
- case "BALANCE_QUERY_STARTED" :
45
- case "BALANCE_QUERY_COMPLETED" :
46
- case "LOAD_STARTED" :
47
- case "LOAD_COMPLETED" :
48
- case "PROVIDE_CARD_DETAILS" :
49
- case "CARD_DETAILS_PROVIDED" :
50
- return event as DisplayNotificationEvent ;
51
- default :
52
- return null ;
23
+ if ( event && Object . values ( DisplayNotificationEvent ) . includes ( event as DisplayNotificationEvent ) ) {
24
+ return event as DisplayNotificationEvent ;
53
25
}
26
+ return null ;
54
27
}
28
+
55
29
getTransactionId ( ) : string | null {
56
30
return this . params . get ( "TransactionID" ) ;
57
31
}
@@ -65,14 +39,11 @@ export class PredefinedContentHelper {
65
39
}
66
40
67
41
toObject ( ) : Record < string , string > {
68
- const result : Record < string , string > = { } ;
69
- for ( const [ key , value ] of this . params . entries ( ) ) {
70
- result [ key ] = value ;
71
- }
72
- return result ;
42
+ return Object . fromEntries ( this . params ) ;
73
43
}
74
44
}
75
45
46
+ // Supported events for display notifications
76
47
export enum DisplayNotificationEvent {
77
48
TENDER_CREATED = "TENDER_CREATED" ,
78
49
CARD_INSERTED = "CARD_INSERTED" ,
0 commit comments