@@ -20,6 +20,7 @@ import {TransferNotificationRequest} from "../typings/transferWebhooks/transferN
20
20
import { PaymentMethodRequestRemovedNotificationRequest } from "../typings/managementWebhooks/paymentMethodRequestRemovedNotificationRequest" ;
21
21
import { PaymentMethodScheduledForRemovalNotificationRequest } from "../typings/managementWebhooks/paymentMethodScheduledForRemovalNotificationRequest" ;
22
22
import { TransactionNotificationRequestV4 } from "../typings/transactionWebhooks/transactionNotificationRequestV4" ;
23
+ import { NegativeBalanceCompensationWarningNotificationRequest } from "../typings/negativeBalanceWarningWebhooks/negativeBalanceCompensationWarningNotificationRequest" ;
23
24
24
25
describe ( "Notification Test" , function ( ) : void {
25
26
@@ -272,4 +273,42 @@ describe("Notification Test", function (): void {
272
273
expect ( genericWebhook instanceof PaymentMethodScheduledForRemovalNotificationRequest ) . toBe ( false ) ;
273
274
expect ( transactionCreated . type ) . toEqual ( TransactionNotificationRequestV4 . TypeEnum . BalancePlatformTransactionCreated ) ;
274
275
} ) ;
276
+
277
+ it ( "should deserialize NegativeBalanceCompensationWarning Webhook" , function ( ) : void {
278
+ const json = {
279
+ "data" : {
280
+ "balancePlatform" : "YOUR_BALANCE_PLATFORM" ,
281
+ "creationDate" : "2024-07-02T02:01:08+02:00" ,
282
+ "id" : "BA00000000000000000001" ,
283
+ "accountHolder" : {
284
+ "description" : "Description for the account holder." ,
285
+ "reference" : "YOUR_REFERENCE" ,
286
+ "id" : "AH00000000000000000001"
287
+ } ,
288
+ "amount" : {
289
+ "currency" : "EUR" ,
290
+ "value" : - 145050
291
+ } ,
292
+ "liableBalanceAccountId" : "BA11111111111111111111" ,
293
+ "negativeBalanceSince" : "2024-10-19T00:33:13+02:00" ,
294
+ "scheduledCompensationAt" : "2024-12-01T01:00:00+01:00"
295
+ } ,
296
+ "environment" : "test" ,
297
+ "timestamp" : "2024-10-22T00:00:00+02:00" ,
298
+ "type" : "balancePlatform.negativeBalanceCompensationWarning.scheduled"
299
+ } ;
300
+ const jsonString = JSON . stringify ( json ) ;
301
+ const bankingWebhookHandler = new BankingWebhookHandler ( jsonString ) ;
302
+ const negativeBalanceCompensationWarningNotificationRequest = bankingWebhookHandler . getNegativeBalanceCompensationWarningNotificationRequest ( ) ;
303
+ expect ( negativeBalanceCompensationWarningNotificationRequest ) . toBeTruthy ( ) ;
304
+ expect ( negativeBalanceCompensationWarningNotificationRequest . type ) . toBe ( NegativeBalanceCompensationWarningNotificationRequest
305
+ . TypeEnum . BalancePlatformNegativeBalanceCompensationWarningScheduled
306
+ ) ;
307
+ expect ( negativeBalanceCompensationWarningNotificationRequest . environment ) . toBe ( "test" ) ;
308
+ expect ( negativeBalanceCompensationWarningNotificationRequest . timestamp ?. toISOString ( ) ) . toBe ( new Date ( "2024-10-22T00:00:00+02:00" ) . toISOString ( ) ) ;
309
+ expect ( negativeBalanceCompensationWarningNotificationRequest . data ) . toBeDefined ( ) ;
310
+ expect ( negativeBalanceCompensationWarningNotificationRequest . data . balancePlatform ) . toBe ( "YOUR_BALANCE_PLATFORM" ) ;
311
+ expect ( negativeBalanceCompensationWarningNotificationRequest . data . id ) . toBe ( "BA00000000000000000001" ) ;
312
+ expect ( negativeBalanceCompensationWarningNotificationRequest . data . creationDate ?. toISOString ( ) ) . toBe ( new Date ( "2024-07-02T02:01:08+02:00" ) . toISOString ( ) ) ;
313
+ } ) ;
275
314
} ) ;
0 commit comments