@@ -20,6 +20,7 @@ import {TransferNotificationRequest} from "../typings/transferWebhooks/transferN
2020import { PaymentMethodRequestRemovedNotificationRequest } from "../typings/managementWebhooks/paymentMethodRequestRemovedNotificationRequest" ;
2121import { PaymentMethodScheduledForRemovalNotificationRequest } from "../typings/managementWebhooks/paymentMethodScheduledForRemovalNotificationRequest" ;
2222import { TransactionNotificationRequestV4 } from "../typings/transactionWebhooks/transactionNotificationRequestV4" ;
23+ import { NegativeBalanceCompensationWarningNotificationRequest } from "../typings/negativeBalanceWarningWebhooks/negativeBalanceCompensationWarningNotificationRequest" ;
2324
2425describe ( "Notification Test" , function ( ) : void {
2526
@@ -272,4 +273,42 @@ describe("Notification Test", function (): void {
272273 expect ( genericWebhook instanceof PaymentMethodScheduledForRemovalNotificationRequest ) . toBe ( false ) ;
273274 expect ( transactionCreated . type ) . toEqual ( TransactionNotificationRequestV4 . TypeEnum . BalancePlatformTransactionCreated ) ;
274275 } ) ;
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+ } ) ;
275314} ) ;
0 commit comments