@@ -17,6 +17,9 @@ import { NegativeBalanceWarningWebhooksHandler } from "../../typings/negativeBal
17
17
import { TransactionWebhooksHandler } from "../../typings/transactionWebhooks/transactionWebhooksHandler" ;
18
18
import { BalanceWebhooksHandler } from "../../typings/balanceWebhooks/balanceWebhooksHandler" ;
19
19
import { ReportNotificationRequest } from "../../typings/reportWebhooks/reportNotificationRequest" ;
20
+ import { DisputeWebhooksHandler } from "../../typings/disputeWebhooks/disputeWebhooksHandler" ;
21
+ import { DisputeNotificationRequest } from "../../typings/disputeWebhooks/disputeNotificationRequest" ;
22
+ import { DisputeEventNotification } from "../../typings/disputeWebhooks/disputeEventNotification" ;
20
23
21
24
describe ( "BankingWebhooks Tests" , function ( ) : void {
22
25
@@ -514,4 +517,36 @@ describe("BankingWebhooks Tests", function (): void {
514
517
515
518
} ) ;
516
519
520
+ it ( "should deserialize DisputeWebhooks DisputeNotificationRequest" , function ( ) : void {
521
+ const json = {
522
+ "type" : "balancePlatform.dispute.created" ,
523
+ "data" : {
524
+ "id" : "DS00000000000000000001" ,
525
+ "balancePlatform" : "YOUR_BALANCE_PLATFORM" ,
526
+ "disputedAmount" : {
527
+ "currency" : "EUR" ,
528
+ "value" : 10000
529
+ } ,
530
+ "status" : "open" ,
531
+ "type" : DisputeEventNotification . TypeEnum . NotDelivered ,
532
+
533
+ }
534
+ } ;
535
+ const jsonString = JSON . stringify ( json ) ;
536
+ const disputeWebhooksHandler = new DisputeWebhooksHandler ( jsonString ) ;
537
+ const disputeNotificationRequest : DisputeNotificationRequest = disputeWebhooksHandler . getDisputeNotificationRequest ( ) ;
538
+
539
+ expect ( disputeNotificationRequest ) . toBeTruthy ( ) ;
540
+ expect ( disputeNotificationRequest . type ) . toBe ( "balancePlatform.dispute.created" ) ;
541
+ expect ( disputeNotificationRequest . data ) . toBeDefined ( ) ;
542
+ expect ( disputeNotificationRequest . data . id ) . toBe ( "DS00000000000000000001" ) ;
543
+ expect ( disputeNotificationRequest . data . balancePlatform ) . toBe ( "YOUR_BALANCE_PLATFORM" ) ;
544
+ expect ( disputeNotificationRequest . data . status ) . toBe ( "open" ) ;
545
+ expect ( disputeNotificationRequest . data . type ) . toBe ( DisputeEventNotification . TypeEnum . NotDelivered ) ;
546
+ // test getGenericWebhook
547
+ const genericWebhook = disputeWebhooksHandler . getGenericWebhook ( ) ;
548
+ expect ( genericWebhook instanceof DisputeNotificationRequest ) . toBe ( true ) ;
549
+ expect ( genericWebhook . type ) . toEqual ( "balancePlatform.dispute.created" ) ;
550
+ } ) ;
551
+
517
552
} ) ;
0 commit comments