public class BraintreeFragment
extends BrowserSwitchFragment
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EXTRA_WAS_BROWSER_SWITCH_RESULT |
protected BraintreeApiHttpClient |
mBraintreeApiClient |
protected android.content.Context |
mContext |
protected GoogleApiClient |
mGoogleApiClient |
protected BraintreeGraphQLHttpClient |
mGraphQLHttpClient |
protected BraintreeHttpClient |
mHttpClient |
static java.lang.String |
TAG
Deprecated.
This constant is no longer used and will be removed in a future release. If you were using this constant to retrieve an instance of `BraintreeFragment`, you should instead call `BraintreeFragment.newInstance` with the authorization string. It will return an existing instance if one is present.
|
Constructor and Description |
---|
BraintreeFragment() |
Modifier and Type | Method and Description |
---|---|
<T extends BraintreeListener> |
addListener(T listener)
Adds a listener.
|
protected void |
fetchConfiguration() |
protected void |
flushCallbacks() |
protected android.content.Context |
getApplicationContext() |
protected Authorization |
getAuthorization() |
protected BraintreeApiHttpClient |
getBraintreeApiHttpClient() |
java.util.List<PaymentMethodNonce> |
getCachedPaymentMethodNonces()
After fetching the current customer's
PaymentMethodNonce s using
PaymentMethod.getPaymentMethodNonces(BraintreeFragment) , the PaymentMethodNonce s will be cached
for the life time of this instance of BraintreeFragment and can be returned without additional network
requests using this method. |
protected Configuration |
getConfiguration() |
protected GoogleApiClient |
getGoogleApiClient() |
void |
getGoogleApiClient(BraintreeResponseListener<GoogleApiClient> listener)
Obtain an instance of a
GoogleApiClient that is connected or connecting to be used
for Android Pay. |
protected BraintreeGraphQLHttpClient |
getGraphQLHttpClient() |
protected BraintreeHttpClient |
getHttpClient() |
protected java.lang.String |
getIntegrationType() |
java.util.List<BraintreeListener> |
getListeners() |
java.lang.String |
getReturnUrlScheme() |
protected java.lang.String |
getSessionId() |
boolean |
hasFetchedPaymentMethodNonces()
A boolean indicating whether the current customer's payment methods have been fetched with
PaymentMethod.getPaymentMethodNonces(BraintreeFragment) yet. |
boolean |
isActive()
Check if this Braintree fragment is still active.
|
static BraintreeFragment |
newInstance(AppCompatActivity activity,
java.lang.String authorization)
NEXT_MAJOR_VERSION: remove this method in favor of BraintreeFragment#(FragmentActivity, String)
Create a new instance of
BraintreeFragment using the tokenization key or client token and add it to the
AppCompatActivity 's FragmentManager . |
static BraintreeFragment |
newInstance(FragmentActivity activity,
java.lang.String authorization)
Create a new instance of
BraintreeFragment using the tokenization key or client token and add it to the
FragmentActivity 's FragmentManager . |
static BraintreeFragment |
newInstance(Fragment fragment,
java.lang.String authorization)
Create a new instance of
BraintreeFragment using the tokenization key or client token and add it to the
Fragment 's child FragmentManager . |
void |
onActivityResult(int requestCode,
int resultCode,
android.content.Intent data) |
void |
onAttach(android.app.Activity activity) |
void |
onAttach(android.content.Context context) |
void |
onBrowserSwitchResult(int requestCode,
BrowserSwitchResult browserSwitchResult,
android.net.Uri uri) |
void |
onCreate(android.os.Bundle savedInstanceState) |
void |
onDestroy() |
void |
onDetach() |
void |
onPause() |
void |
onResume() |
void |
onSaveInstanceState(android.os.Bundle outState) |
void |
onStop() |
protected void |
postAmericanExpressCallback(AmericanExpressRewardsBalance rewardsBalance) |
protected void |
postCallback(BraintreePaymentResult result) |
protected void |
postCallback(java.lang.Exception error) |
protected void |
postCallback(java.util.List<PaymentMethodNonce> paymentMethodNonceList) |
protected void |
postCallback(PaymentMethodNonce paymentMethodNonce) |
protected void |
postCallback(UnionPayCapabilities capabilities) |
protected void |
postCancelCallback(int requestCode) |
protected void |
postConfigurationCallback() |
protected void |
postOrQueueCallback(QueuedCallback callback) |
protected void |
postPaymentMethodDeletedCallback(PaymentMethodNonce paymentMethodNonce) |
protected void |
postUnionPayCallback(java.lang.String enrollmentId,
boolean smsCodeRequired) |
<T extends BraintreeListener> |
removeListener(T listener)
Removes a previously added listener.
|
void |
sendAnalyticsEvent(java.lang.String eventFragment) |
protected void |
setConfiguration(Configuration configuration) |
protected void |
setConfigurationErrorListener(BraintreeResponseListener<java.lang.Exception> listener) |
void |
startActivityForResult(android.content.Intent intent,
int requestCode) |
protected void |
waitForConfiguration(ConfigurationListener listener) |
@Deprecated public static final java.lang.String TAG
public static final java.lang.String EXTRA_WAS_BROWSER_SWITCH_RESULT
protected BraintreeHttpClient mHttpClient
protected BraintreeApiHttpClient mBraintreeApiClient
protected BraintreeGraphQLHttpClient mGraphQLHttpClient
protected GoogleApiClient mGoogleApiClient
protected android.content.Context mContext
public static BraintreeFragment newInstance(AppCompatActivity activity, java.lang.String authorization) throws InvalidArgumentException
BraintreeFragment
using the tokenization key or client token and add it to the
AppCompatActivity
's FragmentManager
. If a fragment has already been created with the provided
authorization, the existing fragment will be returned.activity
- The AppCompatActivity
to add the BraintreeFragment
to.authorization
- The tokenization key or client token to use.BraintreeFragment
InvalidArgumentException
- If the tokenization key or client token is not valid or cannot be
parsed.public static BraintreeFragment newInstance(FragmentActivity activity, java.lang.String authorization) throws InvalidArgumentException
BraintreeFragment
using the tokenization key or client token and add it to the
FragmentActivity
's FragmentManager
. If a fragment has already been created with the provided
authorization, the existing fragment will be returned.activity
- The FragmentActivity
to add the BraintreeFragment
to.authorization
- The tokenization key or client token to use.BraintreeFragment
InvalidArgumentException
- If the tokenization key or client token is not valid or cannot be
parsed.public static BraintreeFragment newInstance(Fragment fragment, java.lang.String authorization) throws InvalidArgumentException
BraintreeFragment
using the tokenization key or client token and add it to the
Fragment
's child FragmentManager
. If a fragment has already been created with the provided
authorization, the existing fragment will be returned.fragment
- The Fragment
to add the BraintreeFragment
to.authorization
- The tokenization key or client token to use.BraintreeFragment
InvalidArgumentException
- If the tokenization key or client token is not valid or cannot be
parsed.public void onCreate(android.os.Bundle savedInstanceState)
public void onAttach(android.content.Context context)
public void onAttach(android.app.Activity activity)
public void onResume()
public void onPause()
public void onSaveInstanceState(android.os.Bundle outState)
public void onStop()
public void onDetach()
public void onDestroy()
public void startActivityForResult(android.content.Intent intent, int requestCode)
public java.lang.String getReturnUrlScheme()
public void onBrowserSwitchResult(int requestCode, BrowserSwitchResult browserSwitchResult, android.net.Uri uri)
public void onActivityResult(int requestCode, int resultCode, android.content.Intent data)
public <T extends BraintreeListener> void addListener(T listener)
listener
- the listener to add.public <T extends BraintreeListener> void removeListener(T listener)
listener
- the listener to remove.public java.util.List<BraintreeListener> getListeners()
ArrayList
of the currently attached listenerspublic boolean hasFetchedPaymentMethodNonces()
PaymentMethod.getPaymentMethodNonces(BraintreeFragment)
yet.true
if the current customer's payment methods have been fetched, false
otherwise.public java.util.List<PaymentMethodNonce> getCachedPaymentMethodNonces()
PaymentMethodNonce
s using
PaymentMethod.getPaymentMethodNonces(BraintreeFragment)
, the PaymentMethodNonce
s will be cached
for the life time of this instance of BraintreeFragment
and can be returned without additional network
requests using this method.List
s for the current customer.public boolean isActive()
true
if still active and process can proceed, false
otherwise.public void sendAnalyticsEvent(java.lang.String eventFragment)
protected void postConfigurationCallback()
protected void postCancelCallback(int requestCode)
protected void postCallback(PaymentMethodNonce paymentMethodNonce)
protected void postCallback(UnionPayCapabilities capabilities)
protected void postUnionPayCallback(java.lang.String enrollmentId, boolean smsCodeRequired)
protected void postCallback(BraintreePaymentResult result)
protected void postAmericanExpressCallback(AmericanExpressRewardsBalance rewardsBalance)
protected void postCallback(java.util.List<PaymentMethodNonce> paymentMethodNonceList)
protected void postPaymentMethodDeletedCallback(PaymentMethodNonce paymentMethodNonce)
protected void postCallback(java.lang.Exception error)
protected void postOrQueueCallback(QueuedCallback callback)
protected void flushCallbacks()
protected void fetchConfiguration()
protected void setConfigurationErrorListener(BraintreeResponseListener<java.lang.Exception> listener)
protected void waitForConfiguration(ConfigurationListener listener)
protected Authorization getAuthorization()
protected android.content.Context getApplicationContext()
protected Configuration getConfiguration()
protected void setConfiguration(Configuration configuration)
protected BraintreeHttpClient getHttpClient()
protected BraintreeApiHttpClient getBraintreeApiHttpClient()
protected BraintreeGraphQLHttpClient getGraphQLHttpClient()
protected java.lang.String getSessionId()
protected java.lang.String getIntegrationType()
public void getGoogleApiClient(BraintreeResponseListener<GoogleApiClient> listener)
GoogleApiClient
that is connected or connecting to be used
for Android Pay. This instance will be automatically disconnected in
onStop()
and automatically connected in
onResume()
.
Connection failed and connection suspended errors will be sent to
BraintreeErrorListener.onError(Exception)
.
listener
- BraintreeResponseListener
to receive the
GoogleApiClient
in
BraintreeResponseListener#onResponse(GoogleApiClient)
.protected GoogleApiClient getGoogleApiClient()