Braintree/src/main/java/com/braintreepayments/api/PayPal.java
protected static void onActivityResult(final BraintreeFragment fragment, int resultCode, Intent data) {
        Request request = getPersistedRequest(fragment.getApplicationContext());
        String paymentType = paymentTypeForRequest(request);
        String switchType = switchTypeForIntent(data);
        String eventPrefix = paymentType + "." + switchType;

        if (resultCode == AppCompatActivity.RESULT_OK && data != null && request != null) {
            Result result = PayPalOneTouchCore.parseResponse(fragment.getApplicationContext(), request, data);
            switch (result.getResultType()) {
                case Error:
                    fragment.postCallback(new BrowserSwitchException(result.getError().getMessage()));
                    fragment.sendAnalyticsEvent(eventPrefix + ".failed");
                    break;
                case Cancel:
                    fragment.postCancelCallback(BraintreeRequestCodes.PAYPAL);
                    fragment.sendAnalyticsEvent(eventPrefix + ".canceled");
                    break;
                case Success:
                    onSuccess(fragment, data, request, result);
                    fragment.sendAnalyticsEvent(eventPrefix + ".succeeded");
                    break;
            }
        } else {
            fragment.sendAnalyticsEvent(eventPrefix + ".canceled");

            if (resultCode != AppCompatActivity.RESULT_CANCELED) {
                fragment.postCancelCallback(BraintreeRequestCodes.PAYPAL);
            }
        }
    }
protected static void onActivityResult(final BraintreeFragment fragment, int resultCode, Intent data) {
        Request request = getPersistedRequest(fragment.getApplicationContext());
        String paymentType = paymentTypeForRequest(request);
        String switchType = switchTypeForIntent(data);
        String eventPrefix = paymentType + "." + switchType;

        if (resultCode == AppCompatActivity.RESULT_OK && data != null && request != null) {
            Result result = PayPalOneTouchCore.parseResponse(fragment.getApplicationContext(), request, data);
            switch (result.getResultType()) {
                case Error:
                    fragment.postCallback(new BrowserSwitchException(result.getError().getMessage()));
                    fragment.sendAnalyticsEvent(eventPrefix + ".failed");
                    break;
                case Cancel:
                    fragment.postCancelCallback(BraintreeRequestCodes.PAYPAL);
                    fragment.sendAnalyticsEvent(eventPrefix + ".canceled");
                    break;
                case Success:
                    onSuccess(fragment, data, request, result);
                    fragment.sendAnalyticsEvent(eventPrefix + ".succeeded");
                    break;
            }
        } else {
            fragment.sendAnalyticsEvent(eventPrefix + ".canceled");

            if (resultCode != AppCompatActivity.RESULT_CANCELED) {
                fragment.postCancelCallback(BraintreeRequestCodes.PAYPAL);
            }
        }
    }
protected static void onActivityResult ( final BraintreeFragment fragment , int resultCode , Intent data ) { Request request = getPersistedRequest ( fragment . getApplicationContext ( ) ) ; String paymentType = paymentTypeForRequest ( request ) ; String switchType = switchTypeForIntent ( data ) ; String eventPrefix = paymentType + "." + switchType ; if ( resultCode == AppCompatActivity . RESULT_OK && data != null && request != null ) { Result result = PayPalOneTouchCore . parseResponse ( fragment . getApplicationContext ( ) , request , data ) ; switch ( result . getResultType ( ) ) { case Error : fragment . postCallback ( new BrowserSwitchException ( result . getError ( ) . getMessage ( ) ) ) ; fragment . sendAnalyticsEvent ( eventPrefix + ".failed" ) ; break ; case Cancel : fragment . postCancelCallback ( BraintreeRequestCodes . PAYPAL ) ; fragment . sendAnalyticsEvent ( eventPrefix + ".canceled" ) ; break ; case Success : onSuccess ( fragment , data , request , result ) ; fragment . sendAnalyticsEvent ( eventPrefix + ".succeeded" ) ; break ; } } else { fragment . sendAnalyticsEvent ( eventPrefix + ".canceled" ) ; if ( resultCode != AppCompatActivity . RESULT_CANCELED ) { fragment . postCancelCallback ( BraintreeRequestCodes . PAYPAL ) ; } } }
The result from PayPal's request.

@param fragment A {@link BraintreeFragment} used to process the request.
@param data Data associated with the result.
The result from PayPal s request .