#nullable enable using System; using System.Collections.Generic; namespace UnityEngine.Purchasing { /// /// Provides fake functionality for Apple specific APIs. /// /// Refresh receipt calls alternate between success and failure. /// class FakeAppleExtensions : IAppleExtensions { bool m_FailRefresh; public void RefreshAppReceipt(Action successCallback, Action errorCallback) { if (m_FailRefresh) { errorCallback("A fake error message"); } else { successCallback("A fake refreshed receipt!"); } m_FailRefresh = !m_FailRefresh; } [Obsolete("RefreshAppReceipt(Action successCallback, Action errorCallback) is deprecated, please use RefreshAppReceipt(Action successCallback, Action errorCallback) instead.")] public void RefreshAppReceipt(Action successCallback, Action errorCallback) { if (m_FailRefresh) { errorCallback(); } else { successCallback("A fake refreshed receipt!"); } m_FailRefresh = !m_FailRefresh; } [Obsolete("RestoreTransactions(Action callback) is deprecated, please use RestoreTransactions(Action callback) instead.")] public void RestoreTransactions(Action? callback) { callback?.Invoke(true); } public void RestoreTransactions(Action? callback) { callback?.Invoke(true, null); } public void RegisterPurchaseDeferredListener(Action callback) { } public bool simulateAskToBuy { get; set; } public void FetchStorePromotionOrder(Action> successCallback, Action errorCallback) { errorCallback(); } public void SetStorePromotionOrder(List products) { } public void FetchStorePromotionVisibility(Product product, Action successCallback, Action errorCallback) { errorCallback(); } public void SetStorePromotionVisibility(Product product, AppleStorePromotionVisibility visible) { } public void SetApplicationUsername(string applicationUsername) { } public string GetTransactionReceiptForProduct(Product product) { return ""; } public void ContinuePromotionalPurchases() { } public Dictionary GetIntroductoryPriceDictionary() { return new Dictionary(); } public Dictionary GetProductDetails() { return new Dictionary(); } public void PresentCodeRedemptionSheet() { } } }