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

Merge Main into v5 #1029

Merged
merged 141 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
eaeecd2
Create PayPalMessaging Module (#847)
agedd Dec 12, 2023
5cc27c1
Add Payment Insights Client public API shell (#844)
MaxHastingsPP Dec 12, 2023
ae80418
Create ShopperInsights module and move files there. (#853)
saperi22 Dec 14, 2023
dc17712
Merge branch 'main' into paypal-messaging-feature
jaxdesmarais Dec 18, 2023
be83515
Add PayPal Messaging Release Steps (#863)
jaxdesmarais Dec 18, 2023
31f10d9
Add Shopping Insights Demo App Integration (#854)
MaxHastingsPP Dec 20, 2023
b83c3c0
rename PayPalMessagingClient to PayPalMessagingView (#870)
jaxdesmarais Dec 21, 2023
883ef28
Shopper Insights - Merchant analytics (#869)
saperi22 Dec 21, 2023
4a06d4b
Adding PayPal and Venmo apps installed check (#872)
saperi22 Jan 4, 2024
ae3cb40
Created Shopping Insight Api request with default values
MaxHastingsPP Jan 8, 2024
421b336
Created Shopper Insight Api Result
MaxHastingsPP Jan 8, 2024
9802ba6
change api result to camel case
MaxHastingsPP Jan 8, 2024
c2949b2
fix
MaxHastingsPP Jan 8, 2024
49f1186
create body and api separate classes
MaxHastingsPP Jan 9, 2024
78ca51a
fix unit test
MaxHastingsPP Jan 9, 2024
954e38b
fix detekt
MaxHastingsPP Jan 9, 2024
17a901a
remove gson
MaxHastingsPP Jan 10, 2024
669702f
add ShopperInsightApiResultTest
MaxHastingsPP Jan 10, 2024
22ac3e1
change to internal
MaxHastingsPP Jan 10, 2024
729a484
separate data class files
MaxHastingsPP Jan 10, 2024
a21859c
drop call name from shopping api class
MaxHastingsPP Jan 10, 2024
1fd4a1b
remove vault tokens not needed
MaxHastingsPP Jan 11, 2024
ae44bab
renamed to ShopperInsightsApi
MaxHastingsPP Jan 11, 2024
88f7dad
var to val for request data
MaxHastingsPP Jan 11, 2024
84d19b3
fixed name shoppingInsightsApi
MaxHastingsPP Jan 11, 2024
5ec0a51
removed options and default from ShopperInsightsPaymentMethodDetails
MaxHastingsPP Jan 11, 2024
aa7b6a1
rename to eligibleInPayPalNetwork
MaxHastingsPP Jan 11, 2024
1cf609c
fix eligibleInPayPalNetwork
MaxHastingsPP Jan 11, 2024
c1a011b
fixed json optional object
MaxHastingsPP Jan 11, 2024
cf074a2
rename to ShoppingInsightsCreateBodyUnitTest
MaxHastingsPP Jan 11, 2024
0b09874
fix ShopperInsightApiResultUnitTest
MaxHastingsPP Jan 11, 2024
3fdfc89
Adding analytics events for Shopper Insights (#882)
saperi22 Jan 11, 2024
90b4dda
move toJson into shopper request api
MaxHastingsPP Jan 16, 2024
87a282f
create shopper api wrapper class for client
MaxHastingsPP Jan 16, 2024
db185b2
fix gradle missing empty space
MaxHastingsPP Jan 16, 2024
503e359
reorganize and renamed classes
MaxHastingsPP Jan 16, 2024
93be0f0
update class docs
MaxHastingsPP Jan 16, 2024
14884e8
move out of findeligiblepayments package
MaxHastingsPP Jan 16, 2024
d69883a
remove Find
MaxHastingsPP Jan 16, 2024
d4e0022
match class name eligiblePaymentsApi
MaxHastingsPP Jan 16, 2024
0d98f05
Merge pull request #880 from braintree/payment-insights-default-values
MaxHastingsPP Jan 16, 2024
0b4f2c5
Add PayPal Messaging Dependency (#888)
jaxdesmarais Jan 16, 2024
0a04a39
Merge branch 'main' into paypal-messaging-feature
jaxdesmarais Jan 18, 2024
f2c225e
Paypal Messaging Implementation (#895)
jaxdesmarais Jan 24, 2024
550b70e
Messaging analytics
warmkesselj Jan 29, 2024
7af5086
Add network call for shopper insights (#894)
MaxHastingsPP Feb 2, 2024
6bc1708
Address PR comments
warmkesselj Feb 6, 2024
a63abe8
Remove App Check From Shopper Insights and Analytics Updates (#909)
tdchow Feb 6, 2024
8163fd6
update enum for analytics event names
warmkesselj Feb 7, 2024
101aa3c
Helper method for onSuccess
warmkesselj Feb 7, 2024
1ceae11
Adding new line
warmkesselj Feb 7, 2024
e256019
Remove .value
warmkesselj Feb 7, 2024
323f6a1
Remove semicolon on package
warmkesselj Feb 7, 2024
5967d2c
Add PayPal-Client-Metadata-Id to Shopper Insights API Call (#912)
tdchow Feb 8, 2024
d80a369
Add PayPal Messaging Feature to Demo App (#915)
jaxdesmarais Feb 9, 2024
bc677f5
[Shopper Insights] Demo App Parity (#913)
scannillo Feb 12, 2024
4919ac1
Merge branch 'paypal-messaging-feature' into paypal-messaging-feature…
warmkesselj Feb 13, 2024
f1246a2
Merge pull request #907 from braintree/paypal-messaging-feature-analy…
warmkesselj Feb 13, 2024
6c181c7
Merge branch 'main' into payment-insights-complete-feature
scannillo Feb 15, 2024
fe7be70
Add optional param, payerEmail, to PayPalVaultRequest (#918)
tdchow Feb 15, 2024
09400f8
Cleanup PayPal Messaging Implementation (#927)
jaxdesmarais Feb 26, 2024
7a777dc
Remove payee and merchant id from eligible payments API request (#929)
tdchow Feb 26, 2024
e603918
Add Unit Tests for PayPal Messaging (#925)
jaxdesmarais Feb 27, 2024
5af5304
DocString on Country Restrictions
KunJeongPark Feb 28, 2024
79e9cd5
fix line length lint error
KunJeongPark Feb 28, 2024
908d99e
Jax PR feedback
KunJeongPark Feb 28, 2024
d2b42b8
Merge pull request #932 from braintree/countryRestrictions
KunJeongPark Feb 28, 2024
a22da32
Add merchant logging in the Shopper Insights demo flow (#933)
tdchow Feb 28, 2024
7eb57c8
Update Dependencies (#936)
tdchow Mar 5, 2024
3ce05aa
Add network config for Demo app (#938)
saperi22 Mar 7, 2024
d589b21
Add has user location consent to Data Collector and PayPal Data Colle…
tdchow Mar 27, 2024
cbbd389
Add has user location consent param in PayPal, PayPal Native, and Loc…
tdchow Mar 29, 2024
77a1bd0
Update PULL_REQUEST_TEMPLATE.MD (#957)
sarahkoop Mar 29, 2024
b30e129
Merge branch 'main' into paypal-messaging-feature
jaxdesmarais Mar 29, 2024
7883ad3
Add GooglePay.isReadyToPay() with Context Parameter (#951)
sshropshire Apr 1, 2024
8b3589d
Update Magnes SDK and Add Javadocs for the hasUserLocationConsent Par…
tdchow Apr 3, 2024
f1e488c
Merge branch 'main' into user-location-consent-feature
tdchow Apr 3, 2024
335aecf
Remove changlog links to developer docs for the Google Play Store Rej…
tdchow Apr 3, 2024
9568ac3
Update PayPal/src/main/java/com/braintreepayments/api/PayPalCheckoutR…
tdchow Apr 3, 2024
d329453
Use new constructor for LocalPaymentRequest
tdchow Apr 3, 2024
d06237b
Merge branch 'user-location-consent-feature' of https://github.com/br…
tdchow Apr 3, 2024
f2097f6
Fix indent for Google Play changelog
tdchow Apr 4, 2024
730042b
Remove internal javadoc
tdchow Apr 4, 2024
4566581
Fix indent for Google Play changelog and move riskCorrelationId into …
tdchow Apr 4, 2024
abde578
Merge branch 'user-location-consent-feature' of https://github.com/br…
tdchow Apr 4, 2024
bc47a7d
Fix javadoc syntax
tdchow Apr 4, 2024
f55ad9c
Merge pull request #962 from braintree/user-location-consent-feature
tdchow Apr 4, 2024
16f9e69
Fix compile error in PayPalDataCollectorTest (#967)
tdchow Apr 5, 2024
f97b8b0
Release 4.44.0
braintreeps Apr 5, 2024
6da53c2
Prepare for development
braintreeps Apr 5, 2024
c670608
Add Google Pay Direct Integration (#972)
sarahkoop Apr 11, 2024
3e071c3
Add new certs to v4 (#969)
stechiu Apr 12, 2024
14e072f
PayPal Native - Play Store Compliance Fix (#977)
tdchow Apr 16, 2024
ba75b84
Release 4.45.0
braintreeps Apr 16, 2024
d1f3bc5
Prepare for development
braintreeps Apr 16, 2024
2ffebd3
Merge main into payment-insights-complete-feature
tdchow Apr 18, 2024
7e74dc7
Remove duplicate test
tdchow Apr 18, 2024
1d660af
Buyer Email for PayPal One Time Checkout (#978)
tdchow Apr 18, 2024
1279315
Add input for setting buyer email address in the demo app (#979)
tdchow Apr 19, 2024
426544a
Send `link_type` FPTI tag (#976)
richherrera Apr 24, 2024
6b5d8c6
Merge branch 'main' into paypal-messaging-feature
jaxdesmarais Apr 24, 2024
923b6df
Add ExperimentalBetaApi annotation (#985)
saperi22 May 7, 2024
54562d3
Add New Demo Tokenization Key for PayPal (#996)
sarahkoop May 7, 2024
68e46cb
Bump PayPal Messages to v1.0.0 develop.2 (#981)
richherrera May 7, 2024
a8be657
Update README - Added upgrade SDK message (#994)
stechiu May 7, 2024
fa2d6d6
Handle empty email address (#1000)
tdchow May 14, 2024
22fec75
Add `venmo_installed` Analytics tag (#991)
KunJeongPark May 15, 2024
f7c9efe
Add requiresOptin (#1001)
warmkesselj May 16, 2024
860eb00
Paypal messaging feature update dependency (#1002)
warmkesselj May 16, 2024
377233b
Add isEligibleInPayPalNetwork boolean to ShopperInsightsInfo (#1005)
tdchow May 21, 2024
43c8a1a
Add Shopper Insights to the changelog (#1006)
tdchow May 21, 2024
bbd03ac
Send `is_vault` FPTI tag (#1004)
richherrera May 22, 2024
2eb69db
bump paypal messaging to version 1.0.1 (#1010)
jaxdesmarais May 24, 2024
fdc7107
Chore messaging set global analytics (#1007)
warmkesselj May 24, 2024
598ace5
Update PayPalInternalClient to use Pairing ID as Client Metadata ID (…
sshropshire May 24, 2024
6e13948
Update existing PayPalMessagingView (#1013)
richherrera May 28, 2024
67d95b8
Merge branch 'main' into paypal-messaging-feature
jaxdesmarais May 28, 2024
c0cf0ef
Merge branch 'paypal-messaging-feature' of https://github.com/braintr…
jaxdesmarais May 28, 2024
4f00256
update changelog.md (#1017)
saperi22 May 28, 2024
9044126
Release 4.45.1
braintreeps May 28, 2024
ea8d187
Prepare for development
braintreeps May 28, 2024
a485b10
Merge branch 'main' into paypal-messaging-feature
jaxdesmarais May 28, 2024
6520ac2
Log context ID analytics before launching PayPal browser switch (#1018)
sarahkoop May 29, 2024
8444746
Merge pull request #1015 from braintree/paypal-messaging-feature
jaxdesmarais May 30, 2024
19ad8a7
Release 4.46.0
braintreeps May 30, 2024
95758a0
Prepare for development
braintreeps May 30, 2024
37f569a
Merge branch 'main' into payment-insights-complete-feature
tdchow Jun 4, 2024
17272dd
Shopper Insights Final Changes (#1024)
tdchow Jun 5, 2024
1d05bfd
Merge pull request #1023 from braintree/payment-insights-complete-fea…
tdchow Jun 5, 2024
b5461b3
Fix demo app fragment layout
tdchow Jun 5, 2024
1484d46
Update CHANGELOG with Missing Timestamps (#1022)
sshropshire Jun 5, 2024
b0a7121
Merge pull request #1026 from braintree/fix-demo-fragment-layout
tdchow Jun 5, 2024
e3ff614
Fix 3DS Black Screen Bug on Android 14 (#1025)
sshropshire Jun 6, 2024
0853910
App links feature (#1027)
saperi22 Jun 6, 2024
87df2d4
Release 4.47.0
braintreeps Jun 6, 2024
7c950a2
Prepare for development
braintreeps Jun 6, 2024
d268b04
Merge branch 'main' into main-into-v5
tdchow Jun 7, 2024
769d9f9
Merge branch 'main' into main-into-v5
tdchow Jun 7, 2024
15da345
Resolve compile issues caused by merge conflicts
tdchow Jun 7, 2024
1625e4e
Fix lint issues and failing unit tests (WIP)
tdchow Jun 7, 2024
a8ec39c
Fix remaining Venmo tests
tdchow Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,30 @@ jobs:
uses: ./.github/actions/unit_test_module
with:
module: PayPal
unit_test_paypal_messaging:
name: PayPal Messaging 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: PayPalMessaging
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 @@ -173,6 +197,8 @@ jobs:
unit_test_google_pay,
unit_test_local_payment,
unit_test_paypal,
unit_test_paypal_messaging,
unit_test_shopper_insights,
unit_test_three_d_secure,
unit_test_venmo,
unit_test_visa_checkout,
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/release_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,30 @@ jobs:
uses: ./.github/actions/unit_test_module
with:
module: PayPal
unit_test_paypal_messaging:
name: PayPal Messaging 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: PayPalMessaging
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 @@ -173,6 +197,8 @@ jobs:
unit_test_google_pay,
unit_test_local_payment,
unit_test_paypal,
unit_test_paypal_messaging,
unit_test_shopper_insights,
unit_test_three_d_secure,
unit_test_venmo,
unit_test_visa_checkout,
Expand Down
1 change: 1 addition & 0 deletions BraintreeCore/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ dependencies {
testImplementation deps.mockitoCore
testImplementation deps.jsonAssert
testImplementation deps.mockk
testImplementation deps.kotlinTest
testImplementation project(':PayPal')
testImplementation project(':TestUtils')
testImplementation project(':Venmo')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"formatVersion": 1,
"database": {
"version": 4,
"identityHash": "aea9bd6b15fd0bdcccc15f2ee9ed326a",
"entities": [
{
"tableName": "analytics_event",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `paypal_context_id` TEXT, `link_type` TEXT, `timestamp` INTEGER NOT NULL, `venmo_installed` INTEGER NOT NULL DEFAULT 0, `_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL)",
"fields": [
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "payPalContextId",
"columnName": "paypal_context_id",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "linkType",
"columnName": "link_type",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "timestamp",
"columnName": "timestamp",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "venmoInstalled",
"columnName": "venmo_installed",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "id",
"columnName": "_id",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"_id"
],
"autoGenerate": true
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'aea9bd6b15fd0bdcccc15f2ee9ed326a')"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"formatVersion": 1,
"database": {
"version": 5,
"identityHash": "be2819613b2d28975a74cd80ed788cd5",
"entities": [
{
"tableName": "analytics_event",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `paypal_context_id` TEXT, `link_type` TEXT, `timestamp` INTEGER NOT NULL, `venmo_installed` INTEGER NOT NULL DEFAULT 0, `is_vault` INTEGER NOT NULL DEFAULT 0, `_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL)",
"fields": [
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "payPalContextId",
"columnName": "paypal_context_id",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "linkType",
"columnName": "link_type",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "timestamp",
"columnName": "timestamp",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "venmoInstalled",
"columnName": "venmo_installed",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "isVault",
"columnName": "is_vault",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "id",
"columnName": "_id",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"_id"
],
"autoGenerate": true
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'be2819613b2d28975a74cd80ed788cd5')"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public void setUp() {
public void sendsCorrectlyFormattedAnalyticsRequestToWorkManager() throws Exception {
Authorization authorization = Authorization.fromString(Fixtures.TOKENIZATION_KEY);
Configuration configuration = Configuration.fromJson(Fixtures.CONFIGURATION_WITH_ENVIRONMENT);

AnalyticsEvent event = new AnalyticsEvent("event.started", null, null, 123);
AnalyticsEvent event = new AnalyticsEvent("event.started", null, null, 123, false, false);

AnalyticsClient sut = new AnalyticsClient(context);
UUID workSpecId = sut.sendEvent(configuration, event, "sessionId", "custom", authorization);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.braintreepayments.api

/**
* The annotated method or class is in beta. It's public API may change or be removed in future releases.
*/
@RequiresOptIn
@Retention(AnnotationRetention.BINARY)
annotation class ExperimentalBetaApi
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ internal class AnalyticsClient @VisibleForTesting constructor(
.putString(WORK_INPUT_KEY_PAYPAL_CONTEXT_ID, event.payPalContextId)
.putString(WORK_INPUT_KEY_LINK_TYPE, event.linkType)
.putLong(WORK_INPUT_KEY_TIMESTAMP, event.timestamp)
.putBoolean(WORK_INPUT_KEY_VENMO_INSTALLED, event.venmoInstalled)
.putBoolean(WORK_INPUT_KEY_IS_VAULT_REQUEST, event.isVaultRequest)
.build()

val analyticsWorkRequest =
Expand All @@ -65,11 +67,20 @@ internal class AnalyticsClient @VisibleForTesting constructor(
val payPalContextId = inputData.getString(WORK_INPUT_KEY_PAYPAL_CONTEXT_ID)
val linkType = inputData.getString(WORK_INPUT_KEY_LINK_TYPE)
val timestamp = inputData.getLong(WORK_INPUT_KEY_TIMESTAMP, INVALID_TIMESTAMP)
val venmoInstalled = inputData.getBoolean(WORK_INPUT_KEY_VENMO_INSTALLED, false)
val isVaultRequest = inputData.getBoolean(WORK_INPUT_KEY_IS_VAULT_REQUEST, false)

return if (eventName == null || timestamp == INVALID_TIMESTAMP) {
ListenableWorker.Result.failure()
} else {
val event = AnalyticsEvent(eventName, payPalContextId, linkType, timestamp)
val event = AnalyticsEvent(
eventName,
payPalContextId,
linkType,
timestamp,
venmoInstalled,
isVaultRequest
)
val analyticsEventDao = analyticsDatabase.analyticsEventDao()
analyticsEventDao.insertEvent(event)
ListenableWorker.Result.success()
Expand Down Expand Up @@ -159,11 +170,11 @@ internal class AnalyticsClient @VisibleForTesting constructor(
try {
val analyticsRequest = serializeEvents(authorization, events, metadata)
httpClient.post(
FPTI_ANALYTICS_URL,
analyticsRequest.toString(),
null,
authorization,
HttpNoResponse()
path = FPTI_ANALYTICS_URL,
data = analyticsRequest.toString(),
configuration = null,
authorization = authorization,
callback = HttpNoResponse()
)
} catch (e: JSONException) { /* ignored */
}
Expand Down Expand Up @@ -195,6 +206,8 @@ internal class AnalyticsClient @VisibleForTesting constructor(
.putOpt(PAYPAL_CONTEXT_ID_KEY, analyticsEvent.payPalContextId)
.putOpt(LINK_TYPE_KEY, analyticsEvent.linkType)
.put(TIMESTAMP_KEY, analyticsEvent.timestamp)
.put(VENMO_INSTALLED_KEY, analyticsEvent.venmoInstalled)
.put(IS_VAULT_REQUEST_KEY, analyticsEvent.isVaultRequest)
.put(TENANT_NAME_KEY, "Braintree")
eventParamsJSON.put(singleEventJSON)
}
Expand All @@ -208,6 +221,8 @@ internal class AnalyticsClient @VisibleForTesting constructor(
companion object {
private const val FPTI_ANALYTICS_URL = "https://api-m.paypal.com/v1/tracking/batch/events"
private const val PAYPAL_CONTEXT_ID_KEY = "paypal_context_id"
private const val VENMO_INSTALLED_KEY = "venmo_installed"
private const val IS_VAULT_REQUEST_KEY = "is_vault"
private const val LINK_TYPE_KEY = "link_type"
private const val TOKENIZATION_KEY = "tokenization_key"

Expand All @@ -229,6 +244,8 @@ internal class AnalyticsClient @VisibleForTesting constructor(
const val WORK_INPUT_KEY_SESSION_ID = "sessionId"
const val WORK_INPUT_KEY_TIMESTAMP = "timestamp"
const val WORK_INPUT_KEY_PAYPAL_CONTEXT_ID = "payPalContextId"
const val WORK_INPUT_KEY_VENMO_INSTALLED = "venmoInstalled"
const val WORK_INPUT_KEY_IS_VAULT_REQUEST = "isVaultRequest"
const val WORK_INPUT_KEY_LINK_TYPE = "linkType"
private const val DELAY_TIME_SECONDS = 30L

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import androidx.room.RoomDatabase

// Ref: https://developer.android.com/training/data-storage/room/migrating-db-versions
@Database(
version = 3,
version = 5,
entities = [AnalyticsEvent::class],
autoMigrations = [
AutoMigration(from = 1, to = 3),
AutoMigration(from = 2, to = 3)
AutoMigration(from = 1, to = 2),
AutoMigration(from = 2, to = 3),
AutoMigration(from = 3, to = 4),
AutoMigration(from = 4, to = 5)
]
)
internal abstract class AnalyticsDatabase : RoomDatabase() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ open class AnalyticsEvent internal constructor(
@ColumnInfo(name = "link_type")
open val linkType: String? = null,

open val timestamp: Long = System.currentTimeMillis()
open val timestamp: Long = System.currentTimeMillis(),

@ColumnInfo(name = "venmo_installed", defaultValue = "0")
open val venmoInstalled: Boolean = false,

@ColumnInfo(name = "is_vault", defaultValue = "0")
open val isVaultRequest: Boolean = false
) {
@JvmField
@PrimaryKey(autoGenerate = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ class ApiClient(private val braintreeClient: BraintreeClient) {
paymentMethod.setSessionId(braintreeClient.sessionId)

sendAnalyticsEvent("card.rest.tokenization.started")
sendPOST(url, paymentMethod.buildJSON().toString(), object : HttpResponseCallback {
override fun onResult(responseBody: String?, httpError: Exception?) {
parseResponseToJSON(responseBody)?.let { json ->
sendAnalyticsEvent("card.rest.tokenization.success")
callback.onResult(json, null)
} ?: httpError?.let { error ->
sendAnalyticsEvent("card.rest.tokenization.failure")
callback.onResult(null, error)
}
sendPOST(
url = url,
data = paymentMethod.buildJSON().toString(),
) { responseBody, httpError ->
parseResponseToJSON(responseBody)?.let { json ->
sendAnalyticsEvent("card.rest.tokenization.success")
callback.onResult(json, null)
} ?: httpError?.let { error ->
sendAnalyticsEvent("card.rest.tokenization.failure")
callback.onResult(null, error)
}
})
}
}

private fun parseResponseToJSON(responseBody: String?): JSONObject? =
Expand Down
Loading
Loading