Android Open Source - gdx-pay Purchase Manager Config






From Project

Back to project page gdx-pay.

License

The source code is released under:

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUC...

If you think the Android project gdx-pay 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 2011 See AUTHORS file./*from   ww w . j a v  a 2s. co  m*/
 * 
 * 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.badlogic.gdx.pay;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/** This configuration is set in your "core"-project and will be passed on to the active InApp store automatically.
 * The configuration for offers can be updated on the fly, e.g. by downloading the lastest offers from your server
 * if you have one setup.
 * @author noblemaster */
public class PurchaseManagerConfig {

  // available store names (not even sure what all those are!?)
  public static final String STORE_NAME_ANDROID_GOOGLE = "GooglePlay";
  public static final String STORE_NAME_ANDROID_AMAZON = "Amazon";
  public static final String STORE_NAME_ANDROID_SAMSUNG = "Samsung";
  public static final String STORE_NAME_ANDROID_NOKIA = "Nokia";
  public static final String STORE_NAME_ANDROID_SLIDEME = "SlideME";
  public static final String STORE_NAME_ANDROID_APTOIDE = "Aptoide";
  public static final String STORE_NAME_ANDROID_APPLAND = "Appland";
  public static final String STORE_NAME_ANDROID_YANDEX = "Yandex";
  public static final String STORE_NAME_ANDROID_OUYA = "OUYA";
  public static final String STORE_NAME_IOS_APPLE = "AppleiOS";
  public static final String STORE_NAME_DESKTOP_APPLE = "AppleMac";
  public static final String STORE_NAME_DESKTOP_STEAM = "Steam";
  public static final String STORE_NAME_DESKTOP_WINDOWS = "Windows";
  public static final String STORE_NAME_GWT_GOOGLEWALLET = "GwtGoogleWallet";

  /** Our list of purchaseable products. */
  private List<Offer> offers;

  /** The store-specific parameters where needed. */
  private Map<String, Object> storeParams;

  public PurchaseManagerConfig () {
    offers = new ArrayList<Offer>(16);
    storeParams = new HashMap<String, Object>(16);
  }

  public synchronized void addOffer (Offer offer) {
    offers.add(offer);
  }

  public synchronized Offer getOffer (String identifier) {
    // search matching offer and return it
    for (int i = 0; i < offers.size(); i++) {
      if (offers.get(i).getIdentifier().equals(identifier)) {
        return offers.get(i);
      }
    }

    // no matching offer found
    return null;
  }

  public synchronized Offer getOfferForStore (String storeName, String identifierForStore) {
        // search matching offer and return it
        for (int i = 0; i < offers.size(); i++) {
            if (offers.get(i).getIdentifierForStore(storeName).equals(identifierForStore)) {
                return offers.get(i);
            }
        }
      
      // no matching offer found
      return null;
  }
  
  public synchronized Offer getOffer (int index) {
    return offers.get(index);
  }

  public synchronized int getOfferCount () {
    return offers.size();
  }

  /** Adds a parameter for a store.
   * 
   * @param storeName The name of the store.
   * @param param The store parameters to use. This could be a string or byte-array etc. depending on what that store needs to
   *           initialize. */
  public synchronized void addStoreParam (String storeName, Object param) {
    storeParams.put(storeName, param);
  }

  /** Returns parameters for a store.
   * 
   * @param storeName The name of the store.
   * @return The store parameters or null if there where none. This could be a string or byte-array etc. depending on what that
   *         store needs to initialize. */
  public synchronized Object getStoreParam (String storeName) {
    return storeParams.get(storeName);
  }
}




Java Source Code List

com.badlogic.gdx.pay.Information.java
com.badlogic.gdx.pay.OfferType.java
com.badlogic.gdx.pay.Offer.java
com.badlogic.gdx.pay.PurchaseManagerConfig.java
com.badlogic.gdx.pay.PurchaseManager.java
com.badlogic.gdx.pay.PurchaseObserver.java
com.badlogic.gdx.pay.PurchaseSystem.java
com.badlogic.gdx.pay.Transaction.java
com.badlogic.gdx.pay.android.IAP.java
com.badlogic.gdx.pay.android.amazon.PurchaseManagerAndroidAmazon.java
com.badlogic.gdx.pay.android.openiab.PurchaseManagerAndroidOpenIAB.java
com.badlogic.gdx.pay.android.ouya.PurchaseManagerAndroidOUYA.java
com.badlogic.gdx.pay.desktop.apple.PurchaseManagerDesktopApple.java
com.badlogic.gdx.pay.gwt.googlewallet.PurchaseManagerGwtGoogleWallet.java
com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple.java
com.badlogic.gdx.pay.server.PurchaseVerifierManager.java
com.badlogic.gdx.pay.server.PurchaseVerifier.java
com.badlogic.gdx.pay.server.impl.PurchaseVerifierAndroidAmazon.java
com.badlogic.gdx.pay.server.impl.PurchaseVerifierAndroidGoogle.java
com.badlogic.gdx.pay.server.impl.PurchaseVerifieriOSApple.java
com.badlogic.gdx.pay.server.util.Base64Util.java