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

Create ShopperInsights module and move files there. #853

Merged
merged 12 commits into from
Dec 14, 2023
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ jobs:
uses: ./.github/actions/unit_test_module
with:
module: SamsungPay
unit_test_shopper_insights:
name: Shopper Insights Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Java 8
uses: ./.github/actions/setup
- name: Run Unit Tests
uses: ./.github/actions/unit_test_module
with:
module: ShopperInsights
unit_test_three_d_secure:
name: ThreeDSecure Unit Tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -223,6 +235,7 @@ jobs:
unit_test_local_payment,
unit_test_paypal,
unit_test_samsung_pay,
unit_test_shopper_insights,
unit_test_three_d_secure,
unit_test_union_pay,
unit_test_venmo,
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/release_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@ jobs:
uses: ./.github/actions/unit_test_module
with:
module: SamsungPay
unit_test_shopper_insights:
name: Shopper Insights Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Java 8
uses: ./.github/actions/setup
- name: Run Unit Tests
uses: ./.github/actions/unit_test_module
with:
module: ShopperInsights
unit_test_three_d_secure:
name: ThreeDSecure Unit Tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -222,6 +234,7 @@ jobs:
unit_test_local_payment,
unit_test_paypal,
unit_test_samsung_pay,
unit_test_shopper_insights,
unit_test_three_d_secure,
unit_test_union_pay,
unit_test_venmo,
Expand Down
11 changes: 11 additions & 0 deletions ShopperInsights/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Shopper Insights Module
Copy link
Contributor

Choose a reason for hiding this comment

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

We haven't previously had module-specific READMEs - I'm open to it if we think it's useful and are going to do the same on iOS. What do other think about this?

Copy link
Contributor Author

@saperi22 saperi22 Dec 14, 2023

Choose a reason for hiding this comment

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

I don't have a strong preference on where to put it, but I'd like to see a short description of each of the modules and what capabilities they provide to the merchant/user.

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 if we want to move to module specific READMEs this should be done in a separate PR where it's added for all modules vs just one. Though I do feel like a README within a module would be generally difficult to find for merchants. We also typically rely on our public docs to communicate capabilities.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We also typically rely on our public docs to communicate capabilities.

Do you mind showing me an example?
While there's the overall capabilities of the SDK, there's probably a distinction we want to make where we let the merchants know what exactly they get by including a particular module.

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 can totally see a root level MODULES.md or something similar where we can briefly describe what the module does and also what one needs to do to create a new module.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is an example of the PayPal public docs: https://developer.paypal.com/braintree/docs/guides/paypal/overview/android/v4. The overview handles the product overview, then we have the client side + feature specific docs for the client side SDKs as well (our team is responsible for writing these). Typically most features also have a server side integration guide (our team doesn't typically write these) as well as a testing/going live section.

I think we tried having a form of docs live in both the repo and publicly on PPCP but it often resulted in one of the two being out of date so never truly having a "source of truth" for our merchants.

Copy link
Collaborator

Choose a reason for hiding this comment

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

One option might be to have links on the root readme file to the different module's readme files. This would help with the visibility issue.

If the content on each of the module's readme file is small, it might make more sense in the root readme. This way a developer doesn't need to navigate to see what each module does.

Copy link
Contributor Author

@saperi22 saperi22 Dec 14, 2023

Choose a reason for hiding this comment

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

It is just an overview of the module. I don't see it getting out of date. But that's just me.🤷‍♂️
I can remove the .md if that's how we want to roll.

Copy link
Contributor Author

@saperi22 saperi22 Dec 14, 2023

Choose a reason for hiding this comment

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

One option might be to have links on the root readme file to the different module's readme files. This would help with the visibility issue.

We already do that. I probably should have called it out to make it more clear, but yes, that's the intention.

Copy link
Contributor

@hollabaq86 hollabaq86 Dec 14, 2023

Choose a reason for hiding this comment

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

We need to leverage the public dev docs where possible and avoid additional doc maintenance on our team. We're too small and don't have the bandwidth.

If it's common or accepted practice to the Android dev community that there's a README for each individual module, we can include that file with a basic template that points folks to the public dev docs.

Otherwise, let's not adopt this for the SDK.


This module aims to provide insights about the shopper so the merchant (you!) can prominently
provide the shopper with the shopper's preferred payment option!

To include this module, add the following dependency.
```groovy
dependencies {
implementation 'com.braintreepayments.api:shopper-insights:{version}'
}
```
54 changes: 54 additions & 0 deletions ShopperInsights/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
saperi22 marked this conversation as resolved.
Show resolved Hide resolved
id 'org.jetbrains.dokka'
}

android {
namespace 'com.braintreepayments.api.shopperinsights'
compileSdk rootProject.compileSdkVersion

defaultConfig {
minSdk rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

testOptions {
unitTests {
includeAndroidResources = true
all {
jvmArgs '-noverify'
}
}
}

compileOptions {
sourceCompatibility versions.javaSourceCompatibility
targetCompatibility versions.javaTargetCompatibility
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
implementation deps.coreKtx

testImplementation deps.jsonAssert
testImplementation deps.kotlinTest
testImplementation deps.mockk
}

// region signing and publishing

project.ext.name = "shopper-insights"
project.ext.pom_name = "shopper-insights"
project.ext.group_id = "com.braintreepayments.api"
project.ext.version = rootProject.version
project.ext.pom_desc = "Shopper Insights for Braintree Android."

apply from: rootProject.file("gradle/gradle-publish.gradle")

// endregion
4 changes: 4 additions & 0 deletions ShopperInsights/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ detekt {
"TestUtils/src",
"ThreeDSecure/src",
"Venmo/src",
"ShopperInsights/src"
)
autoCorrect = project.hasProperty('detektAutoCorrect')
reports {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ include ':TestUtils'
include ':Demo'
include ':SEPADirectDebit'
include ':PayPalDataCollector'
include ':ShopperInsights'
Loading