@Override
  public void onClick(View v) {
    int i = v.getId();
    if (i == R.id.cancel_btn) {
      // activity.finish();
      dismiss();
    } else if (i == R.id.accept_btn) {
      try {

        lossProtectedWallet.send(
            cryptoAmount,
            destinationAddress,
            notes,
            appSession.getAppPublicKey(),
            lossProtectedWallet.getSelectedActorIdentity().getPublicKey(),
            Actors.INTRA_USER,
            deliveredByActorPublicKey,
            deliveredByActorType,
            ReferenceWallet.BASIC_WALLET_BITCOIN_WALLET,
            blockchainNetworkType,
            CryptoCurrency.BITCOIN,
            fee,
            feeOrigin);
      } catch (CantSendLossProtectedCryptoException e) {
        e.printStackTrace();
        Toast.makeText(this.activity, "Unexpected error", Toast.LENGTH_SHORT).show();
      } catch (LossProtectedInsufficientFundsException e) {
        e.printStackTrace();
        Toast.makeText(this.activity, "Not enough funds to perform action", Toast.LENGTH_SHORT)
            .show();
        /*    } catch (CantGetLossProtectedBalanceException e) {
                Toast.makeText(this.activity, "Unexpected error", Toast.LENGTH_SHORT).show();
        */ } catch (Exception e) {
        Toast.makeText(
                activity.getApplicationContext(),
                "oooopps, we have a problem here",
                Toast.LENGTH_SHORT)
            .show();
        e.printStackTrace();
      }

      Toast.makeText(this.activity, "Sending...", Toast.LENGTH_SHORT).show();
      dismiss();
    }
  }
  // TODO: check this and everything else that it is not needed anymore.
  @Override
  public void onClick(View v) {
    try {
      LossProtectedPaymentRequest paymentRequest = referenceWalletSession.getLastRequestSelected();
      int id = v.getId();
      if (id == R.id.btn_refuse_request) {

        cryptoWallet.refuseRequest(paymentRequest.getRequestId());
        Toast.makeText(getActivity(), "Denegado", Toast.LENGTH_SHORT).show();
      } else if (id == R.id.btn_accept_request) {
        cryptoWallet.approveRequest(
            paymentRequest.getRequestId(),
            referenceWalletSession.getIntraUserModuleManager().getPublicKey());
        Toast.makeText(getActivity(), "Aceptado", Toast.LENGTH_SHORT).show();
      }

    } catch (Exception e) {
      WalletUtils.showMessage(
          getActivity(), "Cant Accept or Denied Send Payment Exception- " + e.getMessage());
    }
  }
  @Override
  public NotificationPainter getNotificationPainter(FermatBundle fermatBundle) {
    try {
      LossProtectedWalletSettings lossProtectedWalletSettings;
      int notificationID = fermatBundle.getInt(NotificationBundleConstants.NOTIFICATION_ID);
      String involvedActor = fermatBundle.getString("InvolvedActor");
      long amount = Long.parseLong(String.valueOf(fermatBundle.get("Amount")));

      boolean enabledNotification = true;
      this.lossWalletSession = this.getFullyLoadedSession();
      if (lossWalletSession != null) {
        String walletPublicKey = lossWalletSession.getAppPublicKey();
        if (lossWalletSession.getModuleManager() != null) {
          moduleManager = lossWalletSession.getModuleManager();

          // enable notification settings

          lossProtectedWalletSettings = moduleManager.loadAndGetSettings(walletPublicKey);
          enabledNotification = lossProtectedWalletSettings.getNotificationEnabled();
        }

        if (enabledNotification)
          return LossProtectedWalletBuildNotificationPainter.getNotification(
              notificationID,
              involvedActor,
              amount,
              Activities.CWP_WALLET_RUNTIME_WALLET_LOSS_PROTECTED_WALLET_BITDUBAI_VERSION_1_MAIN
                  .getCode());
        else
          return new LossProtectedWalletNotificationPainter(
              "",
              "",
              "",
              "",
              false,
              Activities.CWP_WALLET_RUNTIME_WALLET_LOSS_PROTECTED_WALLET_BITDUBAI_VERSION_1_MAIN
                  .getCode());

      } else return null;
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
  @Override
  public List<LossProtectedWalletTransaction> getMoreDataAsync(
      FermatRefreshTypes refreshType, int pos) {
    List<LossProtectedWalletTransaction> list = new ArrayList<LossProtectedWalletTransaction>();

    try {
      // when refresh offset set 0
      if (refreshType.equals(FermatRefreshTypes.NEW)) offset = 0;

      LossProtectedWalletIntraUserIdentity intraUserLoginIdentity =
          referenceWalletSession.getIntraUserModuleManager();
      if (intraUserLoginIdentity != null) {
        String intraUserPk = intraUserLoginIdentity.getPublicKey();
        lst =
            cryptoWallet.listLastActorTransactionsByTransactionType(
                BalanceType.AVAILABLE,
                TransactionType.CREDIT,
                referenceWalletSession.getAppPublicKey(),
                intraUserPk,
                blockchainNetworkType,
                MAX_TRANSACTIONS,
                0);
        offset += MAX_TRANSACTIONS;
      }

    } catch (Exception e) {
      referenceWalletSession
          .getErrorManager()
          .reportUnexpectedSubAppException(
              SubApps.CWP_WALLET_STORE,
              UnexpectedSubAppExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_FRAGMENT,
              e);
      e.printStackTrace();
    }

    return lst;
  }