Skip to content

Commit

Permalink
Remove settings change
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahkoop committed Oct 24, 2023
1 parent c2c2f7f commit ef0953b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
19 changes: 9 additions & 10 deletions Demo/src/main/java/com/braintreepayments/demo/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,15 @@ public static boolean useTokenizationKey(Context context) {
public static String getTokenizationKey(Context context) {
String environment = getEnvironment(context);

return LOCAL_PAYMENTS_TOKENIZATION_KEY;
// if (SANDBOX_ENV_NAME.equals(environment)) {
// return SANDBOX_TOKENIZATION_KEY;
// } else if (MOCKED_PAY_PAL_ENV_NAME.equals(environment)) {
// return MOCKED_PAY_PAL_SANDBOX_TOKENIZATION_KEY;
// } else if (PRODUCTION_ENV_NAME.equals(environment)) {
// return PRODUCTION_TOKENIZATION_KEY;
// } else {
// return null;
// }
if (SANDBOX_ENV_NAME.equals(environment)) {
return SANDBOX_TOKENIZATION_KEY;
} else if (MOCKED_PAY_PAL_ENV_NAME.equals(environment)) {
return MOCKED_PAY_PAL_SANDBOX_TOKENIZATION_KEY;
} else if (PRODUCTION_ENV_NAME.equals(environment)) {
return PRODUCTION_TOKENIZATION_KEY;
} else {
return null;
}
}

public static String getLocalPaymentsTokenizationKey(Context context) {
Expand Down
48 changes: 25 additions & 23 deletions v5_MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Braintree Android v5 Migration Guide

See the [CHANGELOG](/CHANGELOG.md) for a complete list of changes. This migration guide outlines the basics for updating your Braintree integration from v4 to v5.
See the [CHANGELOG](/CHANGELOG.md) for a complete list of changes. This migration guide outlines the
basics for updating your Braintree integration from v4 to v5.

## Table of Contents

Expand All @@ -18,40 +19,42 @@ The minimum supported Android API level for v5 of this SDK has increased to 23.

## Data Collector

The `paypal-data-collector` module has been removed and replaced by the `data-collector` module.
The `DataCollector` class within the `data-collector` module has the same
The `paypal-data-collector` module has been removed and replaced by the `data-collector` module.
The `DataCollector` class within the `data-collector` module has the same
`collectDeviceData` methods, so if you were previously using the `paypal-data-collector` library,
no code changes are required aside from updating your dependency.

If you were using the `data-collector` library in v4, `DataCollector#collectDeviceData(context,
merchantId, callback)` is now `DataCollector#collectDeviceData(context, riskCorrelationId,
If you were using the `data-collector` library in v4, `DataCollector#collectDeviceData(context,
merchantId, callback)` is now `DataCollector#collectDeviceData(context, riskCorrelationId,
callback)`, where `riskCorrelationId` is an optional client metadata ID.

```kotlin
val dataCollector = DataCollector(braintreeClient)
dataCollector.collectDeviceData(context) { deviceData, error ->
dataCollector.collectDeviceData(context) { deviceData, error ->
// send deviceData to your server
}
```

## Union Pay

The `union-pay` module, and all containing classes, was removed in v5. UnionPay cards can now be processed as regular cards, through the `card` module. You no longer need to manage card enrollment via SMS authorization.
The `union-pay` module, and all containing classes, was removed in v5. UnionPay cards can now be
processed as regular cards, through the `card` module. You no longer need to manage card enrollment
via SMS authorization.

Now, you can tokenize with just the card details:

// TODO: code snippet of card integration in v5

## Venmo

The Venmo integration has been updated to allow for more flexibility with app switching and
activity result handling.
The Venmo integration has been updated to allow for more flexibility with app switching and
activity result handling.

`VenmoLauncher` has been added to handle the app switching portion of the Venmo flow for user
authentication via the Venmo app. This class uses the Android Activity Result API and therefore
`VenmoLauncher` has been added to handle the app switching portion of the Venmo flow for user
authentication via the Venmo app. This class uses the Android Activity Result API and therefore
must be instantiated in the `OnCreate` method of your Activity or Fragment.

`BraintreeClient` and `VenmoClient` no longer require references to Fragment or Activity and do not
`BraintreeClient` and `VenmoClient` no longer require references to Fragment or Activity and do not
need to be instantiated in `OnCreate`.

```diff
Expand Down Expand Up @@ -102,11 +105,11 @@ class MyActivity : FragmentActivity() {
The Google Pay integration has been updated to allow for more flexibility with app switching and
activity result handling.

`GooglePayLauncher` has been added to handle the app switching portion of the Google Pay flow for
payment authorization via the Google Pay payment sheet. This class uses the Android Activity Result
`GooglePayLauncher` has been added to handle the app switching portion of the Google Pay flow for
payment authorization via the Google Pay payment sheet. This class uses the Android Activity Result
API and therefore must be instantiated in the `OnCreate` method of your Activity or Fragment.

`BraintreeClient` and `GooglePayClient` no longer require references to Fragment or Activity and
`BraintreeClient` and `GooglePayClient` no longer require references to Fragment or Activity and
do not need to be instantiated in `OnCreate`.

```diff
Expand Down Expand Up @@ -158,10 +161,10 @@ The ThreeDSecure integration has been updated to allow for more flexibility with
activity result handling.

`ThreeDSecureLauncher` has been added to handle the app switching portion of the 3DS flow for user
authentication. This class uses the Android Activity Result API and therefore must be instantiated
authentication. This class uses the Android Activity Result API and therefore must be instantiated
in the `OnCreate` method of your Activity or `onCreateView` method of your Fragment.

`BraintreeClient` and `ThreeDSecureClient` no longer require references to Fragment or Activity and
`BraintreeClient` and `ThreeDSecureClient` no longer require references to Fragment or Activity and
do not need to be instantiated in `OnCreate`.

```diff
Expand Down Expand Up @@ -215,13 +218,13 @@ class MyActivity : FragmentActivity() {

## Local Payment

The Local Payment integration has been updated to allow for more flexibility with browser
The Local Payment integration has been updated to allow for more flexibility with browser
switching and result handling.

`LocalPaymentLauncher` has been added to handle the browser switching portion of the local payment
flow for payment authorization via bank login. This class is used to handle browser switch
results upon returning to your app from the web flow, therefore must be instantiated in or
before the `OnResume` method of your Activity or Fragment.
`LocalPaymentLauncher` has been added to handle the browser switching portion of the local payment
flow for payment authorization via bank login. This class is used to handle browser switch results
upon returning to your app from the web flow, therefore must be instantiated in or before
the `OnResume` method of your Activity or Fragment.

`BraintreeClient` and `LocalPaymentClient` no longer require references to Fragment or Activity and
do not need to be instantiated in `OnCreate`.
Expand All @@ -246,7 +249,6 @@ class MyActivity : FragmentActivity() {

// ONLY REQUIRED IF YOUR ACTIVITY LAUNCH MODE IS SINGLE_TOP
@override fun onNewIntent(intent: Intent) {
setIntent(intent)
+ localPaymentLauncher.handleReturnToAppFromBrowser(requireContext(), intent)
}

Expand Down

0 comments on commit ef0953b

Please sign in to comment.