using UnityEngine.Purchasing.Extension;
namespace UnityEngine.Purchasing
{
///
/// This class is an extension class on IStoreCallback to add the functionality to FindProductById
///
public static class StoreCallbackExtensionMethods
{
///
/// Find a product by it's product ID or StoreSpecificID
///
/// The StoreCallback to extend
/// The ID to search
/// Returns the product with the ID or null
public static Product FindProductById(this IStoreCallback storeCallback, string sku)
{
if (sku != null && storeCallback.products != null)
{
return storeCallback.products.WithID(sku) ?? storeCallback.products.WithStoreSpecificID(sku);
}
return null;
}
}
}