using System; using Oculus.Platform.Models; using UnityEngine; namespace Oculus.Platform { public static class IAP { public static Request ConsumePurchase(string sku) { if (Core.IsInitialized()) { return new Request(CAPI.ovr_IAP_ConsumePurchase(sku)); } return null; } public static Request GetProductsBySKU(string[] skus) { if (Core.IsInitialized()) { return new Request(CAPI.ovr_IAP_GetProductsBySKU(skus, (skus != null) ? skus.Length : 0)); } return null; } public static Request GetViewerPurchases() { if (Core.IsInitialized()) { return new Request(CAPI.ovr_IAP_GetViewerPurchases()); } return null; } public static Request LaunchCheckoutFlow(string sku) { if (Core.IsInitialized()) { if (UnityEngine.Application.isEditor) { throw new NotImplementedException("LaunchCheckoutFlow() is not implemented in the editor yet."); } return new Request(CAPI.ovr_IAP_LaunchCheckoutFlow(sku)); } return null; } public static Request GetNextProductListPage(ProductList list) { if (!list.HasNextPage) { Debug.LogWarning("Oculus.Platform.GetNextProductListPage: List has no next page"); return null; } if (Core.IsInitialized()) { return new Request(CAPI.ovr_HTTP_GetWithMessageType(list.NextUrl, 467225263)); } return null; } public static Request GetNextPurchaseListPage(PurchaseList list) { if (!list.HasNextPage) { Debug.LogWarning("Oculus.Platform.GetNextPurchaseListPage: List has no next page"); return null; } if (Core.IsInitialized()) { return new Request(CAPI.ovr_HTTP_GetWithMessageType(list.NextUrl, 1196886677)); } return null; } } }