Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shopper insights rp1 feature include session #1235

Conversation

warmkesselj
Copy link
Contributor

Summary of changes

Add public property shopperSessionId to BTPaypalRequest. Value should be passed to both the create_payment_resource and setup_billing_agreement endpoints. Demo app should be updated enable/disable passing this value.

Checklist

  • Added a changelog entry
  • Relevant test coverage
  • Tested and confirmed payment flows affected by this change are functioning as expected

Authors

@stechiu
@warmkesselj
@jwarmkessel

@warmkesselj warmkesselj requested a review from a team as a code owner December 6, 2024 20:18
) {

PayPalVaultRequest request = new PayPalVaultRequest(true);

if (!buyerEmailAddress.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to change all these other params? It seems like it should be unaffected by this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that the original code is potentially a run time crash if the value is null. In the case of the demo app and how its setup, setting the toggles to null didn't have an impact on this flow because the values would always be true.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok in that case do we need to check that it's not null and it's not empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, great catch!

@@ -72,6 +72,8 @@ import org.json.JSONException
* where the user has a PayPal Account with the same email.
* @property userPhoneNumber User phone number used to initiate a quicker authentication flow in
* cases where the user has a PayPal Account with the phone number.
* @property shopperSessionId value should be the shopper session ID returned from your server SDK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this doc string was included in the ticket but I'm wondering if it's clear enough for when we are outside of the shopper insights module. Should we include something like the shopper session ID returned from your shopper insights server SDK integration?. Also should this param be beta/experimental API @jaxdesmarais?

Copy link
Contributor Author

@warmkesselj warmkesselj Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it.
Current:
shopperSessionId value should be the shopper session ID returned from your server SDK request.
To:
shopperSessionId the shopper session ID returned from your shopper insights server SDK integration

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make the changes in iOS as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep we can for sure give this the beta/experimental API tag

Comment on lines 129 to 131
shopperSessionId?.let {
if (it.isNotEmpty()) parameters.put(SHOPPER_SESSION_ID, it)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to use the same simplified putOpt logic from the PayPalVaultRequest here

@sarahkoop
Copy link
Contributor

Did we manually test and confirm passing this parameter is working with the checkout and vault flows?

@warmkesselj
Copy link
Contributor Author

Did we manually test and confirm passing this parameter is working with the checkout and vault flows?

Yes, but will need to test again with the updates.

CHANGELOG.md Outdated
@@ -7,6 +7,8 @@
* ShopperInsights (BETA)
* Add `isPayPalAppInstalled` and `isVenmoAppInstalled` methods
* Add `shopperSessionId` parameter to `ShopperInsightsClient`
* BraintreePayPal
* Add `shopperSessionInsight`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Add `shopperSessionInsight`
* Add `shopperSessionId` to `PayPalCheckoutRequest` and `PayPalVaultRequest`

Copy link
Contributor

@jaxdesmarais jaxdesmarais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of very minor cleanup comments but otherwise looks great!

@@ -148,15 +148,17 @@ private void launchPayPal(
activity,
buyerEmailAddress,
buyerPhoneCountryCode,
buyerPhoneNationalNumber
buyerPhoneNationalNumber,
null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it looks like there are some extra spaces for the 2 null properties here

nationalNumberInput.editText?.text.toString()
nationalNumberInput.editText?.text.toString(),
shopperSessionId

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@warmkesselj warmkesselj merged commit 8427bcd into shopper-insights-rp1-feature Dec 9, 2024
3 checks passed
@warmkesselj warmkesselj deleted the shopper-insights-rp1-feature-includeSessionId branch December 9, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants