Search in sources :

Example 1 with OtcConfiguration

use of com.paypal.android.sdk.onetouch.core.config.OtcConfiguration in project braintree_android by braintree.

the class BrowserSwitchHelper method getBrowserSwitchIntent.

public static Intent getBrowserSwitchIntent(ContextInspector contextInspector, ConfigManager configManager, Request request) {
    OtcConfiguration configuration = configManager.getConfig();
    try {
        String url = request.getBrowserSwitchUrl(contextInspector.getContext(), configuration);
        Recipe<?> recipe = request.getBrowserSwitchRecipe(configuration);
        for (String allowedBrowserPackage : recipe.getTargetPackagesInReversePriorityOrder()) {
            boolean canIntentBeResolved = Recipe.isValidBrowserTarget(contextInspector.getContext(), url, allowedBrowserPackage);
            if (canIntentBeResolved) {
                request.trackFpti(contextInspector.getContext(), TrackingPoint.SwitchToBrowser, recipe.getProtocol());
                return Recipe.getBrowserIntent(contextInspector.getContext(), url, allowedBrowserPackage);
            }
        }
    } catch (CertificateException | UnsupportedEncodingException | NoSuchPaddingException | NoSuchAlgorithmException | IllegalBlockSizeException | JSONException | BadPaddingException | InvalidEncryptionDataException | InvalidKeyException ignored) {
    }
    return null;
}
Also used : UnsupportedEncodingException(java.io.UnsupportedEncodingException) NoSuchPaddingException(javax.crypto.NoSuchPaddingException) IllegalBlockSizeException(javax.crypto.IllegalBlockSizeException) JSONException(org.json.JSONException) CertificateException(java.security.cert.CertificateException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) BadPaddingException(javax.crypto.BadPaddingException) InvalidKeyException(java.security.InvalidKeyException) OtcConfiguration(com.paypal.android.sdk.onetouch.core.config.OtcConfiguration) InvalidEncryptionDataException(com.paypal.android.sdk.onetouch.core.exception.InvalidEncryptionDataException)

Aggregations

OtcConfiguration (com.paypal.android.sdk.onetouch.core.config.OtcConfiguration)1 InvalidEncryptionDataException (com.paypal.android.sdk.onetouch.core.exception.InvalidEncryptionDataException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 InvalidKeyException (java.security.InvalidKeyException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 CertificateException (java.security.cert.CertificateException)1 BadPaddingException (javax.crypto.BadPaddingException)1 IllegalBlockSizeException (javax.crypto.IllegalBlockSizeException)1 NoSuchPaddingException (javax.crypto.NoSuchPaddingException)1 JSONException (org.json.JSONException)1