class SubscriptionInAppPurchaseConsumer implements InAppPurchaseConsumer<Subscription> {

    @Override
    public boolean isConsumed(@NonNull Subscription managedProduct, @NonNull PurchaseFamily purchaseFamily) {
        final Set<String> consumedSubscriptionSkuSet = sharedPreferences.get().getStringSet(KEY_CONSUMED_SUBSCRIPTION_SET, Collections.emptySet());
        for (final String sku : consumedSubscriptionSkuSet) {
            if (managedProduct.getInAppPurchase().equals(InAppPurchase.from(sku))) {
                final String family = sharedPreferences.get().getString(getPurchaseFamilyKey(sku), "");
                if (purchaseFamily.name().equals(family)) {
                    return true;
                }
            }
        }
        return false;
    }

    @Inject public  SubscriptionInAppPurchaseConsumer(@NonNull Lazy<SharedPreferences> preferences);

}