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

Add Shopping Insights Demo App Integration #854

Merged

Conversation

MaxHastingsPP
Copy link
Contributor

@MaxHastingsPP MaxHastingsPP commented Dec 13, 2023

Summary of changes

  • Created Shopping Insights Fragment
  • Created Shopping Insights View Model
  • Created Shopping Insights UI
  • Added Kotlin language support to demo app module
  • Added navigation to shopping insight fragment from main fragment

Images

Screenshot 2023-12-15 at 10 36 43 AM

Checklist

Authors

@MaxHastingsPP MaxHastingsPP requested a review from a team as a code owner December 13, 2023 16:45
@MaxHastingsPP MaxHastingsPP changed the title [WIP] Add Shopping Insights Fragment Add Shopping Insights Fragment Dec 14, 2023
@MaxHastingsPP MaxHastingsPP changed the title Add Shopping Insights Fragment Add Shopping Insights Demo App Integration Dec 14, 2023
@scannillo
Copy link
Contributor

scannillo commented Dec 15, 2023

I think this is minor, but just posting that we could align our iOS & Android demos more.

I like the idea of the email & phone text field, we can add that on iOS at some point and will probably need it for testing various API scenarios/error cases. I included a screenshot below of iOS, where we have buttons that will launch the Venmo & PayPal flow, which we can consider either adding to Android or removing from iOS. This was just a re-use of what already existed for PreferredPaymentMethods.


Screenshot 2023-12-15 at 11 33 51 AM

@MaxHastingsPP
Copy link
Contributor Author

MaxHastingsPP commented Dec 15, 2023

I think this is minor, but just posting that we could align our iOS & Android demos more.

I like the idea of the email & phone text field, we can add that on iOS at some point and will probably need it for testing various API scenarios/error cases. I included a screenshot below of iOS, where we have buttons that will launch the Venmo & PayPal flow, which we can consider either adding to Android or removing from iOS. This was just a re-use of what already existed for PreferredPaymentMethods.

Screenshot 2023-12-15 at 11 33 51 AM

Yeah I agree that we should have our iOS and Android demo apps similar. From what I see on iOS I think it might make our dev app a bit more flexible if we just print out the JSON response we get back from server rather than trying to parse it ourselves. So that any changes with server side responses would not require us to update our demo app. And would make it a bit easier to see what is exactly returned for edge cases / unhappy paths.

Also I am curious what is being used as input for email, phone number? I don't see it from the screenshot you shared.

@scannillo
Copy link
Contributor

Also I am curious what is being used as input for email, phone number? I don't see it from the screenshot you shared.

It's currently just being hard-coded (here)

@saperi22 saperi22 merged commit 31f10d9 into payment-insights-complete-feature Dec 20, 2023
2 checks passed
@saperi22
Copy link
Contributor

Any UI changes will be handled in subsequent PRs.

@jaxdesmarais
Copy link
Contributor

Hey @saperi22 our general rule is 2 approvals before merging any PR in, it doesn't look like this PR has been approved by anyone on the team yet.

@saperi22
Copy link
Contributor

@jaxdesmarais @scannillo had given her approval in a private DM.
As the PR is going into a feature branch, I merged it in. We'll get another opportunity to renew when this goes into the main branch.

@jaxdesmarais
Copy link
Contributor

@saperi22 if that's the case in the future please post those messages in the PR so other folks know. It'd still require 1 more approval in any case.

Regarding the feature branch being merged into main, we don't typically review those PRs at all on the BT/PPCP teams. All PRs merged into the feature branch should have 2 approvals already. This allows us to, once work is complete, merge feature branches in without additional approvals as all work has already been approved.

The main reason we open those PRs is so that we can ensure CI is still green. This PR is a great example of that process: braintree/braintree_ios#1040. It also allows us to review work in smaller digestible chunks vs the entire context of the feature where it is easier to miss things in a larger feature to main PR.

@scannillo
Copy link
Contributor

@jaxdesmarais @scannillo had given her approval in a private DM.

Ah, I think I meant that this approach looks good. But no worries! We're all still getting on the same page for our dev practices.

We have this highlighted in our BT GHE sdk-knowledge repo, under dev-practices.md#commits--pull-requests, but I know the new folks just got access to that repo. Next week, I will add the 2 review restriction to our repos at the PR level (DTBTSDK-3324).

@scannillo scannillo deleted the payment-insights-demo-integration branch February 5, 2024 16:47
saperi22 added a commit that referenced this pull request Jun 13, 2024
* Create PayPalMessaging Module (#847)

* added new module for paypal-messaging
* Created empty PayPalMessagingClient.kt and PayPalMessagingClientUnitTest.ktclass files
* Added AndroidManifest.xml to this module
* Created build.gradle to include necessary dependencies and settings

Co-authored-by: Jax DesMarais-Leder <[email protected]>

* Add Payment Insights Client public API shell (#844)

* Added Shopper Insights client, request, result, stubs and docs

* Added Shopper Insights client unit test

Added Shopper Insights client unit test

* Added insight callback updated unit test

* adding unit test documentation

* remove coroutines

* add new line

* remove open

* fix detekt

* Update BraintreeCore/src/main/java/com/braintreepayments/api/BraintreeShopperInsightsClient.kt

Co-authored-by: Sarah Koop <[email protected]>

* rename ShopperInsightsClient

* lighten ShopperInsight docs

* change ShopperInsightRequest from val to var

* remove special char e.g.

* rename response to info

* Add Email and Phone request sub classes with unit tests

* rename methods

* updated unit tests

* Added Email and Phone data class

* Add docs and make interface a functional interface

* simplify syntax

* updating dependency

* Rename parameters

* fix lint issues

* Addressing PR comment: making email a simple string

* fix tests

* Refactoring tests

* linter fixes

* refactoring

* Renaming class

* formatting

* compact code

* add docs

* add kdoc

* more kdocs

* use constants for key strings

* fix suppress params

* Update BraintreeCore/src/test/java/com/braintreepayments/api/ShopperInsightsClientUnitTest.kt

Co-authored-by: sshropshire <[email protected]>

* Rename classes

* Address PR comments.
Move the object to json conversion to API class

* move class to its own file

* Change the ShopperInsightsRequest class signature

* Moving the validation logic

* adding kdoc

---------

Co-authored-by: Sarah Koop <[email protected]>
Co-authored-by: saperi <[email protected]>
Co-authored-by: saperi22 <[email protected]>
Co-authored-by: sshropshire <[email protected]>

* Create ShopperInsights module and move files there. (#853)

* Create ShopperInsights module and move files there.

* Add EOF line

* Add README.md to the module

* clean up dependencies

* Refactor classes to standard package name

* remove unused files

* Modify release.yml to include newly created ShopperInsights module

* Modify release_snapshot.yml to include newly created ShopperInsights module

* remove example instrumented test

* update dependencies

* add dokka plugin to ShopperInsights module

* removing readme

* Add PayPal Messaging Release Steps (#863)

* Add testing PayPalMessaging to GitHub workflows
* Add PayPalMessaging to build.gradle

* Add Shopping Insights Demo App Integration (#854)

* Add Shopping Insights Fragment

* move insight row

* added shopping insight vm, ui and integration

* fix linting

* Add email and phone null switches

* remove unused import

* import ShopperInsights module

---------

Co-authored-by: Sai <[email protected]>

* rename PayPalMessagingClient to PayPalMessagingView (#870)

* Shopper Insights - Merchant analytics (#869)

* Add events for merchant analytics

* Add API for merchants to call to send shopper insights analytics events

* Adding tests

* fixing lint issue

* Use constants instead of sealed class for analytics event strings

* Adding PayPal and Venmo apps installed check (#872)

* Checking if PayPal and Venmo are installed and returning a success result.

* fix linter

* Change logic to check if both Venmo and PayPal apps are installed

* refactoring logic

* rename class

* Wire up demo app

* rename ShoppingInsights to ShopperInsights

* adding another test

* modify tests

* refactor logic

* Created Shopping Insight Api request with default values

* Created Shopper Insight Api Result

* change api result to camel case

* fix

* create body and api separate classes

* fix unit test

* fix detekt

* remove gson

* add ShopperInsightApiResultTest

* change to internal

* separate data class files

* drop call name from shopping api class

* remove vault tokens not needed

* renamed to ShopperInsightsApi

* var to val for request data

* fixed name shoppingInsightsApi

* removed options and default from ShopperInsightsPaymentMethodDetails

* rename to eligibleInPayPalNetwork

* fix eligibleInPayPalNetwork

* fixed json optional object

* rename to ShoppingInsightsCreateBodyUnitTest

* fix ShopperInsightApiResultUnitTest

* Adding analytics events for Shopper Insights (#882)

* move toJson into shopper request api

* create shopper api wrapper class for client

* fix gradle missing empty space

* reorganize and renamed classes

* update class docs

* move out of findeligiblepayments package

* remove Find

* match class name eligiblePaymentsApi

* Add PayPal Messaging Dependency (#888)

* add PayPal Messages dependency
* update build.grade to reflect min SDK version and import snapshots
* add TODO to remove importing snapshots before release
* add rootProject.minSdkVersionPayPalMessaging

* Paypal Messaging Implementation (#895)

* Add PayPalMessagingRequest, PayPalMessagingColor, PayPalMessagingLogoType, PayPalMessagingOfferType, PayPalMessagingPlacement, PayPalMessagingTextAlignment, and PayPalMessagingListener
* Add PayPalMessagingView as the main entry point for merchants

* Messaging analytics

* Add network call for shopper insights (#894)

* add network call using bt client

* add authorization header

* pass result to demo app

* use bearer token

* fix linting

* add move url todo

* fix detekt

* Update BraintreeCore/src/main/java/com/braintreepayments/api/BraintreeHttpClient.kt

Co-authored-by: sshropshire <[email protected]>

* suppress CyclomaticComplexMethod

* check httpError

* return httpError if responseBody is null

* use config environment for base url

* add eligible payments api unit test class

* Update API response logic in ShopperInsightsClient and add test coverage for BraintreeHttpClient, EligiblePaymentsApi and ShopperInsightsClient

* Use BraintreeException instead of a NullPointerException

---------

Co-authored-by: sshropshire <[email protected]>
Co-authored-by: Timothy Chow <[email protected]>

* Address PR comments

* Remove App Check From Shopper Insights and Analytics Updates (#909)

* Remove app check from Shopper Insights and update analytics logic

* Fix test names

* Add function for callbackSuccess

* update enum for analytics event names

* Helper method for onSuccess

* Adding new line

* Remove .value

* Remove semicolon on package

* Add PayPal-Client-Metadata-Id to Shopper Insights API Call (#912)

* Add PayPal-Client-Metadata-Id to shopper insights API call

* Fix spacing lint issue

* Remove unneeded empty map in ApiClient

* Add PayPal Messaging Feature to Demo App (#915)

* Add PayPalMessagingFragment to Demo app
* Add button to demo app to select this feature
* Implement PayPalMessagingView
* Update PayPalMessagingView method and subclass FrameLayout so the class is a view type
* Move context to constructor vs in start method as it is needed for FrameLayout subclass
* Update CHANGELOG with these changes

* [Shopper Insights] Demo App Parity (#913)

 - Add Venmo & PayPal Vault buttons to ShopperInsights demo
    - Disable Venmo & PP buttons until `getRecommendedPaymentMethods()` result
 - Add default email & phone test values to trigger mocked API response

* Add optional param, payerEmail, to PayPalVaultRequest (#918)

* Cleanup PayPal Messaging Implementation (#927)

* Move to setListener() pattern used in other modules
* Remove unneeded else block

* Remove payee and merchant id from eligible payments API request (#929)

* Add Unit Tests for PayPal Messaging (#925)

* Add Unit Tests for PayPal Messaging feature

Co-authored-by: Justin Warmkessel <[email protected]>

* DocString on Country Restrictions

* fix line length lint error

* Jax PR feedback

* Add merchant logging in the Shopper Insights demo flow (#933)

* Update Dependencies (#936)

* Update Room to 2.6.1 and Dokka to 1.9.10

* Update gson to 2.10.0 in the demo module

* Update Play Services to 19.3.0

* Add network config for Demo app (#938)

* Add has user location consent to Data Collector and PayPal Data Collector (#954)

* Add hasUserLocationConsent param to the Data Collector and PayPal Data Collector modules

* Add unit tests for overloaded methods defaulting to false

* Add deprecation annotation and add feature branch snapshot trigger

* Add test case when request object is passed in

* Add workflow dispatch

* Add has user location consent param in PayPal, PayPal Native, and Local Payment modules (#956)

* Add hasUserLocationConsent parameter to the PayPal module

* Add hasUserLocationConsent parameter to the PayPal Native module

* Add hasUserLocationConsent parameter to the Local Payment Module

* Update changelog for hasUserLocationConsent interface changes

* Update changelog for Data Collector and PayPal Data Collector

* Update changelog wording and change unit test assertion

* Update PayPalNativeCheckout/src/main/java/com/braintreepayments/api/PayPalNativeCheckoutVaultRequest.java

Co-authored-by: Sarah Koop <[email protected]>

* Add empty constructor for PayPalRequest

---------

Co-authored-by: Sarah Koop <[email protected]>

* Update PULL_REQUEST_TEMPLATE.MD (#957)

* Add GooglePay.isReadyToPay() with Context Parameter (#951)

* Add isReadyToPay method for GooglePayClient with Context.

* Add unit tests for GooglePayClient application context when calling isReadyToPay.

* Fix error message for null context in GooglePayClient.isReadyToPay.

* Fix unit test issue.

* Add CHANGELOG entry.

* Update Magnes SDK and Add Javadocs for the hasUserLocationConsent Param (#961)

* Update Magnes SDK to 5.5.0 and add javadocs for the hasUserLocationConsent param in Local Payment and PayPal modules

* Revert PayPalNative interface changes

* Add docs for DataCollector and PayPalDataCollector

* Update CHANGELOG.md to add Magnes version bump

Co-authored-by: Sarah Koop <[email protected]>

* Bump Detekt to 1.23.6 for ignoring maxLineLength for comments that contain URLs

---------

Co-authored-by: Sarah Koop <[email protected]>

* Remove changlog links to developer docs for the Google Play Store Rejection fix

* Update PayPal/src/main/java/com/braintreepayments/api/PayPalCheckoutRequest.java

Co-authored-by: Sarah Koop <[email protected]>

* Use new constructor for LocalPaymentRequest

* Fix indent for Google Play changelog

Co-authored-by: Sarah Koop <[email protected]>

* Remove internal javadoc

Co-authored-by: Sarah Koop <[email protected]>

* Fix indent for Google Play changelog and move riskCorrelationId into PayPalDataCollector

* Fix javadoc syntax

* Fix compile error in PayPalDataCollectorTest (#967)

* Release 4.44.0

* Prepare for development

* Add Google Pay Direct Integration (#972)

* Make direct Google Pay integration method public

* Add new certs to v4 (#969)

* Updated expiring certs

* Update CHANGELOG.md

* Updated cert output file

* PayPal Native - Play Store Compliance Fix (#977)

* Bump MXO SDK to 1.3.2 and bump Magnes SDK to 5.5.1

* Add hasUserLocationConsent boolean to PayPal Native request classes and pass flag to the MXO SDK and Magnes

* Add sections to CHANGELOG.md

Co-authored-by: Sarah Koop <[email protected]>

* Update hasUserLocationConsent doc to remove optional

Co-authored-by: Sarah Koop <[email protected]>

* Make PayPalNativeRequest constructor package private

Co-authored-by: Sarah Koop <[email protected]>

---------

Co-authored-by: Sarah Koop <[email protected]>

* Release 4.45.0

* Prepare for development

* Remove duplicate test

* Buyer Email for PayPal One Time Checkout (#978)

* Pass buyer email to PayPal one time checkout

* Update changelog

* Add input for setting buyer email address in the demo app (#979)

* Send `link_type` FPTI tag (#976)

* Add linkt type parameter used by Venmo Client

* Fix some UTs

* Add description on CHANGELOG

* Update UTs

* Address PR comments

* Migrate database

* Delete unnecessary file

* Fix lint

* Fix lint

* Add database migration support from version 1 to version 3

* Revert changes on v2 json file

* Remove unnecessary manual migration

* Add ExperimentalBetaApi annotation (#985)

* Add ExperimentalBetaApi annotation

* Add kdocs to annotation class

* Add New Demo Tokenization Key for PayPal (#996)

* Add new tokenization key

* Fix keys and settings

* Bump PayPal Messages to v1.0.0 develop.2 (#981)

* Update Gradle with PayPal Messages 1.0.0-develop.2

* Replace PayPalMessagingPlacement with PayPalMessagingPageType

* Update PayPalMessagingRequest

* Fix UTs

* Update CHANGELOG

* Add version SDK name method on Braintree Client

* Rename PayPalMessagingLogoType case simple to none

* Update UT

* Remove getter and add Version Name on gradle file

* Fix UTs

* Replace rawValue with internalValue

* Replace default logo type and textAligment values with the same default values in PayPalMessageStyle

* Revert color parameter on request constructor

* Revert Request default values

* Update README - Added upgrade SDK message (#994)

* Update README - Added upgrade SDK message

* Added Announcements section

* Handle empty email address (#1000)

* Prevent sending email param when email is empty and send postal code in the demo app

* Use put instead of putOpt

* Add `venmo_installed` Analytics tag (#991)

* Add venmo_installed Analytics tag

* revert changes to 3.json

* fix lint error

* fix autoMigration

* venmoInstalled in BraintreeClient

* Steven PR feedback: deviceInspector init in constructor

* Write venmoInstalled values to analytics db

* Steven PR feedback, incremental database migration

---------

Co-authored-by: Sai <[email protected]>

* Add requiresOptin (#1001)

* Add ExperimentalBetaApi annotation

[email protected]
[email protected]

---------

Co-authored-by: Sai <[email protected]>

* Paypal messaging feature update dependency (#1002)

[email protected]
[email protected]
[email protected]

* Update the unit test

* Update to dependency 1.0.0

* Add isEligibleInPayPalNetwork boolean to ShopperInsightsInfo (#1005)

* Add isEligibleInPayPalNetwork boolean to ShopperInsightsInfo

* Add kdoc for isEligibleInPayPalNetwork

* Add Shopper Insights to the changelog (#1006)

* Add Shopper Insights to the changelog

* Remove individual classes

Co-authored-by: Sarah Koop <[email protected]>

---------

Co-authored-by: Sarah Koop <[email protected]>

* Send `is_vault` FPTI tag (#1004)

* Update Analytics database with isVaultResquest parameter

* Add isVaultResquest keys on client

* Update BraintreeClient.sendAnalytics with isVaultRequest parameter

* Add isVaultRequest in sendAnalytics calls for PayPalClient

* Add isVaultRequest in semdAnalytitcs calls for VenmoClient

* Set isVaultRequest up on VenmoClient

* Update AnalyticsClientTests

* Update PayPal client tests

* Update CHANGELOG

* Fix lint

* Fix VisaCheckout module after adding new parameter in sendAnalyticsEvent

* Fix Venmo Client UTs

* Update PayPalNativeCheckoutClient with isVaultRequest parameter in sendAnalytics method

* Update Changelog

* Update CHANGELOG

* Update Changelog

* bump paypal messaging to version 1.0.1 (#1010)

* Chore messaging set global analytics (#1007)

* Use PayPalMessageConfig setGlobalAnalytics for integration and version

[email protected]
[email protected]
[email protected]

* Update PayPalMessaging/src/main/java/com/braintreepayments/api/PayPalMessagingView.kt

Co-authored-by: Jax DesMarais-Leder <[email protected]>

---------

Co-authored-by: Jax DesMarais-Leder <[email protected]>

* Update PayPalInternalClient to use Pairing ID as Client Metadata ID (#983)

* Update PayPalInternalClient to use pairing ID as client metadata ID by default.

* Set applicationGuid for data collector request

* Add unit tests for ba_token and token url param parsing from PayPal redirect URL.

* Fix unit tests for PayPal Native Checkout.

---------

Co-authored-by: Sai <[email protected]>

* Update existing PayPalMessagingView (#1013)

* Create internal messageView property to track if has been initialized

* Add test to validate number of subviews

* Address PR comment

* update changelog.md (#1017)

* Release 4.45.1

* Prepare for development

* Log context ID analytics before launching PayPal browser switch (#1018)

* Release 4.46.0

* Prepare for development

* Shopper Insights Final Changes (#1024)

* Remove merchantId from EligiblePaymentsApiRequest

* Use the default tokenization key for prod

* Remove new line

* Update ShopperInsights changelog

* Fix demo app fragment layout

* Update CHANGELOG with Missing Timestamps (#1022)

* Add missing CHANGELOG for pointed versions.

* Add additional timestamps manually.

* Fix 3DS Black Screen Bug on Android 14 (#1025)

* Add translucent theme to ThreeDSecureActivity.

* Add reference links.

* Update CHANGELOG.

* App links feature (#1027)

* Add appLinkReturnUri to BraintreeClient (#980)

* Add appLinkReturnUri to BraintreeClient and collapse BraintreeClient constructors using default values

* Add doc strings and unit tests

* Update BraintreeCore/src/main/java/com/braintreepayments/api/BraintreeClient.kt

Co-authored-by: Sarah Koop <[email protected]>

* Update changelog for appLinkReturnUri

* Fix lint

---------

Co-authored-by: Sarah Koop <[email protected]>

* Add useAppLinkReturn to PayPalRequest (#984)

* Add useAppLinkReturn to PayPalRequest for Android App Link support

* Update changelog

* Update property name to appLinkEnabled

* Update PayPal/src/main/java/com/braintreepayments/api/PayPalRequest.java

Co-authored-by: Sarah Koop <[email protected]>

---------

Co-authored-by: Sarah Koop <[email protected]>

* Send app link URL to PayPal API (#986)

* Add ability to launch PayPal flows with app links (#988)

* Add ability to launch PayPal flows with app links

* Add demo merchant site URL

* Add intent filter for demo app link (#989)

* Pass app link to browser switch (#999)

* Pass app link uri to BrowserSwtichOptions.

* update browser-switch dependency

* Update CHANGELOG.md

Co-authored-by: Sarah Koop <[email protected]>

* Update PayPal/src/main/java/com/braintreepayments/api/PayPalClient.java

Co-authored-by: Sarah Koop <[email protected]>

---------

Co-authored-by: Sarah Koop <[email protected]>

* exclude tests from LargeClass detekt rule

---------

Co-authored-by: Tim Chow <[email protected]>
Co-authored-by: Sarah Koop <[email protected]>

* Release 4.47.0

* Prepare for development

* Resolve compile issues caused by merge conflicts

* Fix lint issues and failing unit tests (WIP)

* Fix remaining Venmo tests

---------

Co-authored-by: agedd <[email protected]>
Co-authored-by: Jax DesMarais-Leder <[email protected]>
Co-authored-by: Max Hastings <[email protected]>
Co-authored-by: Sarah Koop <[email protected]>
Co-authored-by: saperi <[email protected]>
Co-authored-by: saperi22 <[email protected]>
Co-authored-by: sshropshire <[email protected]>
Co-authored-by: mhastings <[email protected]>
Co-authored-by: Justin Warmkessel <[email protected]>
Co-authored-by: scannillo <[email protected]>
Co-authored-by: warmkesselj <[email protected]>
Co-authored-by: Sammy Cannillo <[email protected]>
Co-authored-by: Victoria Park <[email protected]>
Co-authored-by: braintreeps <[email protected]>
Co-authored-by: Stephanie <[email protected]>
Co-authored-by: Rich Herrera <[email protected]>
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.

5 participants