@@ -66,6 +66,14 @@ Task<RestApiResponse<MerchantPageResponse>> GetChildMerchantsAsync(string userAc
6666    Task < RestApiResponse < RoleUser > >  GetRoleUserAssignmentAsync ( string  userAccessToken ,  Guid  roleUserID ) ; 
6767
6868    Task < RestApiResponse >  AuthoriseRoleUserAssignmentAsync ( string  strongUserAccessToken ,  Guid  roleUserID ) ; 
69+     
70+     Task < RestApiResponse < MerchantPageResponse > >  GetMerchantsAsync ( string  userAccessToken , 
71+         int  pageNumber  =  1 , 
72+         int  pageSize  =  20 , 
73+         string ?  search  =  null , 
74+         string ?  sort  =  null ) ; 
75+ 
76+     Task < RestApiResponse >  SetParentMerchantAsync ( string  userAccessToken ,  Guid  merchantId ,  Guid  parentMerchantId ) ; 
6977} 
7078
7179public  class  MerchantClient  :  IMerchantClient 
@@ -447,4 +455,57 @@ public Task<RestApiResponse> AuthoriseRoleUserAssignmentAsync(string strongUserA
447455            _ =>  Task . FromResult ( new  RestApiResponse ( HttpStatusCode . PreconditionFailed ,  new  Uri ( url ) ,  prob ) ) 
448456        } ; 
449457    } 
458+ 
459+     /// <summary> 
460+     /// Calls the MoneyMoov merchant endpoint to get a paged list of merchants. 
461+     /// </summary> 
462+     /// <param name="userAccessToken">A user scoped JWT access token.</param> 
463+     /// <param name="pageNumber">The page number of the result set to retrieve.</param> 
464+     /// <param name="pageSize">The number of records to return per page.</param> 
465+     /// <param name="search">A search filter to apply to the child merchant list. Typically searches against merchant name or ID.</param> 
466+     /// <param name="sort">The sort expression for the result set, e.g., "Name asc".</param> 
467+     /// <returns>A paged response containing a list of child merchants if successful.</returns> 
468+     public  Task < RestApiResponse < MerchantPageResponse > >  GetMerchantsAsync ( string  userAccessToken ,  
469+         int  pageNumber  =  1 ,  
470+         int  pageSize  =  Int32 . MaxValue ,  
471+         string ?  search  =  null , 
472+         string ?  sort  =  null ) 
473+     { 
474+         var  url  =  MoneyMoovUrlBuilder . MerchantsApi . MerchantsPagedUrl ( _apiClient . GetBaseUri ( ) . ToString ( ) ,  
475+             pageNumber , 
476+             pageSize , 
477+             search , 
478+             sort ) ; 
479+         
480+         var  prob  =  _apiClient . CheckAccessToken ( userAccessToken ,  nameof ( GetMerchantsAsync ) ) ; 
481+         
482+         return  prob  switch 
483+         { 
484+             var  p  when  p . IsEmpty  =>  _apiClient . GetAsync < MerchantPageResponse > ( url ,  userAccessToken ) , 
485+             _ =>  Task . FromResult ( new  RestApiResponse < MerchantPageResponse > ( HttpStatusCode . PreconditionFailed ,  new  Uri ( url ) ,  prob ) ) 
486+         } ; 
487+     } 
488+ 
489+     /// <summary> 
490+     /// Sets the parent merchant for a merchant. 
491+     /// This will make the merchant a child merchant of the specified parent merchant. 
492+     /// </summary> 
493+     /// <param name="userAccessToken">A user scoped JWT access token.</param> 
494+     /// <param name="merchantId">The id of the merchant to set the parent for. </param> 
495+     /// <param name="parentMerchantId">The parent merchant id</param> 
496+     /// <returns></returns> 
497+     public  Task < RestApiResponse >  SetParentMerchantAsync ( string  userAccessToken ,  Guid  merchantId ,  Guid  parentMerchantId ) 
498+     { 
499+         var  url  =  MoneyMoovUrlBuilder . MerchantsApi . SetParentMerchantUrl ( _apiClient . GetBaseUri ( ) . ToString ( ) ,  
500+             merchantId , 
501+             parentMerchantId ) ; 
502+         
503+         var  prob  =  _apiClient . CheckAccessToken ( userAccessToken ,  nameof ( GetMerchantsAsync ) ) ; 
504+         
505+         return  prob  switch 
506+         { 
507+             var  p  when  p . IsEmpty  =>  _apiClient . PutAsync ( url ,  userAccessToken ) , 
508+             _ =>  Task . FromResult ( new  RestApiResponse ( HttpStatusCode . PreconditionFailed ,  new  Uri ( url ) ,  prob ) ) 
509+         } ; 
510+     } 
450511} 
0 commit comments