예제 #1
0
  public void ClickedContinueButton(View view) {
    Log.d(TAG, "ClickedContinueButton");

    if (!orderInfo.isContactInfoCompleted()) {
      Toast.makeText(
              getApplicationContext(),
              getResources().getString(R.string.missingregistrationinfo),
              Toast.LENGTH_SHORT)
          .show();
      return;
    }

    if (Global.isUserLoggedIn(mContext)) {
      Global.setUserSharedPreferences(mContext, orderInfo);
    }

    /*
     * PAYMENT_INTENT_SALE will cause the payment to complete immediately.
     * Change PAYMENT_INTENT_SALE to PAYMENT_INTENT_AUTHORIZE to only
     * authorize payment and capture funds later.
     *
     * Also, to include additional payment details and an item list, see
     * getStuffToBuy() below.
     */
    PayPalPayment thingToBuy = getThingToBuy(PayPalPayment.PAYMENT_INTENT_SALE);

    Intent intent = new Intent(mContext, PaymentActivity.class);

    intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);

    startActivityForResult(intent, REQUEST_CODE_PAYMENT);
  }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.screen_quote);

    configSlidingMenu();

    initLayout();

    initOrderInfo();

    if (orderInfo == null) {
      Log.d(TAG, "orderInfo is null, restart application by calling login");
      Intent intent = new Intent(mContext, LoginActivity.class);
      mContext.startActivity(intent);
      finish();
    }
    if (Global.isUserLoggedIn(mContext)) {
      refreshDisplay();
    }

    Intent intent = new Intent(this, PayPalService.class);
    intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
    startService(intent);
  }
예제 #3
0
  private void initOrderInfo() {

    orderInfo = ((Global) getApplication()).orderInfo;

    if (Global.isUserLoggedIn(mContext)) {
      if (orderInfo == null) {
        Log.d(TAG, "orderInfo is null, restart application by calling login");
        Intent intent = new Intent(mContext, LoginActivity.class);
        mContext.startActivity(intent);
        finish();
      } else {
        orderInfo.refreshTransactionAge();
        refreshDisplay();
      }
    } else {
      if (orderInfo == null) {
        Log.d(TAG, "orderInfo is null, restart application by calling login");
        Intent intent = new Intent(mContext, LoginActivity.class);
        mContext.startActivity(intent);
        finish();
      } else {
        orderInfo.refreshTransactionAge();
      }
    }
  }
예제 #4
0
  public void onResume() {
    super.onResume();
    Log.d(TAG, "OnResume called");

    if (Global.isForceExiting(mContext)) {
      Log.d(TAG, "force exiting");
      finish();
    }

    refreshDisplay();

    if (orderInfo == null) {
      Intent intent = new Intent(mContext, LoginActivity.class);
      mContext.startActivity(intent);
      this.finish();
    }
  }