@@ -62,6 +62,10 @@ Task<RestApiResponse<MerchantPageResponse>> GetChildMerchantsAsync(string userAc
6262 int pageSize = 20 ,
6363 string ? search = null ,
6464 string ? sort = null ) ;
65+
66+ Task < RestApiResponse < RoleUser > > GetRoleUserAssignmentAsync ( string userAccessToken , Guid roleUserID ) ;
67+
68+ Task < RestApiResponse > AuthoriseRoleUserAssignmentAsync ( string strongUserAccessToken , Guid roleUserID ) ;
6569}
6670
6771public class MerchantClient : IMerchantClient
@@ -403,4 +407,44 @@ public Task<RestApiResponse<MerchantPageResponse>> GetChildMerchantsAsync(string
403407 _ => Task . FromResult ( new RestApiResponse < MerchantPageResponse > ( HttpStatusCode . PreconditionFailed , new Uri ( url ) , prob ) )
404408 } ;
405409 }
410+
411+ /// <summary>
412+ /// Gets a specific role user assignment by its ID.
413+ /// </summary>
414+ /// <param name="userAccessToken">A user scoped JWT access token.</param>
415+ /// <param name="roleUserID">The ID of the role user assignment to get.</param>
416+ /// <returns>If successful, the role user assignment.</returns>
417+ public Task < RestApiResponse < RoleUser > > GetRoleUserAssignmentAsync ( string userAccessToken , Guid roleUserID )
418+ {
419+ var url = MoneyMoovUrlBuilder . MerchantsApi . MerchantRoleUserAssignmentsUrl ( _apiClient . GetBaseUri ( ) . ToString ( ) , roleUserID ) ;
420+
421+ var prob = _apiClient . CheckAccessToken ( userAccessToken , nameof ( GetRolesAsync ) ) ;
422+
423+ return prob switch
424+ {
425+ var p when p . IsEmpty => _apiClient . GetAsync < RoleUser > ( url , userAccessToken ) ,
426+ _ => Task . FromResult ( new RestApiResponse < RoleUser > ( HttpStatusCode . PreconditionFailed , new Uri ( url ) , prob ) )
427+ } ;
428+ }
429+
430+ /// <summary>
431+ /// Calls the MoneyMoov merchant endpoint to authorise a role user assignment.
432+ /// </summary>
433+ /// <param name="strongUserAccessToken">The strong user access token acquired to authorise the role suer assignment. Strong
434+ /// tokens can only be acquired from a strong customer authentication flow, are short lived (typically 5 minute expiry)
435+ /// and are specific to the role user assignment.</param>
436+ /// <param name="roleUserID">The ID of the role user assignment to authorise.</param>
437+ /// <returns>An API response indicating the result of the authorise attempt.</returns>
438+ public Task < RestApiResponse > AuthoriseRoleUserAssignmentAsync ( string strongUserAccessToken , Guid roleUserID )
439+ {
440+ var url = MoneyMoovUrlBuilder . MerchantsApi . MerchantRoleUserAssignmentsUrl ( _apiClient . GetBaseUri ( ) . ToString ( ) , roleUserID ) ;
441+
442+ var prob = _apiClient . CheckAccessToken ( strongUserAccessToken , nameof ( AuthoriseRoleUserAssignmentAsync ) ) ;
443+
444+ return prob switch
445+ {
446+ var p when p . IsEmpty => _apiClient . PostAsync ( url , strongUserAccessToken ) ,
447+ _ => Task . FromResult ( new RestApiResponse ( HttpStatusCode . PreconditionFailed , new Uri ( url ) , prob ) )
448+ } ;
449+ }
406450}
0 commit comments