-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate CardClient Analytics Logic Into CardAnalytics Class (#297)
* Creat CardAnalytics class. * Re-factor approve order analytics names. * Refactor additional analytics event names. * Create new success without 3DS event. * Implement CardAnalytics events for 3DS. * Extract CardAnalytics from CardClient. * Fix CardClientUnitTest after CardClient analytics refactor. * Fix detekt errors.
- Loading branch information
1 parent
36bbdd2
commit 6ac1752
Showing
3 changed files
with
209 additions
and
73 deletions.
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
CardPayments/src/main/java/com/paypal/android/cardpayments/CardAnalytics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package com.paypal.android.cardpayments | ||
|
||
import com.paypal.android.corepayments.analytics.AnalyticsService | ||
|
||
@Suppress("TooManyFunctions") | ||
class CardAnalytics( | ||
private val analyticsService: AnalyticsService | ||
) { | ||
|
||
// region Approve Order | ||
fun notifyApproveOrderStarted(orderId: String) { | ||
val eventName = "card-payments:approve-order:started" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
|
||
fun notifyApproveOrderSucceeded(orderId: String) { | ||
val eventName = "card-payments:approve-order:succeeded" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
|
||
fun notifyApproveOrderFailed(orderId: String) { | ||
val eventName = "card-payments:approve-order:failed" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
|
||
fun notifyApproveOrderAuthChallengeReceived(orderId: String) { | ||
val eventName = "card-payments:approve-order:auth-challenge-received" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
|
||
fun notifyApproveOrderAuthChallengeStarted(orderId: String?) { | ||
val eventName = "card-payments:approve-order:auth-challenge-started" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
|
||
fun notifyApproveOrderAuthChallengeSucceeded(orderId: String) { | ||
val eventName = "card-payments:approve-order:auth-challenge-succeeded" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
|
||
fun notifyApproveOrderAuthChallengeCanceled(orderId: String?) { | ||
val eventName = "card-payments:approve-order:auth-challenge-canceled" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
|
||
fun notifyApproveOrderAuthChallengeFailed(orderId: String?) { | ||
val eventName = "card-payments:approve-order:auth-challenge-failed" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
|
||
fun notifyApproveOrderUnknownError(orderId: String?) { | ||
val eventName = "card-payments:approve-order:unknown-error" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
// endregion | ||
|
||
// region Vault | ||
fun notifyVaultStarted(setupTokenId: String) { | ||
val eventName = "card-payments:vault:started" | ||
analyticsService.sendAnalyticsEvent(eventName, setupTokenId) | ||
} | ||
|
||
fun notifyVaultSucceeded(setupTokenId: String) { | ||
val eventName = "card-payments:vault:succeeded" | ||
analyticsService.sendAnalyticsEvent(eventName, setupTokenId) | ||
} | ||
|
||
fun notifyVaultFailed(setupTokenId: String?) { | ||
val eventName = "card-payments:vault:failed" | ||
analyticsService.sendAnalyticsEvent(eventName, setupTokenId) | ||
} | ||
|
||
fun notifyVaultAuthChallengeReceived(setupTokenId: String) { | ||
val eventName = "card-payments:vault:auth-challenge-received" | ||
analyticsService.sendAnalyticsEvent(eventName, setupTokenId) | ||
} | ||
|
||
fun notifyVaultAuthChallengeStarted(setupTokenId: String?) { | ||
val eventName = "card-payments:vault:auth-challenge-started" | ||
analyticsService.sendAnalyticsEvent(eventName, setupTokenId) | ||
} | ||
|
||
fun notifyVaultAuthChallengeSucceeded(setupTokenId: String) { | ||
val eventName = "card-payments:vault:auth-challenge-succeeded" | ||
analyticsService.sendAnalyticsEvent(eventName, setupTokenId) | ||
} | ||
|
||
fun notifyVaultAuthChallengeCanceled(setupTokenId: String?) { | ||
val eventName = "card-payments:vault:auth-challenge-canceled" | ||
analyticsService.sendAnalyticsEvent(eventName, setupTokenId) | ||
} | ||
|
||
fun notifyVaultAuthChallengeFailed(setupTokenId: String?) { | ||
val eventName = "card-payments:vault:auth-challenge-failed" | ||
analyticsService.sendAnalyticsEvent(eventName, setupTokenId) | ||
} | ||
|
||
fun notifyVaultUnknownError(setupTokenId: String?) { | ||
val eventName = "card-payments:vault:unknown-error" | ||
analyticsService.sendAnalyticsEvent(eventName, setupTokenId) | ||
} | ||
// endregion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters