Search in sources :

Example 1 with TokenizationKey

use of com.braintreepayments.api.models.TokenizationKey in project braintree_android by braintree.

the class BraintreeFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);
    if (mContext == null) {
        mContext = getActivity().getApplicationContext();
    }
    mNewActivityNeedsConfiguration = false;
    mCrashReporter = CrashReporter.setup(this);
    mSessionId = getArguments().getString(EXTRA_SESSION_ID);
    mIntegrationType = getArguments().getString(EXTRA_INTEGRATION_TYPE);
    mAuthorization = getArguments().getParcelable(EXTRA_AUTHORIZATION_TOKEN);
    mAnalyticsDatabase = AnalyticsDatabase.getInstance(getApplicationContext());
    if (mHttpClient == null) {
        mHttpClient = new BraintreeHttpClient(mAuthorization);
    }
    if (savedInstanceState != null) {
        List<PaymentMethodNonce> paymentMethodNonces = savedInstanceState.getParcelableArrayList(EXTRA_CACHED_PAYMENT_METHOD_NONCES);
        if (paymentMethodNonces != null) {
            mCachedPaymentMethodNonces.addAll(paymentMethodNonces);
        }
        mHasFetchedPaymentMethodNonces = savedInstanceState.getBoolean(EXTRA_FETCHED_PAYMENT_METHOD_NONCES);
        try {
            setConfiguration(Configuration.fromJson(savedInstanceState.getString(EXTRA_CONFIGURATION)));
        } catch (JSONException ignored) {
        }
    } else {
        if (mAuthorization instanceof TokenizationKey) {
            sendAnalyticsEvent("started.client-key");
        } else {
            sendAnalyticsEvent("started.client-token");
        }
    }
    fetchConfiguration();
}
Also used : TokenizationKey(com.braintreepayments.api.models.TokenizationKey) JSONException(org.json.JSONException) PaymentMethodNonce(com.braintreepayments.api.models.PaymentMethodNonce) BraintreeHttpClient(com.braintreepayments.api.internal.BraintreeHttpClient)

Aggregations

BraintreeHttpClient (com.braintreepayments.api.internal.BraintreeHttpClient)1 PaymentMethodNonce (com.braintreepayments.api.models.PaymentMethodNonce)1 TokenizationKey (com.braintreepayments.api.models.TokenizationKey)1 JSONException (org.json.JSONException)1