diff --git a/CHANGELOG.md b/CHANGELOG.md index e14d28292..b3553d89d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # PayPal Android SDK Release Notes +## unreleased + +* PayPalNativeCheckout + * Bump native-checkout version to release `1.2.0` + * Add `userAuthenticationEmail` to `PayPalNativeCheckoutRequest` + ## 1.0.0 (2023-10-02) * Breaking Changes diff --git a/PayPalNativePayments/src/main/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutClient.kt b/PayPalNativePayments/src/main/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutClient.kt index d6d0a9cc4..ea35afb2c 100644 --- a/PayPalNativePayments/src/main/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutClient.kt +++ b/PayPalNativePayments/src/main/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutClient.kt @@ -9,6 +9,7 @@ import com.paypal.android.corepayments.analytics.AnalyticsService import com.paypal.checkout.PayPalCheckout import com.paypal.checkout.approve.OnApprove import com.paypal.checkout.cancel.OnCancel +import com.paypal.checkout.config.AuthConfig import com.paypal.checkout.config.CheckoutConfig import com.paypal.checkout.config.UIConfig import com.paypal.checkout.createorder.CreateOrder @@ -44,12 +45,12 @@ class PayPalNativeCheckoutClient internal constructor( * See Also: [Developer Portal](https://developer.paypal.com/developer/applications/) */ constructor(application: Application, coreConfig: CoreConfig, returnUrl: String) : - this( - application, - coreConfig, - returnUrl, - AnalyticsService(application, coreConfig), - ) + this( + application, + coreConfig, + returnUrl, + AnalyticsService(application, coreConfig), + ) private val exceptionHandler = CoreCoroutineExceptionHandler { listener?.onPayPalCheckoutFailure(it) @@ -74,7 +75,7 @@ class PayPalNativeCheckoutClient internal constructor( var shippingListener: PayPalNativeShippingListener? = null /** - * Present a Paypal Payseet and start a PayPal transaction. + * Present a Paypal Paysheet and start a PayPal transaction. * * @param request the PayPalNativeCheckoutRequest for the transaction */ @@ -83,6 +84,7 @@ class PayPalNativeCheckoutClient internal constructor( orderId = request.orderId CoroutineScope(dispatcher).launch(exceptionHandler) { try { + val authConfig: AuthConfig? = request.userAuthenticationEmail?.let { AuthConfig(it) } val config = CheckoutConfig( application = application, clientId = coreConfig.clientId, @@ -90,7 +92,8 @@ class PayPalNativeCheckoutClient internal constructor( uiConfig = UIConfig( showExitSurveyDialog = false ), - returnUrl = returnUrl + returnUrl = returnUrl, + authConfig = authConfig ) PayPalCheckout.setConfig(config) listener?.onPayPalCheckoutStart() diff --git a/PayPalNativePayments/src/main/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutRequest.kt b/PayPalNativePayments/src/main/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutRequest.kt index 9e8fbfe82..8b50509ec 100644 --- a/PayPalNativePayments/src/main/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutRequest.kt +++ b/PayPalNativePayments/src/main/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutRequest.kt @@ -7,5 +7,11 @@ data class PayPalNativeCheckoutRequest( /** * The order ID associated with the request. */ - val orderId: String + val orderId: String, + + /** + * Optional: User email to initiate a quicker authentication flow + * in cases where the user has a PayPal Account with the same email. + */ + val userAuthenticationEmail: String? = null ) diff --git a/PayPalNativePayments/src/test/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutClientTest.kt b/PayPalNativePayments/src/test/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutClientTest.kt index 891a6bcba..fa655790e 100644 --- a/PayPalNativePayments/src/test/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutClientTest.kt +++ b/PayPalNativePayments/src/test/java/com/paypal/android/paypalnativepayments/PayPalNativeCheckoutClientTest.kt @@ -74,7 +74,7 @@ class PayPalNativeCheckoutClientTest { } just runs sut = getPayPalCheckoutClient(testScheduler = testScheduler) - sut.startCheckout(PayPalNativeCheckoutRequest("order_id")) + sut.startCheckout(PayPalNativeCheckoutRequest("order_id", "test@test.com")) advanceUntilIdle() verify { @@ -82,6 +82,7 @@ class PayPalNativeCheckoutClientTest { } expectThat(configSlot.captured) { get { clientId }.isEqualTo("fake-client-id") + get { authConfig?.userEmail }.isEqualTo("test@test.com") get { application }.isEqualTo(mockApplication) get { environment }.isEqualTo(com.paypal.checkout.config.Environment.SANDBOX) } diff --git a/build.gradle b/build.gradle index d224a5221..6072de67e 100644 --- a/build.gradle +++ b/build.gradle @@ -80,7 +80,7 @@ buildscript { "json" : "org.json:json:20220320", // PayPal - "nativeCheckout" : "com.paypal.checkout:android-sdk:1.1.0", + "nativeCheckout" : "com.paypal.checkout:android-sdk:1.2.0", // Release modules "cardPayments" : "com.paypal.android:card-payments:${modules.sdkVersionName}",