using System; namespace UnityEngine.Purchasing { /// /// Mock implementation of the interface for UDP purchasing extensions. /// public class FakeUDPExtension : IUDPExtensions { /// /// Some stores return user information after initialization. /// /// UserInfo, which may be null public object GetUserInfo() { var udpUserInfo = UserInfoInterface.GetClassType(); if (udpUserInfo == null) { return null; } var userInfo = Activator.CreateInstance(udpUserInfo); var channelProp = UserInfoInterface.GetChannelProp(); channelProp.SetValue(userInfo, "Fake_Channel", null); var userIdProp = UserInfoInterface.GetIdProp(); userIdProp.SetValue(userInfo, "Fake_User_Id_123456", null); var loginTokenProp = UserInfoInterface.GetIdProp(); loginTokenProp.SetValue(userInfo, "Fake_Login_Token", null); return userInfo; } /// /// Return the UDP initialization error. /// /// The error as a string. public string GetLastInitializationError() { return "Fake Initialization Error"; } /// /// Gets the last purchase error. /// /// The error as a string. public string GetLastPurchaseError() { return "Fake Purchase Error"; } /// /// Enable debug log for UDP. /// /// Whether or not the logging is to be enabled. public void EnableDebugLog(bool enable) { return; } /// /// Called when a processing a purchase from UDP that is in the "OnPurchasePending" state. /// /// Action will be called with the product that is in the "OnPurchasePending" state. public void RegisterPurchaseDeferredListener(Action action) { } } }