use of com.litekite.monetize.room.entity.BillingPurchaseDetails in project Android-InAppBilling by LiteKite.
the class BillingManager method storePurchaseResultsLocally.
/**
* Stores Purchase Details on local storage.
*
* @param purchases list of Purchase Details returned from the queries.
*/
private void storePurchaseResultsLocally(List<Purchase> purchases) {
final List<BillingPurchaseDetails> billingPurchaseDetailsList = new ArrayList<>();
for (Purchase purchase : purchases) {
BillingPurchaseDetails billingPurchaseDetails = new BillingPurchaseDetails();
billingPurchaseDetails.purchaseToken = purchase.getPurchaseToken();
billingPurchaseDetails.orderID = purchase.getOrderId();
billingPurchaseDetails.skuID = purchase.getSkus().stream().findFirst().orElse("");
billingPurchaseDetails.purchaseTime = purchase.getPurchaseTime();
billingPurchaseDetailsList.add(billingPurchaseDetails);
}
workExecutor.execute(() -> appDatabase.insertPurchaseDetails(billingPurchaseDetailsList));
}
use of com.litekite.monetize.room.entity.BillingPurchaseDetails in project Android-InAppBilling by LiteKite.
the class BillingManager method storePurchaseHistoryRecordsLocally.
/**
* Stores Purchase Details on local storage.
*
* @param purchases list of Purchase Details returned from the queries.
*/
private void storePurchaseHistoryRecordsLocally(List<PurchaseHistoryRecord> purchases) {
final List<BillingPurchaseDetails> billingPurchaseDetailsList = new ArrayList<>();
for (PurchaseHistoryRecord purchase : purchases) {
BillingPurchaseDetails billingPurchaseDetails = new BillingPurchaseDetails();
billingPurchaseDetails.purchaseToken = purchase.getPurchaseToken();
billingPurchaseDetails.skuID = purchase.getSkus().stream().findFirst().orElse("");
billingPurchaseDetails.purchaseTime = purchase.getPurchaseTime();
billingPurchaseDetailsList.add(billingPurchaseDetails);
}
workExecutor.execute(() -> appDatabase.insertPurchaseDetails(billingPurchaseDetailsList));
}
Aggregations