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();
      }
    }
  }
 private PayPalPayment getThingToBuy(String environment) {
   return new PayPalPayment(
       new BigDecimal(Double.toString(orderInfo.getEstimatedCost())),
       "USD",
       orderInfo.getPayPalItemDescription(),
       environment);
 }
  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);
  }
  private void refreshDisplay() {
    if (orderInfo != null) {

      price.setText(orderInfo.getEstimatedCostAsString());
      time.setText("estimated time will be " + orderInfo.getEstimatedTimeAsString());

      if (orderInfo.isContactInfoCompleted() && !orderInfo.isContactInfoEmpty()) {
        String displayText = orderInfo.getCustomerContactName() + '\n';
        displayText += orderInfo.getCustomerEmail() + '\n';
        displayText += orderInfo.getCustomerPhone();

        registrationButton.setSingleLine(false);
        registrationButton.setText(displayText);
      } else {
        registrationButton.setSingleLine(true);
        registrationButton.setText(R.string.quote_registration_button_text);
      }
    } else {
      Intent intent = new Intent(mContext, LoginActivity.class);
      mContext.startActivity(intent);
      this.finish();
    }
  }