Exemplo n.º 1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView");
    rootView = inflater.inflate(R.layout.intro_fragment, container, false);
    mpButton = (ImageView) rootView.findViewById(R.id.masterpass_button);
    cardEditor = (CardEditor) rootView.findViewById(R.id.card_editor);
    checkoutButton = (Button) rootView.findViewById(R.id.checkout_button);

    Simplify.init("sbpb_ZWIzODhmMDUtMTkwNC00N2RlLWE5ZGMtNzVlYzhjZmFhZDhk");
    assignListeners();
    applyCustomStyles();
    return rootView;
  }
  public void chargeClick(Card card) {
    if (card == null) return;

    getView().showLoading();
    Simplify.createCardToken(
        card,
        new CardToken.Callback() {
          @Override
          public void onSuccess(CardToken token) {
            if (!hasView()) return;
            Timber.d("Success card token: %s", token.getId());
            processToken(token);
          }

          @Override
          public void onError(Throwable throwable) {
            if (!hasView()) return;
            getView().showFailure();
          }
        });
  }