Skip to content

Commit

Permalink
Shopper Insights Final Changes (#1024)
Browse files Browse the repository at this point in the history
* Remove merchantId from EligiblePaymentsApiRequest

* Use the default tokenization key for prod

* Remove new line

* Update ShopperInsights changelog
  • Loading branch information
tdchow authored Jun 5, 2024
1 parent 37f569a commit 17272dd
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 15 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

* PayPal
* Add optional property `PayPalCheckoutRequest.setUserAuthenticationEmail()`
* Add ShopperInsights module (BETA)
* ShopperInsights (BETA)
* Requires opt in - `@OptIn(ExperimentalBetaApi::class)`
* Add `ShopperInsightsClient.getRecommendedPaymentMethods()` for returning recommendations based on the buyer

## 4.46.0 (2024-05-30)

Expand Down
3 changes: 1 addition & 2 deletions Demo/src/main/java/com/braintreepayments/demo/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class Settings {
static final String LOCAL_PAYMENTS_TOKENIZATION_KEY = "sandbox_f252zhq7_hh4cpc39zq4rgjcg";

private static final String XO_SANDBOX_TOKENIZATION_KEY = "sandbox_rz48bqvw_jcyycfw6f9j4nj9c";
private static final String XO_PRODUCTION_TOKENIZATION_KEY = "";

private static SharedPreferences sharedPreferences;

Expand Down Expand Up @@ -126,7 +125,7 @@ public static String getPayPalCheckoutTokenizationKey(Context context) {
if (SANDBOX_ENV_NAME.equals(environment)) {
return XO_SANDBOX_TOKENIZATION_KEY;
} else if (PRODUCTION_ENV_NAME.equals(environment)) {
return XO_PRODUCTION_TOKENIZATION_KEY;
return PRODUCTION_TOKENIZATION_KEY;
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@ import org.json.JSONObject
* Data class representing a request for find eligible payments api.
*
* @property request The request given to us by the merchant
* @property merchantId The merchant's ID
* @property currencyCode The currency code
* @property countryCode The country code
* @property accountDetails Include account details
* @property constraintType The constraint type
* @property paymentSources Payment sources, ie. PAYPAL VENMO
*
* [merchantId] [currencyCode] [countryCode] are needed for Venmo recommended results
*
* [currencyCode] [countryCode] are needed for Venmo recommended results
*/
@OptIn(ExperimentalBetaApi::class)
internal data class EligiblePaymentsApiRequest(
val request: ShopperInsightsRequest,
val merchantId: String,
val currencyCode: String,
val countryCode: String,
val accountDetails: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package com.braintreepayments.api
internal class ShopperInsightsApi(
private val eligiblePaymentsApi: EligiblePaymentsApi
) {

fun findEligiblePayments(request: EligiblePaymentsApiRequest, callback: EligiblePaymentsCallback) {
eligiblePaymentsApi.execute(request, callback)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ class ShopperInsightsClient @VisibleForTesting internal constructor(
return
}

// TODO: get correct merchant ID from SDK
val merchantId = "MXSJ4F5BADVNS"

api.findEligiblePayments(
EligiblePaymentsApiRequest(
request,
merchantId = merchantId,
currencyCode = currencyCode,
countryCode = countryCode,
accountDetails = includeAccountDetails,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class EligiblePaymentsApiRequestUnitTest {
)
),
currencyCode = "USD",
merchantId = "MXSJ4F5BADVNS",
countryCode = "US",
accountDetails = true,
constraintType = "INCLUDE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ class EligiblePaymentsApiUnitTest {
),
"",
"",
"",
true,
"",
emptyList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class ShopperInsightsClientUnitTest {
api.findEligiblePayments(
request = EligiblePaymentsApiRequest(
request,
merchantId = "MXSJ4F5BADVNS",
currencyCode = "USD",
countryCode = "US",
accountDetails = true,
Expand Down

0 comments on commit 17272dd

Please sign in to comment.