@Test public void isConsumedForConsumablePurchase() { defaultInAppPurchaseConsumer.isConsumed(consumablePurchase, PurchaseFamily.Ocr); verify(consumableInAppPurchaseConsumer).isConsumed(consumablePurchase, PurchaseFamily.Ocr); verifyZeroInteractions(subscriptionInAppPurchaseConsumer); }
@Override public boolean isConsumed(@NonNull ManagedProduct managedProduct, @NonNull PurchaseFamily purchaseFamily) { if (managedProduct instanceof ConsumablePurchase) { return consumableInAppPurchaseConsumer.isConsumed((ConsumablePurchase)managedProduct, purchaseFamily); } else if (managedProduct instanceof Subscription) { return subscriptionInAppPurchaseConsumer.isConsumed((Subscription)managedProduct, purchaseFamily); } else { throw new IllegalArgumentException("Unsupported managed product type: " + managedProduct); } }
DefaultInAppPurchaseConsumer implements InAppPurchaseConsumer<ManagedProduct> { @Override public boolean isConsumed(@NonNull ManagedProduct managedProduct, @NonNull PurchaseFamily purchaseFamily) { if (managedProduct instanceof ConsumablePurchase) { return consumableInAppPurchaseConsumer.isConsumed((ConsumablePurchase)managedProduct, purchaseFamily); } else if (managedProduct instanceof Subscription) { return subscriptionInAppPurchaseConsumer.isConsumed((Subscription)managedProduct, purchaseFamily); } else { throw new IllegalArgumentException("Unsupported managed product type: " + managedProduct); } } }
DefaultInAppPurchaseConsumer implements InAppPurchaseConsumer<ManagedProduct> { @Override public boolean isConsumed(@NonNull ManagedProduct managedProduct, @NonNull PurchaseFamily purchaseFamily) { if (managedProduct instanceof ConsumablePurchase) { return consumableInAppPurchaseConsumer.isConsumed((ConsumablePurchase)managedProduct, purchaseFamily); } else if (managedProduct instanceof Subscription) { return subscriptionInAppPurchaseConsumer.isConsumed((Subscription)managedProduct, purchaseFamily); } else { throw new IllegalArgumentException("Unsupported managed product type: " + managedProduct); } } @Inject  DefaultInAppPurchaseConsumer(@NonNull ConsumableInAppPurchaseConsumer consumableInAppPurchaseConsumer,
                                        @NonNull SubscriptionInAppPurchaseConsumer subscriptionInAppPurchaseConsumer); }
DefaultInAppPurchaseConsumer implements InAppPurchaseConsumer<ManagedProduct> { @Override public boolean isConsumed(@NonNull ManagedProduct managedProduct, @NonNull PurchaseFamily purchaseFamily) { if (managedProduct instanceof ConsumablePurchase) { return consumableInAppPurchaseConsumer.isConsumed((ConsumablePurchase)managedProduct, purchaseFamily); } else if (managedProduct instanceof Subscription) { return subscriptionInAppPurchaseConsumer.isConsumed((Subscription)managedProduct, purchaseFamily); } else { throw new IllegalArgumentException("Unsupported managed product type: " + managedProduct); } } @Inject  DefaultInAppPurchaseConsumer(@NonNull ConsumableInAppPurchaseConsumer consumableInAppPurchaseConsumer,
                                        @NonNull SubscriptionInAppPurchaseConsumer subscriptionInAppPurchaseConsumer); @Override boolean isConsumed(@NonNull ManagedProduct managedProduct, @NonNull PurchaseFamily purchaseFamily); @Override Completable consumePurchase(@NonNull ManagedProduct managedProduct, @NonNull PurchaseFamily purchaseFamily); }
DefaultInAppPurchaseConsumer implements InAppPurchaseConsumer<ManagedProduct> { @Override public boolean isConsumed(@NonNull ManagedProduct managedProduct, @NonNull PurchaseFamily purchaseFamily) { if (managedProduct instanceof ConsumablePurchase) { return consumableInAppPurchaseConsumer.isConsumed((ConsumablePurchase)managedProduct, purchaseFamily); } else if (managedProduct instanceof Subscription) { return subscriptionInAppPurchaseConsumer.isConsumed((Subscription)managedProduct, purchaseFamily); } else { throw new IllegalArgumentException("Unsupported managed product type: " + managedProduct); } } @Inject  DefaultInAppPurchaseConsumer(@NonNull ConsumableInAppPurchaseConsumer consumableInAppPurchaseConsumer,
                                        @NonNull SubscriptionInAppPurchaseConsumer subscriptionInAppPurchaseConsumer); @Override boolean isConsumed(@NonNull ManagedProduct managedProduct, @NonNull PurchaseFamily purchaseFamily); @Override Completable consumePurchase(@NonNull ManagedProduct managedProduct, @NonNull PurchaseFamily purchaseFamily);  }