Skip to content

Commit

Permalink
Update 3DS and GraphQL Endpoint Sent to FPTI (v5) (#1080)
Browse files Browse the repository at this point in the history
* update endpoint logic for 3DS and graphQL
* update constants
* add CHANGELOG entry
* simplify cleanedPath logic for 3DS
* remove analytics path check since that post request uses a different http client
  • Loading branch information
jaxdesmarais authored Jul 29, 2024
1 parent d721dd5 commit 942205a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,14 @@ class BraintreeClient @VisibleForTesting internal constructor(
) { response, httpError ->
response?.let {
try {
json?.optString(GraphQLConstants.Keys.OPERATION_NAME)
json?.optString(GraphQLConstants.Keys.QUERY)
?.let { query ->
val queryDiscardHolder = query.replace(Regex("^[^\\(]*"), "")
val finalQuery = query.replace(queryDiscardHolder, "")
val params = AnalyticsEventParams(
startTime = it.timing.startTime,
endTime = it.timing.endTime,
endpoint = query
endpoint = finalQuery
)
sendAnalyticsEvent(
CoreAnalytics.apiRequestLatency,
Expand Down Expand Up @@ -355,7 +357,11 @@ class BraintreeClient @VisibleForTesting internal constructor(
}

private fun sendAnalyticsTimingEvent(endpoint: String, timing: HttpResponseTiming) {
val cleanedPath = endpoint.replace(Regex("/merchants/([A-Za-z0-9]+)/client_api"), "")
var cleanedPath = endpoint.replace(Regex("/merchants/([A-Za-z0-9]+)/client_api"), "")
cleanedPath = cleanedPath.replace(
Regex("payment_methods/.*/three_d_secure"), "payment_methods/three_d_secure"
)

sendAnalyticsEvent(
CoreAnalytics.apiRequestLatency,
AnalyticsEventParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ object GraphQLConstants {
const val LEGACY_CODE = "legacyCode"
const val URL = "url"
const val FEATURES = "features"
const val OPERATION_NAME = "operationName"
}

object ErrorTypes {
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Braintree Android SDK Release Notes

## unreleased
* BraintreeCore
* Update `endpoint` syntax sent to FPTI for 3D Secure and Venmo flows
* Breaking Changes
* PayPal
* Remove `appLinkEnabled` from `PayPalRequest` as Android app links are now required
Expand Down

0 comments on commit 942205a

Please sign in to comment.