Exemplo n.º 1
0
  // called from buyPage
  public void buyApplication(String appName, String relName, String sequence, String price) {
    if (!activity.configData.hasPayments) return;

    PayMobiPayments payMobi = activity.payMobi;
    if (payMobi.bPaying) return;
    payMobi.bPaying = true;

    String permission = "payments." + appName;
    SharedPreferences prefs =
        AppMobiActivity.sharedActivity.getSharedPreferences(
            AppInfo.APP_PREFS, Context.MODE_PRIVATE);
    boolean approved = prefs.getBoolean(permission, false);

    // lookup bookmark
    Bookmark bookmark = activity.getBookmarkForAppName(appName);

    if (false && bookmark.isDeleted && bookmark.isAuthorized) {
      rebuyApp();
      payMobi.bPaying = false;
      return;
    }

    if (approved) {
      buyApplicationInternal(appName, relName, sequence, price);
    } else {
      this.payEvent =
          new PaymentEvent(
              PaymentEventType.BUYAPPLICATION,
              Arrays.asList(new String[] {appName, relName, sequence, price}));
      approvePayments();
    }
  }
Exemplo n.º 2
0
 public void buyApplicationInternal(
     String appName, String relName, String sequence, String price) {
   PayMobiPayments payMobi = activity.payMobi;
   payMobi.bBuying = true;
   payMobi.initializePaymentsForAppAndRel(
       sequence,
       appName,
       relName,
       price,
       activity.configData,
       webview); // TODO: should be an appMobiWebView
 }