Search in sources :

Example 1 with MarketPurchaseCancelledEvent

use of com.soomla.store.events.MarketPurchaseCancelledEvent in project android-store by soomla.

the class SoomlaStore method handleCancelledPurchase.

/**
     * Handles a cancelled purchase by either posting an event containing a
     * <code>PurchasableVirtualItem</code> corresponding to the given purchase, or an unexpected
     * error event if the item was not found.
     *
     * @param purchase cancelled purchase to handle.
     */
private void handleCancelledPurchase(IabPurchase purchase) {
    String sku = purchase.getSku();
    try {
        PurchasableVirtualItem v = StoreInfo.getPurchasableItem(sku);
        BusProvider.getInstance().post(new MarketPurchaseCancelledEvent(v));
    } catch (VirtualItemNotFoundException e) {
        SoomlaUtils.LogError(TAG, "(purchaseActionResultCancelled) ERROR : Couldn't find the " + "VirtualCurrencyPack OR MarketItem  with productId: " + sku + ". It's unexpected so an unexpected error is being emitted.");
        BusProvider.getInstance().post(new UnexpectedStoreErrorEvent());
    }
}
Also used : PurchasableVirtualItem(com.soomla.store.domain.PurchasableVirtualItem) VirtualItemNotFoundException(com.soomla.store.exceptions.VirtualItemNotFoundException) MarketPurchaseCancelledEvent(com.soomla.store.events.MarketPurchaseCancelledEvent) UnexpectedStoreErrorEvent(com.soomla.store.events.UnexpectedStoreErrorEvent)

Aggregations

PurchasableVirtualItem (com.soomla.store.domain.PurchasableVirtualItem)1 MarketPurchaseCancelledEvent (com.soomla.store.events.MarketPurchaseCancelledEvent)1 UnexpectedStoreErrorEvent (com.soomla.store.events.UnexpectedStoreErrorEvent)1 VirtualItemNotFoundException (com.soomla.store.exceptions.VirtualItemNotFoundException)1