SDK for / Overview

XsollaStoreSubsystem.h

1// Copyright 2023 Xsolla Inc. All Rights Reserved.
2
3#pragma once
4
5#include "XsollaStoreDataModel.h"
6#include "XsollaUtilsHttpRequestHelper.h"
7#include "Blueprint/UserWidget.h"
8#include "Subsystems/GameInstanceSubsystem.h"
9#include "Subsystems/SubsystemCollection.h"
10#include "XsollaOrderCheckObject.h"
11#include "XsollaUtilsDataModel.h"
12#include "XsollaStoreSubsystem.generated.h"
13
14
15enum class EXsollaPublishingPlatform : uint8;
16class FJsonObject;
19
20DECLARE_DYNAMIC_DELEGATE(FOnStoreUpdate);
21DECLARE_DYNAMIC_DELEGATE(FOnStoreSuccessPayment);
22DECLARE_DYNAMIC_DELEGATE(FOnStoreCancelPayment);
23DECLARE_DYNAMIC_DELEGATE(FOnStoreCartUpdate);
24DECLARE_DYNAMIC_DELEGATE_OneParam(FOnStoreBrowserClosed, bool, bIsManually);
25DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnCartUpdate, const FStoreCart&, Cart);
26DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnFetchTokenSuccess, const FString&, AccessToken, int32, OrderId);
27DECLARE_DYNAMIC_DELEGATE_ThreeParams(FOnCheckOrder, int32, OrderId, EXsollaOrderStatus, OrderStatus, FXsollaOrderContent, OrderContent);
28DECLARE_DYNAMIC_DELEGATE_OneParam(FOnCurrencyUpdate, const FVirtualCurrency&, Currency);
29DECLARE_DYNAMIC_DELEGATE_OneParam(FOnCurrencyPackageUpdate, const FVirtualCurrencyPackage&, CurrencyPackage);
30DECLARE_DYNAMIC_DELEGATE_OneParam(FOnPurchaseUpdate, int32, OrderId);
31DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetPromocodeRewardsUpdate, FStorePromocodeRewardData, RewardsData);
32DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetListOfBundlesUpdate, FStoreListOfBundles, ListOfBundles);
33DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetSpecifiedBundleUpdate, FStoreBundle, Bundle);
34DECLARE_DYNAMIC_DELEGATE(FOnPromocodeUpdate);
35DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetItemsListBySpecifiedGroup, FStoreItemsList, ItemsList);
36DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetItemsList, FStoreItemsList, ItemsList);
37DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetGamesListBySpecifiedGroup, FStoreGamesList, GamesList);
38DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGameUpdate, const FGameItem&, Game);
39DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGameKeyUpdate, const FGameKeyItem&, GameKey);
40DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetGameKeysListBySpecifiedGroup, FStoreGameKeysList, GameKeysList);
41DECLARE_DYNAMIC_DELEGATE_OneParam(FOnDRMListUpdate, FStoreDRMList, DRMList);
42DECLARE_DYNAMIC_DELEGATE_OneParam(FOnOwnedGamesListUpdate, FOwnedGamesList, GamesList);
43DECLARE_DYNAMIC_DELEGATE_OneParam(FOnVirtualCurrenciesUpdate, const FVirtualCurrencyData&, VirtualCurrencyData);
44DECLARE_DYNAMIC_DELEGATE_OneParam(FOnStoreGamesUpdate, const FStoreGamesData&, GamesData);
45DECLARE_DYNAMIC_DELEGATE_OneParam(FOnStoreItemsUpdate, const FStoreItemsData&, ItemsData);
46DECLARE_DYNAMIC_DELEGATE_OneParam(FOnVirtualCurrencyPackagesUpdate, const FVirtualCurrencyPackagesData&, Data);
47DECLARE_DYNAMIC_DELEGATE_OneParam(FOnItemGroupsUpdate, const TArray<FXsollaItemGroup>&, ItemGroups);
48DECLARE_DYNAMIC_DELEGATE(FOnRedeemGameCodeSuccess);
49DECLARE_DYNAMIC_DELEGATE_OneParam(FOnSubscriptionPublicPlansListUpdate, FSubscriptionPlansList, SubscriptionPlansList);
50DECLARE_DYNAMIC_DELEGATE_OneParam(FOnSubscriptionPlansListUpdate, FSubscriptionPlansList, SubscriptionPlansList);
51DECLARE_DYNAMIC_DELEGATE_OneParam(FOnSubscriptionsListUpdate, FSubscriptionsList, SubscriptionsList);
52DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetSubscriptionDetailsSuccess, const FSubscriptionDetails&, SubscriptionDetails);
53DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetSubscriptionPayStationLinkSuccess, const FString&, LinkToPaystation);
54DECLARE_DYNAMIC_DELEGATE(FOnCancelSubscriptionSuccess);
55
56UCLASS()
57class XSOLLASTORE_API UXsollaStoreSubsystem : public UGameInstanceSubsystem
58{
59GENERATED_BODY()
60
61public:
63
64// Begin USubsystem
65virtual void Initialize(FSubsystemCollectionBase& Collection) override;
66virtual void Deinitialize() override;
67// End USubsystem
68
74UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
75void Initialize(const FString& InProjectId);
76
91UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
92void GetVirtualItems(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
93const FOnStoreItemsUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
94
106UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
107void GetItemGroups(const FString& Locale,
108const FOnItemGroupsUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
109
123UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
124void GetVirtualCurrencies(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
125const FOnVirtualCurrenciesUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
126
141UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
142void GetVirtualCurrencyPackages(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
143const FOnVirtualCurrencyPackagesUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
144
160UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualItems", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
161void GetItemsListBySpecifiedGroup(const FString& ExternalId, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
162const FOnGetItemsListBySpecifiedGroup& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
163
174UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualItems", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
175void GetAllItemsList(const FString& Locale, const FOnGetItemsList& SuccessCallback, const FOnError& ErrorCallback, const FString& AuthToken = TEXT(""));
176
194UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
195void FetchPaymentToken(const FString& AuthToken, const FString& ItemSKU,
196const FString& Currency, const FString& Country, const FString& Locale,
197const FXsollaParameters CustomParameters,
198const FOnFetchTokenSuccess& SuccessCallback, const FOnError& ErrorCallback, const int32 Quantity = 1);
199
212UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
213void FetchCartPaymentToken(const FString& AuthToken, const FString& CartId,
214const FString& Currency, const FString& Country, const FString& Locale,
215const FXsollaParameters CustomParameters,
216const FOnFetchTokenSuccess& SuccessCallback, const FOnError& ErrorCallback);
217
231UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (WorldContext = "WorldContextObject", AutoCreateRefTerm = "SuccessCallback, ErrorCallback, BrowserClosedCallback"))
232void LaunchPaymentConsole(UObject* WorldContextObject, const int32 OrderId, const FString& AccessToken,
233const FOnStoreSuccessPayment& SuccessCallback, const FOnError& ErrorCallback, const FOnStoreBrowserClosed& BrowserClosedCallback);
234
242UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
243void CheckOrder(const FString& AuthToken, const int32 OrderId,
244const FOnCheckOrder& SuccessCallback, const FOnError& ErrorCallback);
245
253UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
254void CheckPendingOrder(const FString& AccessToken, const int32 OrderId,
255const FOnStoreSuccessPayment& SuccessCallback, const FOnError& ErrorCallback);
256
271UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
272void CreateOrderWithSpecifiedFreeItem(const FString& AuthToken, const FString& ItemSKU,
273const FString& Currency, const FString& Locale, const FXsollaParameters CustomParameters,
274const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback, const int32 Quantity = 1);
275
289UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
290void CreateOrderWithFreeCart(const FString& AuthToken, const FString& CartId,
291const FString& Currency, const FString& Locale,
292const FXsollaParameters CustomParameters,
293const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
294
302UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
303void PurchaseStoreItem(const FStoreItem& StoreItem, const FXsollaPaymentTokenRequestPayload PaymentTokenRequestPayload,
304const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
305
313UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
314void PurchaseCurrencyPackage(const FVirtualCurrencyPackage& CurrencyPackage, const FXsollaPaymentTokenRequestPayload PaymentTokenRequestPayload,
315const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
316
325UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
326void ClearCart(const FString& AuthToken, const FString& CartId,
327const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
328
340UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
341void UpdateCart(const FString& AuthToken, const FString& CartId,
342const FString& Currency, const FString& Locale,
343const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
344
355UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
356void AddToCart(const FString& AuthToken, const FString& CartId, const FString& ItemSKU, const int32 Quantity,
357const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
358
368UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
369void RemoveFromCart(const FString& AuthToken, const FString& CartId, const FString& ItemSKU,
370const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
371
381UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
382void FillCartById(const FString& AuthToken, const FString& CartId, const TArray<FStoreCartItem>& Items,
383const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
384
393UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Bundle", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
394void GetSpecifiedBundle(const FString& Sku, const FOnGetSpecifiedBundleUpdate& SuccessCallback, const FOnError& ErrorCallback, const FString& AuthToken = TEXT(""));
395
409UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Bundle", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
410void GetBundles(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
411const FOnGetListOfBundlesUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
412
424UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
425void GetVirtualCurrency(const FString& CurrencySKU,
426const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
427const FOnCurrencyUpdate& SuccessCallback, const FOnError& ErrorCallback);
428
441UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
442void GetVirtualCurrencyPackage(const FString& PackageSKU,
443const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
444const FOnCurrencyPackageUpdate& SuccessCallback, const FOnError& ErrorCallback);
445
457UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
458void BuyItemWithVirtualCurrency(const FString& AuthToken, const FString& ItemSKU, const FString& CurrencySKU,
459const EXsollaPublishingPlatform Platform, const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
460
469UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Promocode", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
470void GetPromocodeRewards(const FString& AuthToken, const FString& PromocodeCode,
471const FOnGetPromocodeRewardsUpdate& SuccessCallback, const FOnError& ErrorCallback);
472
481UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Promocode", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
482void RedeemPromocode(const FString& AuthToken, const FString& PromocodeCode,
483const FOnPromocodeUpdate& SuccessCallback, const FOnError& ErrorCallback);
484
492UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Promocode", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
493void RemovePromocodeFromCart(const FString& AuthToken,
494const FOnPromocodeUpdate& SuccessCallback, const FOnError& ErrorCallback);
495
507UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys" , meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
508void GetGamesList(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
509const FOnStoreGamesUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
510
523UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
524void GetGamesListBySpecifiedGroup(const FString& ExternalId, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
525const FOnGetGamesListBySpecifiedGroup& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
526
536UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
537void GetGameItem(const FString& GameSKU, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
538const FOnGameUpdate& SuccessCallback, const FOnError& ErrorCallback);
539
550UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
551void GetGameKeyItem(const FString& ItemSKU, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
552const FOnGameKeyUpdate& SuccessCallback, const FOnError& ErrorCallback);
553
566UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
567void GetGameKeysListBySpecifiedGroup(const FString& ExternalId, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
568const FOnGetGameKeysListBySpecifiedGroup& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
569
575UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
576void GetDRMList(const FOnDRMListUpdate& SuccessCallback, const FOnError& ErrorCallback);
577
589UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
590void GetOwnedGames(const FString& AuthToken, const TArray<FString>& AdditionalFields,
591const FOnOwnedGamesListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const bool bIsSandbox = false);
592
600UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
601void RedeemGameCodeByClient(const FString& AuthToken, const FString& Code,
602const FOnRedeemGameCodeSuccess& SuccessCallback, const FOnError& ErrorCallback);
603
617UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "PlanId, PlanExternalId, SuccessCallback, ErrorCallback"))
618void GetSubscriptionPublicPlans(const TArray<int> PlanId, const TArray<FString>& PlanExternalId, const FString& Country, const FString& Locale,
619const FOnSubscriptionPublicPlansListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
620
635UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "PlanId, PlanExternalId, SuccessCallback, ErrorCallback"))
636void GetSubscriptionPlans(const FString& AuthToken, const TArray<int> PlanId, const TArray<FString>& PlanExternalId, const FString& Country, const FString& Locale,
637const FOnSubscriptionPlansListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
638
650UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
651void GetSubscriptions(const FString& AuthToken, const FString& Locale,
652const FOnSubscriptionsListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
653
664UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
665void GetSubscriptionDetails(const FString& AuthToken, const int32 SubscriptionId, const FString& Locale,
666const FOnGetSubscriptionDetailsSuccess& SuccessCallback, const FOnError& ErrorCallback);
667
677UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
678void GetSubscriptionPurchaseUrl(const FString& AuthToken, const FString& PlanExternalId, const FString& Country,
679const FOnGetSubscriptionPayStationLinkSuccess& SuccessCallback, const FOnError& ErrorCallback);
680
689UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
690void GetSubscriptionManagementUrl(const FString& AuthToken, const FString& Country,
691const FOnGetSubscriptionPayStationLinkSuccess& SuccessCallback, const FOnError& ErrorCallback);
692
701UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
702void GetSubscriptionRenewalUrl(const FString& AuthToken, const int32 SubscriptionId,
703const FOnGetSubscriptionPayStationLinkSuccess& SuccessCallback, const FOnError& ErrorCallback);
704
713UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
714void CancelSubscription(const FString& AuthToken, const int32 SubscriptionId,
715const FOnCancelSubscriptionSuccess& SuccessCallback, const FOnError& ErrorCallback);
716
717protected:
718void GetVirtualItems_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
719const bool bSucceeded, FOnStoreItemsUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
720void GetItemGroups_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
721const bool bSucceeded, FOnItemGroupsUpdate SuccessCallback, FOnError ErrorCallback);
722void GetVirtualCurrencies_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
723const bool bSucceeded, FOnVirtualCurrenciesUpdate SuccessCallback, FOnError ErrorCallback);
724void GetVirtualCurrencyPackages_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
725const bool bSucceeded, FOnVirtualCurrencyPackagesUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
726void GetItemsListBySpecifiedGroup_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
727const bool bSucceeded, FOnGetItemsListBySpecifiedGroup SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
728void GetAllItemsList_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
729const bool bSucceeded, FOnGetItemsList SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
730
731void FetchPaymentToken_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
732const bool bSucceeded, FOnFetchTokenSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
733void CheckOrder_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
734const bool bSucceeded, FOnCheckOrder SuccessCallback, FOnError ErrorCallback);
735
736void CreateOrderWithSpecifiedFreeItem_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
737const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
738void CreateOrderWithFreeCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
739const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
740
741void CreateCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
742const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FOnError ErrorCallback);
743void ClearCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
744const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FOnError ErrorCallback);
745void UpdateCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
746const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FOnError ErrorCallback);
747void AddToCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
748const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FOnError ErrorCallback);
749void RemoveFromCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
750const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FOnError ErrorCallback);
751void FillCartById_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
752const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
753
754void GetListOfBundles_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
755const bool bSucceeded, FOnGetListOfBundlesUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
756void GetSpecifiedBundle_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
757const bool bSucceeded, FOnGetSpecifiedBundleUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
758
759void GetVirtualCurrency_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
760const bool bSucceeded, FOnCurrencyUpdate SuccessCallback, FOnError ErrorCallback);
761void GetVirtualCurrencyPackage_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
762const bool bSucceeded, FOnCurrencyPackageUpdate SuccessCallback, FOnError ErrorCallback);
763
764void BuyItemWithVirtualCurrency_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
765const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
766
767void GetPromocodeRewards_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
768const bool bSucceeded, FOnGetPromocodeRewardsUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
769void RedeemPromocode_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
770const bool bSucceeded, FOnPromocodeUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
771void RemovePromocodeFromCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
772const bool bSucceeded, FOnPromocodeUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
773
774void GetGamesList_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
775const bool bSucceeded, FOnStoreGamesUpdate SuccessCallback, FOnError ErrorCallback);
776
777void GetGamesListBySpecifiedGroup_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
778const bool bSucceeded, FOnGetGamesListBySpecifiedGroup SuccessCallback, FOnError ErrorCallback);
779
780void GetGameItem_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
781const bool bSucceeded, FOnGameUpdate SuccessCallback, FOnError ErrorCallback);
782
783void GetGameKeyItem_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
784const bool bSucceeded, FOnGameKeyUpdate SuccessCallback, FOnError ErrorCallback);
785
786void GetGameKeysListBySpecifiedGroup_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
787const bool bSucceeded, FOnGetGameKeysListBySpecifiedGroup SuccessCallback, FOnError ErrorCallback);
788
789void GetDRMList_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
790const bool bSucceeded, FOnDRMListUpdate SuccessCallback, FOnError ErrorCallback);
791
792void GetOwnedGames_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
793const bool bSucceeded, FOnOwnedGamesListUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
794
795void RedeemGameCodeByClient_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
796const bool bSucceeded, FOnRedeemGameCodeSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
797
798void GetSubscriptionPublicPlans_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
799const bool bSucceeded, FOnSubscriptionPublicPlansListUpdate SuccessCallback, FOnError ErrorCallback);
800
801void GetSubscriptionPlans_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
802const bool bSucceeded, FOnSubscriptionPlansListUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
803
804void GetSubscriptions_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
805const bool bSucceeded, FOnSubscriptionsListUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
806
807void GetSubscriptionDetails_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
808const bool bSucceeded, FOnGetSubscriptionDetailsSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
809
810void GetSubscriptionPaystationLink_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
811const bool bSucceeded, FOnGetSubscriptionPayStationLinkSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
812
813void CancelSubscription_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
814const bool bSucceeded, FOnCancelSubscriptionSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
815
817void HandleRequestError(XsollaHttpRequestError ErrorData, FOnError ErrorCallback);
818
819void HandlePurchaseFreeItemsRequest(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
820const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
821
822protected:
824void LoadData();
825
827void SaveData();
828
830bool IsSandboxEnabled() const;
831
832void InnerPurchase(const FString& Sku, bool bIsFree, const TArray<FXsollaVirtualCurrencyPrice>& VirtualPrices,
833const FXsollaPaymentTokenRequestPayload PaymentTokenRequestPayload, const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
834
835UFUNCTION()
836void FetchTokenCallback(const FString& AccessToken, int32 InOrderId);
837
838UFUNCTION()
839void BuyVirtualOrFreeItemCallback(int32 InOrderId);
840
841UFUNCTION()
842void CheckPendingOrderSuccessCallback();
843
844private:
846TSharedRef<IHttpRequest, ESPMode::ThreadSafe> CreateHttpRequest(const FString& Url, const EXsollaHttpRequestVerb Verb = EXsollaHttpRequestVerb::VERB_GET,
847const FString& AuthToken = FString(), const FString& Content = FString());
848
850FString SerializeJson(const TSharedPtr<FJsonObject> DataJson) const;
851
853void ProcessNextCartRequest();
854
856TSharedPtr<FJsonObject> PreparePaymentTokenRequestPayload(const FString& Currency, const FString& Country, const FString& Locale, const FXsollaParameters& CustomParameters);
857
859TSharedPtr<FJsonObject> PreparePaystationSettings();
860
862FString GetPaymentInerfaceTheme() const;
863
865bool GetSteamUserId(const FString& AuthToken, FString& SteamId, FString& OutError);
866
868TArray<TSharedRef<IHttpRequest, ESPMode::ThreadSafe>> CartRequestsQueue;
869
870public:
872UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
873TArray<FStoreItem> GetVirtualItemsWithoutGroup() const;
874
876UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
877const FStoreItemsData& GetItemsData() const;
878
880UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart")
881const FStoreCart& GetCart() const;
882
884UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
885const FString& GetPendingPaystationUrl() const;
886
888UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
889FString GetItemName(const FString& ItemSKU) const;
890
892UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
893const FStoreItem& FindItemBySku(const FString& ItemSku, bool& bHasFound) const;
894
896UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
897const FVirtualCurrencyPackage& FindVirtualCurrencyPackageBySku(const FString& ItemSku, bool& bHasFound) const;
898
900UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart")
901bool IsItemInCart(const FString& ItemSKU) const;
902
903public:
905UPROPERTY(BlueprintAssignable, Category = "Xsolla|Store|Cart")
906FOnCartUpdate OnCartUpdate;
907
908protected:
910FString ProjectID;
911
914
917
919FVirtualCurrencyPackagesData VirtualCurrencyPackages;
920
922FString CachedCartCurrency;
923
925FString CachedAuthToken;
926
928FString CachedCartId;
929
931FString CachedCartLocale;
932
934FString PengindPaystationUrl;
935
937
938private:
939UPROPERTY()
940TSubclassOf<UXsollaStoreBrowserWrapper> DefaultBrowserWidgetClass;
941
942UPROPERTY()
943TArray<UXsollaOrderCheckObject*> CachedOrderCheckObjects;
944
945UPROPERTY()
946UXsollaLoginSubsystem* LoginSubsystem;
947
948UPROPERTY()
949FString PaymentAccessToken;
950
951UPROPERTY()
952FString PaymentRedirectURI;
953
954UPROPERTY()
955bool PaymentEnableSandbox;
956
957UPROPERTY()
958int32 PaymentOrderId;
959
960FOnPurchaseUpdate PaymentSuccessCallback;
961
962FOnError PaymentErrorCallback;
963
964UPROPERTY()
965FOnStoreBrowserClosed PaymentBrowserClosedCallback;
966};
Definition: XsollaLoginSubsystem.h:49
Definition: XsollaOrderCheckObject.h:21
Definition: XsollaStoreBrowserWrapper.h:16
Definition: XsollaStoreSubsystem.h:58
Definition: XsollaStoreDataModel.h:521
Definition: XsollaStoreDataModel.h:436
Definition: XsollaStoreDataModel.h:116
Definition: XsollaStoreDataModel.h:240
Definition: XsollaStoreDataModel.h:363
Definition: XsollaStoreDataModel.h:423