use of com.soomla.store.events.MarketPurchaseEvent in project android-store by soomla.
the class SoomlaStore method finalizeTransaction.
private void finalizeTransaction(IabPurchase purchase, PurchasableVirtualItem pvi, boolean isRestoring) {
SoomlaUtils.LogDebug(TAG, "IabPurchase successful. Finalizing transaction");
// TODO: update on the issue in github
if (StoreInfo.isItemNonConsumable(pvi)) {
if (StorageManager.getVirtualItemStorage(pvi).getBalance(pvi.getItemId()) == 1) {
return;
}
}
String developerPayload = purchase.getDeveloperPayload();
final String token = purchase.getToken();
final String orderId = purchase.getOrderId();
final String originalJson = purchase.getOriginalJson();
final String signature = purchase.getSignature();
final String userId = purchase.getUserId();
BusProvider.getInstance().post(new MarketPurchaseEvent(pvi, isRestoring, developerPayload, new HashMap<String, String>() {
{
put("token", token);
put("orderId", orderId);
put("originalJson", originalJson);
put("signature", signature);
put("userId", userId);
}
}, null));
pvi.give(1);
BusProvider.getInstance().post(new ItemPurchasedEvent(pvi.getItemId(), isRestoring, developerPayload));
consumeIfConsumable(purchase, pvi);
}
Aggregations