use of com.braintreepayments.api.models.ClientToken in project braintree_android by braintree.
the class Venmo method onActivityResult.
static void onActivityResult(final BraintreeFragment fragment, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
fragment.sendAnalyticsEvent("pay-with-venmo.app-switch.success");
String nonce = data.getStringExtra(EXTRA_PAYMENT_METHOD_NONCE);
if (shouldVault(fragment.getApplicationContext()) && fragment.getAuthorization() instanceof ClientToken) {
vault(fragment, nonce);
} else {
String venmoUsername = data.getStringExtra(EXTRA_USERNAME);
VenmoAccountNonce venmoAccountNonce = new VenmoAccountNonce(nonce, venmoUsername, venmoUsername);
fragment.postCallback(venmoAccountNonce);
}
} else if (resultCode == Activity.RESULT_CANCELED) {
fragment.sendAnalyticsEvent("pay-with-venmo.app-switch.canceled");
}
}
Aggregations