@@ -513,4 +513,52 @@ public void testScoreNotificationRequest() {
513513 assertEquals ("ChargebackCardholderDispute" , data .getScoreSignalsTriggered ().get (0 ));
514514 assertEquals ("ChargebackNonReceipt" , data .getScoreSignalsTriggered ().get (1 ));
515515 }
516+
517+ @ Test
518+ public void testMandateCreatedNotificationRequest () {
519+ String json =
520+ getFileContents ("mocks/balancePlatform-webhooks/configuration-mandate-created.json" );
521+
522+ ConfigurationWebhooksHandler handler = new ConfigurationWebhooksHandler (json );
523+ Optional <MandateNotificationRequest > optionalRequest = handler .getMandateNotificationRequest ();
524+
525+ assertTrue (optionalRequest .isPresent ());
526+
527+ MandateNotificationRequest request = optionalRequest .get ();
528+ assertEquals (
529+ MandateNotificationRequest .TypeEnum .BALANCEPLATFORM_MANDATE_CREATED , request .getType ());
530+ assertEquals ("test" , request .getEnvironment ());
531+ assertNotNull (request .getTimestamp ());
532+
533+ assertNotNull (request .getData ());
534+ assertEquals ("YOUR_BALANCE_PLATFORM" , request .getData ().getBalancePlatform ());
535+
536+ assertNotNull (request .getData ().getMandate ());
537+ assertEquals ("MNDT000000000000000000000001" , request .getData ().getMandate ().getId ());
538+ assertEquals (
539+ "BA000000000000000000000001" , request .getData ().getMandate ().getBalanceAccountId ());
540+ assertEquals (
541+ "PI000000000000000000000001" , request .getData ().getMandate ().getPaymentInstrumentId ());
542+ assertEquals (Mandate .StatusEnum .APPROVED , request .getData ().getMandate ().getStatus ());
543+ assertEquals (Mandate .TypeEnum .BACS , request .getData ().getMandate ().getType ());
544+
545+ assertNotNull (request .getData ().getMandate ().getCounterparty ());
546+ assertNotNull (request .getData ().getMandate ().getCounterparty ().getAccountHolder ());
547+ assertEquals (
548+ "Albert Klassens" ,
549+ request .getData ().getMandate ().getCounterparty ().getAccountHolder ().getFullName ());
550+
551+ assertNotNull (request .getData ().getMandate ().getCounterparty ().getAccountIdentification ());
552+ UKLocalMandateAccountIdentification ukLocalAccountId =
553+ request
554+ .getData ()
555+ .getMandate ()
556+ .getCounterparty ()
557+ .getAccountIdentification ()
558+ .getUKLocalMandateAccountIdentification ();
559+ assertNotNull (ukLocalAccountId );
560+ assertEquals ("10809699" , ukLocalAccountId .getAccountNumber ());
561+ assertEquals ("405081" , ukLocalAccountId .getSortCode ());
562+ assertEquals (UKLocalMandateAccountIdentification .TypeEnum .UKLOCAL , ukLocalAccountId .getType ());
563+ }
516564}
0 commit comments