From 00612fd5ccaa988fe7208255449cdd4ac5b1f30d Mon Sep 17 00:00:00 2001 From: Pierre Proulx Date: Thu, 22 Oct 2026 17:03:28 -0400 Subject: [PATCH 1/2] BCLOUD-15136 Implement AppStore.GetStoreInfo and AppStore.GetUserToken --- include/braincloud/BrainCloudAppStore.h | 24 ++++++++++++++++++++++++ include/braincloud/ServiceOperation.h | 2 ++ src/BrainCloudAppStore.cpp | 18 ++++++++++++++++++ src/ServiceOperation.cpp | 2 ++ tests/src/TestBCAppStore.cpp | 16 +++++++++++++++- 5 files changed, 61 insertions(+), 1 deletion(-) diff --git a/include/braincloud/BrainCloudAppStore.h b/include/braincloud/BrainCloudAppStore.h index 16f3e8f3c..088478c4a 100644 --- a/include/braincloud/BrainCloudAppStore.h +++ b/include/braincloud/BrainCloudAppStore.h @@ -158,6 +158,30 @@ namespace BrainCloud */ void cachePurchasePayloadContext(const std::string& storeId, const std::string& iapId, const std::string& payload, IServerCallback* callback = NULL); + /** + * Returns the store's client-side configuration for the given store. + * + * Service Name - appStore + * Service Operation - GET_STORE_INFO + * + * @param storeId The store to query. Currently only returns info for "xsolla", all other storeIds will return empty data. + * @param callback The method to be invoked when the server response is received + */ + void getStoreInfo(const std::string& storeId, IServerCallback* callback = NULL); + + /** + * Returns a store user token (JWT) for the current user, generated server-side. + * Currently only Xsolla is supported. The userToken is null if the required + * Xsolla integration settings are missing or the Xsolla call fails. + * + * Service Name - appStore + * Service Operation - GET_USER_TOKEN + * + * @param storeId The store to get the token. Currently only returns info for "xsolla", all other storeIds will return empty data. + * @param callback The method to be invoked when the server response is received + */ + void getUserToken(const std::string& storeId, IServerCallback* callback = NULL); + private: BrainCloudClient * m_client; }; diff --git a/include/braincloud/ServiceOperation.h b/include/braincloud/ServiceOperation.h index a70c787e5..d18a188e6 100644 --- a/include/braincloud/ServiceOperation.h +++ b/include/braincloud/ServiceOperation.h @@ -536,6 +536,8 @@ namespace BrainCloud static const ServiceOperation AppStoreStartPurchase; static const ServiceOperation AppStoreFinalizePurchase; static const ServiceOperation AppStoreRefreshPromotions; + static const ServiceOperation GetStoreInfo; + static const ServiceOperation GetUserToken; // Blockchain static const ServiceOperation GetBlockchainItems; diff --git a/src/BrainCloudAppStore.cpp b/src/BrainCloudAppStore.cpp index 75d7c72ff..86928fef2 100644 --- a/src/BrainCloudAppStore.cpp +++ b/src/BrainCloudAppStore.cpp @@ -100,4 +100,22 @@ namespace BrainCloud ServerCall* sc = new ServerCall(ServiceName::AppStore, ServiceOperation::AppStoreCachePurchaseContext, message, callback); m_client->sendRequest(sc); } + + void BrainCloudAppStore::getStoreInfo(const std::string& storeId, IServerCallback* callback) + { + Json::Value message; + message[OperationParam::AppStoreStoreId.getValue()] = storeId; + + ServerCall* sc = new ServerCall(ServiceName::AppStore, ServiceOperation::GetStoreInfo, message, callback); + m_client->sendRequest(sc); + } + + void BrainCloudAppStore::getUserToken(const std::string& storeId, IServerCallback* callback) + { + Json::Value message; + message[OperationParam::AppStoreStoreId.getValue()] = storeId; + + ServerCall* sc = new ServerCall(ServiceName::AppStore, ServiceOperation::GetUserToken, message, callback); + m_client->sendRequest(sc); + } } diff --git a/src/ServiceOperation.cpp b/src/ServiceOperation.cpp index d8a73c709..e74a98b74 100644 --- a/src/ServiceOperation.cpp +++ b/src/ServiceOperation.cpp @@ -156,6 +156,8 @@ namespace BrainCloud const ServiceOperation ServiceOperation::ConsumeVC = ServiceOperation("CONSUME_VC"); const ServiceOperation ServiceOperation::GetPlayerVC = ServiceOperation("GET_PLAYER_VC"); const ServiceOperation ServiceOperation::ResetPlayerVC = ServiceOperation("RESET_PLAYER_VC"); + const ServiceOperation ServiceOperation::GetStoreInfo = ServiceOperation("GET_STORE_INFO"); + const ServiceOperation ServiceOperation::GetUserToken = ServiceOperation("GET_USER_TOKEN"); const ServiceOperation ServiceOperation::AwardParentVC = ServiceOperation("AWARD_PARENT_VC"); const ServiceOperation ServiceOperation::ConsumeParentVC = ServiceOperation("CONSUME_PARENT_VC"); diff --git a/tests/src/TestBCAppStore.cpp b/tests/src/TestBCAppStore.cpp index 3ce9f36b8..20fcfa384 100644 --- a/tests/src/TestBCAppStore.cpp +++ b/tests/src/TestBCAppStore.cpp @@ -61,4 +61,18 @@ TEST_F(TestBCAppStore, cachePurchasePayloadContext) TestResult tr; m_bc->getAppStoreService()->cachePurchasePayloadContext("_invalid_store_id_", "_invalid_transaction_id_", "{}", &tr); tr.runExpectFail(m_bc, HTTP_BAD_REQUEST, INVALID_STORE_ID); -} \ No newline at end of file +} + +TEST_F(TestBCAppStore, GetStoreInfo) +{ + TestResult tr; + m_bc->getAppStoreService()->getStoreInfo("_invalid_store_id_", &tr); + tr.runExpectFail(m_bc, HTTP_BAD_REQUEST, INVALID_STORE_ID); +} + +TEST_F(TestBCAppStore, GetUserToken) +{ + TestResult tr; + m_bc->getAppStoreService()->getUserToken("_invalid_store_id_", &tr); + tr.runExpectFail(m_bc, HTTP_BAD_REQUEST, INVALID_STORE_ID); +} From 5f41d4b2dc56d880e28c29220cd8299887a75215 Mon Sep 17 00:00:00 2001 From: Pierre Proulx Date: Fri, 23 Oct 2026 09:44:24 -0400 Subject: [PATCH 2/2] Added 2 more successful tests with "xsolla". --- tests/src/TestBCAppStore.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/src/TestBCAppStore.cpp b/tests/src/TestBCAppStore.cpp index 20fcfa384..f134b42ce 100644 --- a/tests/src/TestBCAppStore.cpp +++ b/tests/src/TestBCAppStore.cpp @@ -64,6 +64,13 @@ TEST_F(TestBCAppStore, cachePurchasePayloadContext) } TEST_F(TestBCAppStore, GetStoreInfo) +{ + TestResult tr; + m_bc->getAppStoreService()->getStoreInfo("xsolla", &tr); + tr.run(m_bc); +} + +TEST_F(TestBCAppStore, GetStoreInfoFail) { TestResult tr; m_bc->getAppStoreService()->getStoreInfo("_invalid_store_id_", &tr); @@ -71,6 +78,13 @@ TEST_F(TestBCAppStore, GetStoreInfo) } TEST_F(TestBCAppStore, GetUserToken) +{ + TestResult tr; + m_bc->getAppStoreService()->getUserToken("xsolla", &tr); + tr.run(m_bc); +} + +TEST_F(TestBCAppStore, GetUserTokenFail) { TestResult tr; m_bc->getAppStoreService()->getUserToken("_invalid_store_id_", &tr);