-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Manual Browser Switch Handling (#730)
* Add fetchBrowserSwitchResultIfOneExists to PayPalClient and un-deprecate BraintreeClient only constructor and onBrowserSwitchResult with callback method. * Add PayPal Manual Browser Switch integration pattern. * Add Manual browser switch code snippet to migration guide. * Update MIGRATION guide for manual browser switching. * Clean up PayPalClient methods. * Update docs. * Add docs for new parseBrowserSwitch result. * Write documentation for updated PayPalClient manual browser switching logic. * Update naming to match plurality. * Update clients to use new browser switch methods. * Add tokenize call to migration guide steps. * Add TODO for Android 9 workaround. * Use browser switch SNAPSHOT build. * Update browser switch dependency. * Add manual browser switching methods to LocalPaymentClient. * Add support for manual browser switching in local payment fragment. Signed-off-by: Jax DesMarais-Leder <[email protected]> * Add composition tests for BraintreeClient. * Add PayPalClient unit tests for manual browser switching. * Add LocalPaymentClient unit test. * Remove unecessary mention of Android 9 onNewIntent bug; the new manual integration pattern should factor this out. * Update changelog and docs strings. * Update CHANGELOG.md Co-authored-by: Jax DesMarais-Leder <[email protected]> * Update CHANGELOG.md Co-authored-by: Jax DesMarais-Leder <[email protected]> * Add Kotlin version bump to CHANGELOG. --------- Signed-off-by: Jax DesMarais-Leder <[email protected]> Co-authored-by: Jax DesMarais-Leder <[email protected]>
- Loading branch information
1 parent
0f26335
commit 8deaff5
Showing
15 changed files
with
391 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
Demo/src/androidTest/java/com/braintreepayments/demo/test/PayPalManualBrowserSwitchTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.braintreepayments.demo.test; | ||
|
||
import static com.braintreepayments.AutomatorAction.click; | ||
import static com.braintreepayments.AutomatorAssertion.text; | ||
import static com.braintreepayments.DeviceAutomator.onDevice; | ||
import static com.braintreepayments.UiObjectMatcher.withText; | ||
import static com.braintreepayments.UiObjectMatcher.withTextStartingWith; | ||
import static org.hamcrest.Matchers.containsString; | ||
import static org.hamcrest.Matchers.endsWith; | ||
|
||
import androidx.preference.PreferenceManager; | ||
import androidx.test.core.app.ApplicationProvider; | ||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner; | ||
|
||
import com.braintreepayments.demo.test.utilities.TestHelper; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(AndroidJUnit4ClassRunner.class) | ||
public class PayPalManualBrowserSwitchTest extends TestHelper { | ||
|
||
@Before | ||
public void setup() { | ||
super.setup(); | ||
launchApp("Mock PayPal"); | ||
onDevice(withText("PayPal")).waitForEnabled().perform(click()); | ||
|
||
PreferenceManager.getDefaultSharedPreferences(ApplicationProvider.getApplicationContext()) | ||
.edit() | ||
.putBoolean("enable_manual_browser_switching", true) | ||
.commit(); | ||
} | ||
|
||
@Test(timeout = 60000) | ||
public void browserSwitch_makesASinglePayment() { | ||
onDevice(withText("Single Payment")).waitForEnabled().perform(click()); | ||
onDevice(withText("Proceed with Sandbox Purchase")).waitForExists(); | ||
onDevice(withText("Proceed with Sandbox Purchase")).perform(click()); | ||
|
||
getNonceDetails().check(text(containsString("Email: [email protected]"))); | ||
|
||
onDevice(withText("Create a Transaction")).perform(click()); | ||
onDevice(withTextStartingWith("created")).check(text(endsWith("authorized"))); | ||
} | ||
|
||
@Test(timeout = 60000) | ||
public void browserSwitch_makesABillingAgreement() { | ||
onDevice(withText("Billing Agreement")).waitForEnabled().perform(click()); | ||
onDevice(withText("Proceed with Sandbox Purchase")).waitForExists(); | ||
onDevice(withText("Proceed with Sandbox Purchase")).perform(click()); | ||
|
||
getNonceDetails().check(text(containsString("Email: [email protected]"))); | ||
|
||
onDevice(withText("Create a Transaction")).perform(click()); | ||
onDevice(withTextStartingWith("created")).check(text(endsWith("authorized"))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.