@@ -83,7 +83,8 @@ public void itShouldCreateASweepingMandateWithSignupPlusIntention() {
8383 ProviderSelection .preselected ().providerId (PROVIDER_ID ).build (),
8484 RelatedProducts .builder ()
8585 .signupPlus (Collections .emptyMap ())
86- .build ()))
86+ .build (),
87+ null ))
8788 .get ();
8889
8990 assertNotError (createMandateResponse );
@@ -309,15 +310,15 @@ public void itShouldCreateAndRevokeAMandate(String mandatesScope, Mandate.Type m
309310 @ ParameterizedTest (name = "with retry {0}" )
310311 @ MethodSource ("provideItShouldCreateAPaymentOnMandateTestParameters" )
311312 @ SneakyThrows
312- public void itShouldCreateAPaymentOnMandate (String mandatesScope , Mandate .Type mandateType , Retry retry ) {
313+ public void itShouldCreateAPaymentOnMandate (String mandatesScope , Mandate .Type mandateType , Retry retry , UseCase useCase , UserInteraction userInteraction ) {
313314 // create client with required scopes
314315 var tlClient = buildMandatesTlClient (mandatesScope );
315316
316317 // create mandate
317318 ProviderSelection preselectedProvider =
318319 ProviderSelection .preselected ().providerId (PROVIDER_ID ).build ();
319320 ApiResponse <CreateMandateResponse > createMandateResponse = tlClient .mandates ()
320- .createMandate (createMandateRequest (mandateType , preselectedProvider ))
321+ .createMandate (createMandateRequest (mandateType , preselectedProvider , null , useCase ))
321322 .get ();
322323 assertNotError (createMandateResponse );
323324
@@ -375,6 +376,10 @@ public void itShouldCreateAPaymentOnMandate(String mandatesScope, Mandate.Type m
375376 mandateBuilder .retry (retry );
376377 }
377378
379+ if (ObjectUtils .isNotEmpty (userInteraction )) {
380+ mandateBuilder .userInteraction (userInteraction );
381+ }
382+
378383 // create a payment on mandate
379384 CreatePaymentRequest createPaymentRequest = CreatePaymentRequest .builder ()
380385 .amountInMinor (getMandateResponse .getData ().getConstraints ().getMaximumIndividualAmount ())
@@ -389,11 +394,11 @@ public void itShouldCreateAPaymentOnMandate(String mandatesScope, Mandate.Type m
389394 }
390395
391396 private CreateMandateRequest createMandateRequest (Mandate .Type type , ProviderSelection providerSelection ) {
392- return createMandateRequest (type , providerSelection , null );
397+ return createMandateRequest (type , providerSelection , null , null );
393398 }
394399
395400 private CreateMandateRequest createMandateRequest (
396- Mandate .Type type , ProviderSelection providerSelection , RelatedProducts relatedProducts ) {
401+ Mandate .Type type , ProviderSelection providerSelection , RelatedProducts relatedProducts , UseCase useCase ) {
397402 Mandate mandate = null ;
398403 if (type .equals (Mandate .Type .COMMERCIAL )) {
399404 mandate = Mandate .vrpCommercialMandate ()
@@ -405,6 +410,7 @@ private CreateMandateRequest createMandateRequest(
405410 .build ())
406411 .accountHolderName ("Andrea Java SDK" )
407412 .build ())
413+ .useCase (useCase )
408414 .build ();
409415 } else {
410416 mandate = Mandate .vrpSweepingMandate ()
@@ -542,30 +548,47 @@ private static TrueLayerClient buildMandatesTlClient(String mandatesScope) {
542548
543549 private static Stream <Arguments > provideItShouldCreateAPaymentOnMandateTestParameters () {
544550 return Stream .of (
545- Arguments .of (RECURRING_PAYMENTS_SWEEPING , SWEEPING , null ),
546- Arguments .of (RECURRING_PAYMENTS_COMMERCIAL , COMMERCIAL , null ),
551+ Arguments .of (RECURRING_PAYMENTS_SWEEPING , SWEEPING , null , null , null ),
552+ Arguments .of (RECURRING_PAYMENTS_COMMERCIAL , COMMERCIAL , null , null , null ),
547553 Arguments .of (
548554 RECURRING_PAYMENTS_SWEEPING ,
549555 SWEEPING ,
550- Retry .standard ().forDuration ("30m" ).build ()),
556+ Retry .standard ().forDuration ("30m" ).build (),
557+ null ,
558+ null ),
551559 Arguments .of (
552560 RECURRING_PAYMENTS_COMMERCIAL ,
553561 COMMERCIAL ,
554- Retry .standard ().forDuration ("30m" ).build ()),
562+ Retry .standard ().forDuration ("30m" ).build (),
563+ null ,
564+ null ),
555565 Arguments .of (
556566 RECURRING_PAYMENTS_SWEEPING ,
557567 SWEEPING ,
558568 Retry .smart ()
559569 .forDuration ("90d" )
560570 .ensureMinimumBalanceInMinor (100 )
561- .build ()),
571+ .build (),
572+ null ,
573+ null ),
574+ Arguments .of (
575+ RECURRING_PAYMENTS_COMMERCIAL ,
576+ COMMERCIAL ,
577+ Retry .smart ()
578+ .forDuration ("90d" )
579+ .ensureMinimumBalanceInMinor (100 )
580+ .build (),
581+ null ,
582+ null ),
562583 Arguments .of (
563584 RECURRING_PAYMENTS_COMMERCIAL ,
564585 COMMERCIAL ,
565586 Retry .smart ()
566587 .forDuration ("90d" )
567588 .ensureMinimumBalanceInMinor (100 )
568- .build ()));
589+ .build (),
590+ UseCase .FINANCIAL_SERVICES ,
591+ UserInteraction .PRESENT ));
569592 }
570593
571594 private static Stream <Arguments > provideMandatesScopesAndTypes () {
0 commit comments