Conversation
- Add 3 new endpoints: initiateAsyncPurchase, pollAsyncPurchaseStatus, retryAsyncPurchase - Add DTOs: LootLockerAsyncPurchaseStatus enum, LootLockerAsyncPurchaseInitiatedResponse, LootLockerAsyncPurchaseStatusResponse - Add primitive API methods: InitiateAsyncPurchase, GetAsyncPurchaseStatus, RetryAsyncPurchase - Add AsyncPurchasePoller MonoBehaviour service with coroutine-based auto-polling, timeout, retry on 5xx, and process lifecycle management - Add public facade methods to LootLockerSDKManager: InitiateAsyncPurchaseSingleCatalogItem, InitiateAsyncPurchaseCatalogItems, GetAsyncPurchaseStatus, RetryAsyncPurchase, InitiateAndPollAsyncPurchaseSingleCatalogItem, InitiateAndPollAsyncPurchaseCatalogItems, CancelAsyncPurchasePolling
|
Before merging, this needs to be functionally tested |
There was a problem hiding this comment.
Pull request overview
Adds SDK support for an async purchase flow (initiate → poll status → retry), including an auto-polling helper service patterned after the existing Remote Session poller.
Changes:
- Added async purchase endpoints (initiate, status poll, retry).
- Introduced async purchase DTOs + primitive request methods, plus a coroutine-based poller service for auto-polling.
- Added public facade methods in
LootLockerSDKManagerfor initiating, polling, retrying, and cancelling polling.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
Runtime/Client/LootLockerEndPoints.cs |
Adds the three new async purchase endpoints used by the SDK requests. |
Runtime/Game/Requests/PurchaseRequest.cs |
Adds DTOs, request methods, and an AsyncPurchasePoller service to auto-poll async purchases. |
Runtime/Game/LootLockerSDKManager.cs |
Exposes the async purchase flow via public facade methods under the Purchasing region. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| float timeoutAfterMinutes = 5.0f, | ||
| string forPlayerWithUlid = null) | ||
| { | ||
| pollingIntervalSeconds = Math.Max(1.0f, pollingIntervalSeconds); |
There was a problem hiding this comment.
pollingIntervalSeconds = Math.Max(1.0f, pollingIntervalSeconds); won’t compile because System.Math.Max has no float overload and returns double, which can’t be implicitly assigned to float. Use Mathf.Max(1f, pollingIntervalSeconds) (Unity) or Math.Max(1.0, pollingIntervalSeconds) with an explicit cast back to float.
| pollingIntervalSeconds = Math.Max(1.0f, pollingIntervalSeconds); | |
| pollingIntervalSeconds = Mathf.Max(1.0f, pollingIntervalSeconds); |
| public enum LootLockerAsyncPurchaseStatus | ||
| { | ||
| /// <summary>The purchase is still being processed</summary> | ||
| pending, | ||
| /// <summary>The purchase completed successfully and items have been granted</summary> |
There was a problem hiding this comment.
LootLockerAsyncPurchaseStatus is declared inside namespace LootLocker.Requests, but enums in this codebase are consistently placed under namespace LootLocker.LootLockerEnums (e.g., LootLockerNotificationPriority, LootLockerCatalogEntryEntityKind). Consider moving this enum to LootLocker.LootLockerEnums for consistency and discoverability, then update references accordingly.
- Use Mathf.Max instead of Math.Max (float overload issue) - Move LootLockerAsyncPurchaseStatus enum to LootLocker.LootLockerEnums namespace for consistency
Summary
Implements async purchase support for lootlocker/index#1369.
The server-side work is already complete. This PR adds SDK support for the async purchase flow: initiate a purchase, poll its status, and handle the final active/failed outcome — with full auto-polling using the same architecture as the Remote Session feature.
Changes
Runtime/Client/LootLockerEndPoints.csPurchaseheader:initiateAsyncPurchase—POST purchase/inspired-ibex/v1pollAsyncPurchaseStatus—GET purchase/inspired-ibex/v1/{0}retryAsyncPurchase—POST purchase/inspired-ibex/v1/{0}/retryRuntime/Game/Requests/PurchaseRequest.csLootLockerAsyncPurchaseStatusenum (pending,active,failed),LootLockerAsyncPurchaseInitiatedResponse,LootLockerAsyncPurchaseStatusResponseLootLockerAPIManagermethods:InitiateAsyncPurchase,GetAsyncPurchaseStatus,RetryAsyncPurchaseAsyncPurchasePoller : MonoBehaviour, ILootLockerService— coroutine-based auto-polling with:Guid-keyed process dictionaryStatusUpdateCallbackon each pending poll,CompletedCallbackon active/failed/timeout/cancelLootLockerLifecycleManagerRuntime/Game/LootLockerSDKManager.cs#region Purchasingsection:InitiateAsyncPurchaseSingleCatalogItemInitiateAsyncPurchaseCatalogItemsGetAsyncPurchaseStatusRetryAsyncPurchaseInitiateAndPollAsyncPurchaseSingleCatalogItemInitiateAndPollAsyncPurchaseCatalogItems(returnsGuidprocess handle)CancelAsyncPurchasePollingTesting
Compile Check passed ✅ on this branch.