本文整理汇总了Java中com.anjlab.android.iab.v3.TransactionDetails类的典型用法代码示例。如果您正苦于以下问题:Java TransactionDetails类的具体用法?Java TransactionDetails怎么用?Java TransactionDetails使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransactionDetails类属于com.anjlab.android.iab.v3包,在下文中一共展示了TransactionDetails类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapTransactionDetails
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
private WritableMap mapTransactionDetails(TransactionDetails details) {
WritableMap map = Arguments.createMap();
map.putString("receiptData", details.purchaseInfo.responseData.toString());
if (details.purchaseInfo.signature != null)
map.putString("receiptSignature", details.purchaseInfo.signature.toString());
PurchaseData purchaseData = details.purchaseInfo.purchaseData;
map.putString("productId", purchaseData.productId);
map.putString("orderId", purchaseData.orderId);
map.putString("purchaseToken", purchaseData.purchaseToken);
map.putString("purchaseTime", purchaseData.purchaseTime == null
? "" : purchaseData.purchaseTime.toString());
map.putString("purchaseState", purchaseData.purchaseState == null
? "" : purchaseData.purchaseState.toString());
if (purchaseData.developerPayload != null)
map.putString("developerPayload", purchaseData.developerPayload);
return map;
}
示例2: onProductPurchased
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override
public void onProductPurchased(String productId, TransactionDetails details) {
/*
* Called when requested PRODUCT ID was successfully purchased
*/
ProductPurchasedCallback callback = mProductPurchaseCallbacks.get(productId);
if (callback != null) {
Log.d("Billing", "Product purchased " + productId + " details: " + details);
int result = callback.onProductPurchased(productId, details);
mProductPurchaseCallbacks.remove(productId);
if (result == ProductPurchasedCallback.CONSUME_PRODUCT) {
if (!mBP.consumePurchase(productId)) {
Log.e("Billing", "Product consuming failed!");
}
}
}
}
示例3: onCreate
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ShowBackButton();
setContentView(R.layout.activity_donate);
bp = new BillingProcessor(DonateActivity.this, LICENSE_KEY, new BillingProcessor.IBillingHandler() {
@Override
public void onProductPurchased(String productId, TransactionDetails details) {
//DBHelper.ShowToastT(DonateActivity.this, "onProductPurchased: " + productId, Toast.LENGTH_LONG);
refreshPurchasesStatus();
}
@Override
public void onBillingError(int errorCode, Throwable error) {
// DBHelper.ShowToastT(DonateActivity.this, "onBillingError: " + Integer.toString(errorCode), Toast.LENGTH_LONG);
refreshPurchasesStatus();
}
@Override
public void onBillingInitialized() {
readyToPurchase = true;
DonatePriceTextLoadAsyncTask mt = new DonatePriceTextLoadAsyncTask();
mt.execute();
}
@Override
public void onPurchaseHistoryRestored() {
//DBHelper.ShowToastT(DonateActivity.this, "onPurchaseHistoryRestored", Toast.LENGTH_LONG);
refreshPurchasesStatus();
}
});
// ListView on Fragments
DonateListFragment fragment = new DonateListFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.frgmCont, fragment).commit();
}
示例4: onProductPurchased
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override
public void onProductPurchased(String productId, TransactionDetails details) {
L.i("onProductPurchased");
if (productId.equals(SKU_PRO)) {
afterPayment();
}
}
示例5: onProductPurchased
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override
public void onProductPurchased(String productId, TransactionDetails details) {
/*
* Called when requested PRODUCT ID was successfully purchased
*/
bp.consumePurchase(productId);
}
示例6: onProductPurchased
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override
public void onProductPurchased(String productId, TransactionDetails details) {
// Called when requested PRODUCT ID was successfully purchased
Analytics.newEvent("in-app purchase").put("product_id", productId).log();
if (productId.equals(Monetize.decrypt(Monetize.ENCRYPTED_REMOVE_ADS_PRODUCT_ID))) {
Monetize.removeAds();
EventBus.getDefault().post(new Monetize.Event.OnAdsRemovedEvent());
}
}
示例7: onProductPurchased
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override
public void onProductPurchased(String productId, TransactionDetails details) {
if (details != null && productId.equals(details.purchaseInfo.purchaseData.productId))
{
try {
WritableMap map = mapTransactionDetails(details);
resolvePromise(PromiseConstants.PURCHASE_OR_SUBSCRIBE, map);
} catch (Exception ex) {
rejectPromise(PromiseConstants.PURCHASE_OR_SUBSCRIBE, "Failure on purchase or subscribe callback: " + ex.getMessage());
}
} else {
rejectPromise(PromiseConstants.PURCHASE_OR_SUBSCRIBE, "Failure on purchase or subscribe callback. Details were empty.");
}
}
示例8: getPurchaseTransactionDetails
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@ReactMethod
public void getPurchaseTransactionDetails(final String productId, final Promise promise) {
if (bp != null) {
TransactionDetails details = bp.getPurchaseTransactionDetails(productId);
if (details != null && productId.equals(details.purchaseInfo.purchaseData.productId))
{
WritableMap map = mapTransactionDetails(details);
promise.resolve(map);
} else {
promise.reject("EUNSPECIFIED", "Could not find transaction details for productId.");
}
} else {
promise.reject("EUNSPECIFIED", "Channel is not opened. Call open() on InAppBilling.");
}
}
示例9: getSubscriptionTransactionDetails
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@ReactMethod
public void getSubscriptionTransactionDetails(final String productId, final Promise promise) {
if (bp != null) {
TransactionDetails details = bp.getSubscriptionTransactionDetails(productId);
if (details != null && productId.equals(details.purchaseInfo.purchaseData.productId))
{
WritableMap map = mapTransactionDetails(details);
promise.resolve(map);
} else {
promise.reject("EUNSPECIFIED", "Could not find transaction details for productId.");
}
} else {
promise.reject("EUNSPECIFIED", "Channel is not opened. Call open() on InAppBilling.");
}
}
示例10: onProductPurchased
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override
public void onProductPurchased(String productId, TransactionDetails details) {
Toast.makeText(this, R.string.thank_you_donation, Toast.LENGTH_SHORT).show();
if (bp != null) {
bp.consumePurchase(productId);
}
}
示例11: onProductPurchased
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override
public void onProductPurchased(@NonNull String productId, @Nullable TransactionDetails details) {
Toast.makeText(this, R.string.thank_you, Toast.LENGTH_SHORT).show();
setResult(RESULT_OK);
if (!BuildConfig.DEBUG) {
Answers.getInstance().logPurchase(new PurchaseEvent()
.putCurrency(Currency.getInstance("EUR"))
.putItemPrice(BigDecimal.valueOf(3))
.putItemId("pro_version")
.putSuccess(true)
.putItemName("Phonograph Pro"));
}
}
示例12: onProductPurchased
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override
public int onProductPurchased(String productId, TransactionDetails details) {
if (!TextUtils.isEmpty(productId) && productId.equals(mGoogleProductId)) {
mPurse.purchaseCurrency(mKey, mGainedCurrency);
if (mListener != null) {
mListener.onArticleChanged(PurchaseCurrencyArticle.this);
}
return StoreActivity.ProductPurchasedCallback.CONSUME_PRODUCT;
}
return StoreActivity.ProductPurchasedCallback.DO_NOTHING;
}
示例13: onProductPurchased
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override
public void onProductPurchased(String s, TransactionDetails transactionDetails) {
Gdx.app.log(TAG, "onProductPurchased : " + transactionDetails.orderId + ", " + transactionDetails.purchaseInfo.responseData);
for (StoreListener storeListener : storeListeners) {
storeListener.transactionCompleted(transactionDetails.productId);
}
}
示例14: onProductPurchased
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override
public void onProductPurchased(String productId, TransactionDetails details) {
Timber.v("%s purchased.", productId);
SnackbarHandler.showInfoSnackbar(this, coordinatorLayout, "Thanks for helping keep the gears turning!");
animatePurchase();
Products product = SupporterHelper.getProduct(productId);
getRealm().beginTransaction();
getRealm().copyToRealmOrUpdate(product);
getRealm().commitTransaction();
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("weather", true);
editor.apply();
Analytics.from(this).sendPurchaseEvent(product, productId);
}
示例15: onProductPurchased
import com.anjlab.android.iab.v3.TransactionDetails; //导入依赖的package包/类
@Override public void onProductPurchased(String productId, TransactionDetails details) {
if (details != null && details.productId.contains("donation_sub_")) {
// we can not consume subscriptions
return;
}
// Consume asap purchased to allow multiple donations
mBillingProcessor.consumePurchase(productId);
}