@@ -5058,18 +5058,52 @@ public static void GetWalletByWalletId(string walletId, Action<LootLockerGetWall
50585058 /// <summary>
50595059 /// Get information about a wallet for a specified holder
50605060 /// </summary>
5061- /// <param name="holderId">Ulid of the holder of the wallet you want to get information for</param>
5061+ /// <param name="holderUlid">ULID of the holder of the wallet you want to get information for</param>
5062+ /// <param name="holderType">The type of the holder to get the wallet for</param>
50625063 /// <param name="onComplete">onComplete Action for handling the response</param>
5063- public static void GetWalletByHolderId ( string holderId , Action < LootLockerGetWalletResponse > onComplete )
5064+ public static void GetWalletByHolderId ( string holderUlid , LootLockerWalletHolderTypes holderType , Action < LootLockerGetWalletResponse > onComplete )
50645065 {
50655066 if ( ! CheckInitialized ( ) )
50665067 {
50675068 onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerGetWalletResponse > ( ) ) ;
50685069 return ;
50695070 }
5070- var endpoint = string . Format ( LootLockerEndPoints . getWalletByHolderId . endPoint , holderId ) ;
5071+ var endpoint = string . Format ( LootLockerEndPoints . getWalletByHolderId . endPoint , holderUlid ) ;
50715072
5072- LootLockerServerRequest . CallAPI ( endpoint , LootLockerEndPoints . getWalletByHolderId . httpMethod , onComplete : ( serverResponse ) => { LootLockerResponse . Deserialize ( onComplete , serverResponse ) ; } ) ;
5073+ LootLockerServerRequest . CallAPI ( endpoint , LootLockerEndPoints . getWalletByHolderId . httpMethod , onComplete :
5074+ ( serverResponse ) =>
5075+ {
5076+ var parsedResponse = LootLockerResponse . Deserialize < LootLockerGetWalletResponse > ( serverResponse ) ;
5077+ if ( ! parsedResponse . success && parsedResponse . statusCode == 404 )
5078+ {
5079+ LootLockerCreateWalletRequest request = new LootLockerCreateWalletRequest ( )
5080+ {
5081+ holder_id = holderUlid ,
5082+ holder_type = holderType
5083+ } ;
5084+ LootLockerServerRequest . CallAPI ( LootLockerEndPoints . createWallet . endPoint ,
5085+ LootLockerEndPoints . createWallet . httpMethod , LootLockerJson . SerializeObject ( request ) ,
5086+ createWalletResponse =>
5087+ {
5088+ if ( createWalletResponse . success )
5089+ {
5090+ LootLockerServerRequest . CallAPI ( endpoint ,
5091+ LootLockerEndPoints . getWalletByHolderId . httpMethod , null ,
5092+ secondResponse =>
5093+ {
5094+ LootLockerResponse . Deserialize ( onComplete , secondResponse ) ;
5095+ } ) ;
5096+ return ;
5097+ }
5098+
5099+ onComplete ? . Invoke ( parsedResponse ) ;
5100+ } ) ;
5101+ return ;
5102+ }
5103+
5104+ onComplete ? . Invoke ( parsedResponse ) ;
5105+ }
5106+ ) ;
50735107 }
50745108
50755109 /// <summary>
0 commit comments