From a45a85b1a62e0a9e09a43b6fd4f6df3372010917 Mon Sep 17 00:00:00 2001 From: richherrera Date: Fri, 10 Jan 2025 14:18:11 -0600 Subject: [PATCH 1/3] Add isNullOrEmpty validation to add payer_email when it exists --- .../com/braintreepayments/api/paypal/PayPalVaultRequest.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PayPal/src/main/java/com/braintreepayments/api/paypal/PayPalVaultRequest.kt b/PayPal/src/main/java/com/braintreepayments/api/paypal/PayPalVaultRequest.kt index ea19bfb618..66e40388a4 100644 --- a/PayPal/src/main/java/com/braintreepayments/api/paypal/PayPalVaultRequest.kt +++ b/PayPal/src/main/java/com/braintreepayments/api/paypal/PayPalVaultRequest.kt @@ -90,7 +90,9 @@ class PayPalVaultRequest parameters.put(DESCRIPTION_KEY, billingAgreementDescription) } - parameters.putOpt(PAYER_EMAIL_KEY, userAuthenticationEmail) + if (!userAuthenticationEmail.isNullOrEmpty()) { + parameters.put(PAYER_EMAIL_KEY, userAuthenticationEmail) + } userPhoneNumber?.let { parameters.put(PHONE_NUMBER_KEY, it.toJson()) } From 2afac071eebec358c01efb1d38cdf293383505f3 Mon Sep 17 00:00:00 2001 From: richherrera Date: Fri, 10 Jan 2025 14:40:44 -0600 Subject: [PATCH 2/3] Suppress CyclomaticComplexMethod --- .../java/com/braintreepayments/api/paypal/PayPalVaultRequest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PayPal/src/main/java/com/braintreepayments/api/paypal/PayPalVaultRequest.kt b/PayPal/src/main/java/com/braintreepayments/api/paypal/PayPalVaultRequest.kt index 66e40388a4..973e605589 100644 --- a/PayPal/src/main/java/com/braintreepayments/api/paypal/PayPalVaultRequest.kt +++ b/PayPal/src/main/java/com/braintreepayments/api/paypal/PayPalVaultRequest.kt @@ -66,7 +66,7 @@ class PayPalVaultRequest ) { @Throws(JSONException::class) - @Suppress("LongMethod") + @Suppress("LongMethod", "CyclomaticComplexMethod") override fun createRequestBody( configuration: Configuration?, authorization: Authorization?, From 8aae73de2dcb08df7e5752a9b011acf4770901b0 Mon Sep 17 00:00:00 2001 From: richherrera Date: Mon, 13 Jan 2025 10:48:49 -0600 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4199684611..c2c035ee1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Braintree Android SDK Release Notes +## unreleased + +* PayPal + * Fix bug to ensure that `PayPalVaultRequest.userAuthenticationEmail` is not sent as an empty string + ## 5.3.0 (2024-12-11) * PayPal