Android Open Source - Planets-Gradle Purchase






From Project

Back to project page Planets-Gradle.

License

The source code is released under:

Apache License

If you think the Android project Planets-Gradle listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/* Copyright (c) 2012 Google Inc.
 *//from  ww  w. j  av  a 2 s  .  com
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.andrewq.planets.iab;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Represents an in-app billing purchase.
 */
public class Purchase {
    String mItemType;  // ITEM_TYPE_INAPP or ITEM_TYPE_SUBS
    String mOrderId;
    String mPackageName;
    String mSku;
    long mPurchaseTime;
    int mPurchaseState;
    String mDeveloperPayload;
    String mToken;
    String mOriginalJson;
    String mSignature;

    public Purchase(String itemType, String jsonPurchaseInfo, String signature) throws JSONException {
        mItemType = itemType;
        mOriginalJson = jsonPurchaseInfo;
        JSONObject o = new JSONObject(mOriginalJson);
        mOrderId = o.optString("orderId");
        mPackageName = o.optString("packageName");
        mSku = o.optString("productId");
        mPurchaseTime = o.optLong("purchaseTime");
        mPurchaseState = o.optInt("purchaseState");
        mDeveloperPayload = o.optString("developerPayload");
        mToken = o.optString("token", o.optString("purchaseToken"));
        mSignature = signature;
    }

    public String getItemType() {
        return mItemType;
    }

    public String getOrderId() {
        return mOrderId;
    }

    public String getPackageName() {
        return mPackageName;
    }

    public String getSku() {
        return mSku;
    }

    public long getPurchaseTime() {
        return mPurchaseTime;
    }

    public int getPurchaseState() {
        return mPurchaseState;
    }

    public String getDeveloperPayload() {
        return mDeveloperPayload;
    }

    public String getToken() {
        return mToken;
    }

    public String getOriginalJson() {
        return mOriginalJson;
    }

    public String getSignature() {
        return mSignature;
    }

    @Override
    public String toString() {
        return "PurchaseInfo(type:" + mItemType + "):" + mOriginalJson;
    }
}




Java Source Code List

com.andrewq.planets.MainActivity.java
com.andrewq.planets.iab.Base64DecoderException.java
com.andrewq.planets.iab.Base64.java
com.andrewq.planets.iab.IabException.java
com.andrewq.planets.iab.IabHelper.java
com.andrewq.planets.iab.IabResult.java
com.andrewq.planets.iab.Inventory.java
com.andrewq.planets.iab.Purchase.java
com.andrewq.planets.iab.Security.java
com.andrewq.planets.iab.SkuDetails.java
com.andrewq.planets.image_views.DeimosImageView.java
com.andrewq.planets.image_views.EarthImageView.java
com.andrewq.planets.image_views.EuropaImageView.java
com.andrewq.planets.image_views.JupiterImageView.java
com.andrewq.planets.image_views.MarsImageView.java
com.andrewq.planets.image_views.MercuryImageView.java
com.andrewq.planets.image_views.MoonImageView.java
com.andrewq.planets.image_views.NeptuneImageView.java
com.andrewq.planets.image_views.PhobosImageView.java
com.andrewq.planets.image_views.PlutoImageView.java
com.andrewq.planets.image_views.SaturnImageView.java
com.andrewq.planets.image_views.SunImageView.java
com.andrewq.planets.image_views.UranusImageView.java
com.andrewq.planets.image_views.VenusImageView.java
com.andrewq.planets.misc.Settings.java
com.andrewq.planets.moons.DeimosActivity.java
com.andrewq.planets.moons.EuropaActivity.java
com.andrewq.planets.moons.MoonActivity.java
com.andrewq.planets.moons.PhobosActivity.java
com.andrewq.planets.other_bodies.PlutoActivity.java
com.andrewq.planets.other_bodies.SunActivity.java
com.andrewq.planets.planets.EarthActivity.java
com.andrewq.planets.planets.JupiterActivity.java
com.andrewq.planets.planets.MarsActivity.java
com.andrewq.planets.planets.MercuryActivity.java
com.andrewq.planets.planets.NeptuneActivity.java
com.andrewq.planets.planets.SaturnActivity.java
com.andrewq.planets.planets.UranusActivity.java
com.andrewq.planets.planets.VenusActivity.java
com.andrewq.planets.tv.ApplicationTest.java
com.andrewq.planets.tv.CardPresenter.java
com.andrewq.planets.tv.DetailsActivity.java
com.andrewq.planets.tv.DetailsDescriptionPresenter.java
com.andrewq.planets.tv.PicassoBackgroundManagerTarget.java
com.andrewq.planets.tv.Planet.java
com.andrewq.planets.tv.PlanetsFragment.java
com.andrewq.planets.tv.PlanetsList.java
com.andrewq.planets.tv.PlayerActivity.java
com.andrewq.planets.tv.SettingsActivity.java
com.andrewq.planets.tv.TvActivity.java
com.andrewq.planets.tv.Utils.java
com.andrewq.planets.tv.VideoDetailsFragment.java
com.andrewq.planets.util.NotifyingScrollView.java
com.andrewq.planets.util.RowItem.java
com.andrewq.planets.util.SquareImageView.java
com.andrewq.planets.util.ZoomOutPageTransformer.java