2
2
using System . Collections . Generic ;
3
3
using System . IO ;
4
4
using UnityEngine ;
5
- using System . Security . Cryptography ;
6
5
using System . Text ;
7
6
using LootLocker . LootLockerEnums ;
8
7
using static LootLocker . LootLockerConfig ;
9
8
using System . Linq ;
10
9
using File = System . IO . File ;
11
- using System . Net ;
10
+ using System . Security . Cryptography ;
12
11
#if UNITY_EDITOR
13
12
using UnityEditor ;
14
13
#endif
@@ -4314,21 +4313,21 @@ public static void ActivateRentalAsset(int assetInstanceID, Action<LootLockerAct
4314
4313
/// <summary>
4315
4314
/// Purchase one or more catalog items using a specified wallet
4316
4315
/// </summary>
4317
- /// <param name="walletID ">The id of the wallet to use for the purchase</param>
4316
+ /// <param name="walletId ">The id of the wallet to use for the purchase</param>
4318
4317
/// <param name="itemsToPurchase">A list of items to purchase along with the quantity of each item to purchase</param>
4319
4318
/// <param name="onComplete">onComplete Action for handling the response</param>
4320
- public static void LootLockerPurchaseCatalogItems ( string walletID , LootLockerCatalogItemAndQuantityPair [ ] itemsToPurchase , Action < LootLockerPurchaseCatalogItemResponse > onComplete )
4319
+ public static void LootLockerPurchaseCatalogItems ( string walletId , LootLockerCatalogItemAndQuantityPair [ ] itemsToPurchase , Action < LootLockerPurchaseCatalogItemResponse > onComplete )
4321
4320
{
4322
4321
if ( ! CheckInitialized ( ) )
4323
4322
{
4324
4323
onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerPurchaseCatalogItemResponse > ( ) ) ;
4325
4324
return ;
4326
4325
}
4327
-
4328
- LootLockerPurchaseCatalogItemRequest data = new LootLockerPurchaseCatalogItemRequest ( ) ;
4329
- data . wallet_id = walletID ;
4330
- data . items = itemsToPurchase ;
4331
- var body = LootLockerJson . SerializeObject ( new { data } ) ;
4326
+ var body = LootLockerJson . SerializeObject ( new LootLockerPurchaseCatalogItemRequest
4327
+ {
4328
+ wallet_id = walletId ,
4329
+ items = itemsToPurchase
4330
+ } ) ;
4332
4331
4333
4332
LootLockerServerRequest . CallAPI ( LootLockerEndPoints . purchaseCatalogItem . endPoint , LootLockerEndPoints . purchaseCatalogItem . httpMethod , body , onComplete : ( serverResponse ) => { LootLockerResponse . Deserialize ( onComplete , serverResponse ) ; } ) ;
4334
4333
}
@@ -4991,6 +4990,7 @@ public static void GetRemovedUGCForPlayer(GetRemovedUGCForPlayerInput input, Act
4991
4990
/// <param name="onComplete">onComplete Action for handling the response</param>
4992
4991
public static void ListCurrencies ( Action < LootLockerListCurrenciesResponse > onComplete )
4993
4992
{
4993
+ LootLockerCurrency cur ;
4994
4994
if ( ! CheckInitialized ( ) )
4995
4995
{
4996
4996
onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerListCurrenciesResponse > ( ) ) ;
@@ -5000,40 +5000,22 @@ public static void ListCurrencies(Action<LootLockerListCurrenciesResponse> onCom
5000
5000
LootLockerServerRequest . CallAPI ( LootLockerEndPoints . listCurrencies . endPoint , LootLockerEndPoints . listCurrencies . httpMethod , onComplete : ( serverResponse ) => { LootLockerResponse . Deserialize ( onComplete , serverResponse ) ; } ) ;
5001
5001
}
5002
5002
5003
- /// <summary>
5004
- /// Get a specific currency by code
5005
- /// </summary>
5006
- /// <param name="currencyCode">The short code for the currency to fetch information for</param>
5007
- /// <param name="onComplete">onComplete Action for handling the response</param>
5008
- public static void GetCurrencyByCode ( string currencyCode , Action < LootLockerGetCurrencyByCodeResponse > onComplete )
5009
- {
5010
- if ( ! CheckInitialized ( ) )
5011
- {
5012
- onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerGetCurrencyByCodeResponse > ( ) ) ;
5013
- return ;
5014
- }
5015
-
5016
- var endpoint = string . Format ( LootLockerEndPoints . getCurrencyByCode . endPoint , currencyCode ) ;
5017
-
5018
- LootLockerServerRequest . CallAPI ( endpoint , LootLockerEndPoints . getCurrencyByCode . httpMethod , onComplete : ( serverResponse ) => { LootLockerResponse . Deserialize ( onComplete , serverResponse ) ; } ) ;
5019
- }
5020
-
5021
5003
/// <summary>
5022
5004
/// Get a list of the denominations available for a specific currency
5023
5005
/// </summary>
5024
- /// <param name="currencyCode">The short code for the currency to fetch denominations for</param>
5006
+ /// <param name="currencyCode">The code of the currency to fetch denominations for</param>
5025
5007
/// <param name="onComplete">onComplete Action for handling the response</param>
5026
- public static void GetCurrencyDenominations ( string currencyCode , Action < LootLockerListDenominationsResponse > onComplete )
5008
+ public static void GetCurrencyDenominationsByCode ( string currencyCode , Action < LootLockerListDenominationsResponse > onComplete )
5027
5009
{
5028
5010
if ( ! CheckInitialized ( ) )
5029
5011
{
5030
5012
onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerListDenominationsResponse > ( ) ) ;
5031
5013
return ;
5032
5014
}
5033
5015
5034
- var endpoint = string . Format ( LootLockerEndPoints . getCurrencyDenominations . endPoint , currencyCode ) ;
5016
+ var endpoint = string . Format ( LootLockerEndPoints . getCurrencyDenominationsByCode . endPoint , currencyCode ) ;
5035
5017
5036
- LootLockerServerRequest . CallAPI ( endpoint , LootLockerEndPoints . getCurrencyDenominations . httpMethod , onComplete : ( serverResponse ) => { LootLockerResponse . Deserialize ( onComplete , serverResponse ) ; } ) ;
5018
+ LootLockerServerRequest . CallAPI ( endpoint , LootLockerEndPoints . getCurrencyDenominationsByCode . httpMethod , onComplete : ( serverResponse ) => { LootLockerResponse . Deserialize ( onComplete , serverResponse ) ; } ) ;
5037
5019
}
5038
5020
5039
5021
#endregion
@@ -5042,54 +5024,94 @@ public static void GetCurrencyDenominations(string currencyCode, Action<LootLock
5042
5024
/// <summary>
5043
5025
/// Get a list of balances in a specified wallet
5044
5026
/// </summary>
5045
- /// <param name="walletID ">Unique ID of the wallet to get balances for</param>
5027
+ /// <param name="walletId ">Unique ID of the wallet to get balances for</param>
5046
5028
/// <param name="onComplete">onComplete Action for handling the response</param>
5047
- public static void ListBalancesInWallet ( string walletID , Action < LootLockerListBalancesForWalletResponse > onComplete )
5029
+ public static void ListBalancesInWallet ( string walletId , Action < LootLockerListBalancesForWalletResponse > onComplete )
5048
5030
{
5049
5031
if ( ! CheckInitialized ( ) )
5050
5032
{
5051
5033
onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerListBalancesForWalletResponse > ( ) ) ;
5052
5034
return ;
5053
5035
}
5054
- var endpoint = string . Format ( LootLockerEndPoints . listBalancesInWallet . endPoint , walletID ) ;
5036
+ var endpoint = string . Format ( LootLockerEndPoints . listBalancesInWallet . endPoint , walletId ) ;
5055
5037
5056
5038
LootLockerServerRequest . CallAPI ( endpoint , LootLockerEndPoints . listBalancesInWallet . httpMethod , onComplete : ( serverResponse ) => { LootLockerResponse . Deserialize ( onComplete , serverResponse ) ; } ) ;
5057
5039
}
5058
5040
5059
5041
/// <summary>
5060
5042
/// Get information about a specified wallet
5061
5043
/// </summary>
5062
- /// <param name="walletID ">Unique ID of the wallet to get information for</param>
5044
+ /// <param name="walletId ">Unique ID of the wallet to get information for</param>
5063
5045
/// <param name="onComplete">onComplete Action for handling the response</param>
5064
- public static void GetWalletByWalletID ( string walletID , Action < LootLockerGetWalletResponse > onComplete )
5046
+ public static void GetWalletByWalletId ( string walletId , Action < LootLockerGetWalletResponse > onComplete )
5065
5047
{
5066
5048
if ( ! CheckInitialized ( ) )
5067
5049
{
5068
5050
onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerGetWalletResponse > ( ) ) ;
5069
5051
return ;
5070
5052
}
5071
- var endpoint = string . Format ( LootLockerEndPoints . getWalletByWalletId . endPoint , walletID ) ;
5053
+ var endpoint = string . Format ( LootLockerEndPoints . getWalletByWalletId . endPoint , walletId ) ;
5072
5054
5073
5055
LootLockerServerRequest . CallAPI ( endpoint , LootLockerEndPoints . getWalletByWalletId . httpMethod , onComplete : ( serverResponse ) => { LootLockerResponse . Deserialize ( onComplete , serverResponse ) ; } ) ;
5074
5056
}
5075
5057
5076
5058
/// <summary>
5077
5059
/// Get information about a wallet for a specified holder
5078
5060
/// </summary>
5079
- /// <param name="holderID">Unique ID of the holder of the wallet you want to get information for</param>
5061
+ /// <param name="holderId">Ulid of the holder of the wallet you want to get information for</param>
5080
5062
/// <param name="onComplete">onComplete Action for handling the response</param>
5081
- public static void GetWalletByHolderID ( string holderID , Action < LootLockerGetWalletResponse > onComplete )
5063
+ public static void GetWalletByHolderId ( string holderId , Action < LootLockerGetWalletResponse > onComplete )
5082
5064
{
5083
5065
if ( ! CheckInitialized ( ) )
5084
5066
{
5085
5067
onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerGetWalletResponse > ( ) ) ;
5086
5068
return ;
5087
5069
}
5088
- var endpoint = string . Format ( LootLockerEndPoints . getWalletByHolderId . endPoint , holderID ) ;
5070
+ var endpoint = string . Format ( LootLockerEndPoints . getWalletByHolderId . endPoint , holderId ) ;
5089
5071
5090
5072
LootLockerServerRequest . CallAPI ( endpoint , LootLockerEndPoints . getWalletByHolderId . httpMethod , onComplete : ( serverResponse ) => { LootLockerResponse . Deserialize ( onComplete , serverResponse ) ; } ) ;
5091
5073
}
5092
5074
5075
+ /// <summary>
5076
+ /// Credit (increase) the specified amount of the provided currency to the provided wallet
5077
+ /// </summary>
5078
+ /// <param name="walletId">Unique ID of the wallet to credit the given amount of the given currency to</param>
5079
+ /// <param name="currencyId">Unique ID of the currency to credit</param>
5080
+ /// <param name="amount">The amount of the given currency to credit to the given wallet</param>
5081
+ /// <param name="onComplete">onComplete Action for handling the response</param>
5082
+ public static void CreditBalanceToWallet ( string walletId , string currencyId , string amount , Action < LootLockerBalanceForWalletResponse > onComplete )
5083
+ {
5084
+ if ( ! CheckInitialized ( ) )
5085
+ {
5086
+ onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerBalanceForWalletResponse > ( ) ) ;
5087
+ return ;
5088
+ }
5089
+
5090
+ var json = LootLockerJson . SerializeObject ( new LootLockerCreditRequest ( ) { amount = amount , currency_id = currencyId , wallet_id = walletId } ) ;
5091
+
5092
+ LootLockerServerRequest . CallAPI ( LootLockerEndPoints . creditBalanceToWallet . endPoint , LootLockerEndPoints . creditBalanceToWallet . httpMethod , json , onComplete : ( serverResponse ) => { LootLockerResponse . Deserialize ( onComplete , serverResponse ) ; } ) ;
5093
+ }
5094
+
5095
+ /// <summary>
5096
+ /// Debit (decrease) the specified amount of the provided currency to the provided wallet
5097
+ /// </summary>
5098
+ /// <param name="walletId">Unique ID of the wallet to debit the given amount of the given currency from</param>
5099
+ /// <param name="currencyId">Unique ID of the currency to debit</param>
5100
+ /// <param name="amount">The amount of the given currency to debit from the given wallet</param>
5101
+ /// <param name="onComplete">onComplete Action for handling the response</param>
5102
+ public static void DebitBalanceToWallet ( string walletId , string currencyId , string amount , Action < LootLockerBalanceForWalletResponse > onComplete )
5103
+ {
5104
+ if ( ! CheckInitialized ( ) )
5105
+ {
5106
+ onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerBalanceForWalletResponse > ( ) ) ;
5107
+ return ;
5108
+ }
5109
+
5110
+ var json = LootLockerJson . SerializeObject ( new LootLockerDebitRequest ( ) { amount = amount , currency_id = currencyId , wallet_id = walletId } ) ;
5111
+
5112
+ LootLockerServerRequest . CallAPI ( LootLockerEndPoints . debitBalanceToWallet . endPoint , LootLockerEndPoints . debitBalanceToWallet . httpMethod , json , onComplete : ( serverResponse ) => { LootLockerResponse . Deserialize ( onComplete , serverResponse ) ; } ) ;
5113
+ }
5114
+
5093
5115
#endregion
5094
5116
5095
5117
#region Catalog
@@ -5115,14 +5137,14 @@ public static void ListCatalogs(Action<LootLockerListCatalogsResponse> onComplet
5115
5137
/// <param name="count">Amount of catalog items to receive. Use null to simply get the default amount.</param>
5116
5138
/// <param name="after">Used for pagination, this is the cursor to start getting items from. Use null to get items from the beginning. Use the cursor from a previous call to get the next count of items in the list.</param>
5117
5139
/// <param name="onComplete">onComplete Action for handling the response</param>
5118
- public static void ListCatalogItems ( string catalogKey , int count , string after , Action < LootLockerListCatalogItemsResponse > onComplete )
5140
+ public static void ListCatalogItems ( string catalogKey , int count , string after , Action < LootLockerListCatalogPricesResponse > onComplete )
5119
5141
{
5120
5142
if ( ! CheckInitialized ( ) )
5121
5143
{
5122
- onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerListCatalogItemsResponse > ( ) ) ;
5144
+ onComplete ? . Invoke ( LootLockerResponseFactory . SDKNotInitializedError < LootLockerListCatalogPricesResponse > ( ) ) ;
5123
5145
return ;
5124
5146
}
5125
- var endpoint = string . Format ( LootLockerEndPoints . listCatalogItems . endPoint , catalogKey ) ;
5147
+ var endpoint = string . Format ( LootLockerEndPoints . listCatalogItemsByKey . endPoint , catalogKey ) ;
5126
5148
5127
5149
endpoint += "?" ;
5128
5150
if ( count > 0 )
@@ -5131,7 +5153,7 @@ public static void ListCatalogItems(string catalogKey, int count, string after,
5131
5153
if ( ! string . IsNullOrEmpty ( after ) )
5132
5154
endpoint += $ "cursor={ after } &";
5133
5155
5134
- LootLockerServerRequest . CallAPI ( endpoint , LootLockerEndPoints . listCatalogItems . httpMethod , onComplete : ( serverResponse ) => { LootLockerCatalogRequestUtils . ParseLootLockerListCatalogItemsResponse ( onComplete , serverResponse ) ; } ) ;
5156
+ LootLockerServerRequest . CallAPI ( endpoint , LootLockerEndPoints . listCatalogItemsByKey . httpMethod , onComplete : ( serverResponse ) => { onComplete ? . Invoke ( new LootLockerListCatalogPricesResponse ( serverResponse ) ) ; } ) ;
5135
5157
}
5136
5158
#endregion
5137
5159
0 commit comments