-
Notifications
You must be signed in to change notification settings - Fork 48
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
Align Analytics Event Names with iOS #310
Changes from 1 commit
33128fc
448f65e
72994a4
ec396f9
7d64ebe
58a93e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,51 +5,57 @@ import com.paypal.android.corepayments.analytics.AnalyticsService | |
@Suppress("TooManyFunctions") | ||
internal class CardAnalytics(private val analyticsService: AnalyticsService) { | ||
|
||
// region Approve Order | ||
fun notifyApproveOrderStarted(orderId: String) { | ||
val eventName = "card-payments:approve-order:started" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
private object ApproveOrderEvent { | ||
// @formatter:off | ||
const val STARTED = "card-payments:approve-order:started" | ||
const val SUCCEEDED = "card-payments:approve-order:succeeded" | ||
const val FAILED = "card-payments:approve-order:failed" | ||
const val AUTH_CHALLENGE_REQUIRED = "card-payments:approve-order:auth-challenge-required" | ||
|
||
fun notifyApproveOrderSucceeded(orderId: String) { | ||
val eventName = "card-payments:approve-order:succeeded" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
const val AUTH_CHALLENGE_PRESENTATION_SUCCEEDED = "card-payments:approve-order:auth-challenge-presentation:succeeded" | ||
const val AUTH_CHALLENGE_PRESENTATION_FAILED = "card-payments:approve-order:auth-challenge-presentation:failed" | ||
|
||
fun notifyApproveOrderFailed(orderId: String) { | ||
val eventName = "card-payments:approve-order:failed" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
const val AUTH_CHALLENGE_SUCCEEDED = "card-payments:approve-order:auth-challenge:succeeded" | ||
const val AUTH_CHALLENGE_FAILED = "card-payments:approve-order:auth-challenge:failed" | ||
const val AUTH_CHALLENGE_CANCELED = "card-payments:approve-order:auth-challenge-canceled" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this one also follows format There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 ok I think this got fixed I had some typos initially. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉🚢 |
||
// @formatter:on | ||
} | ||
|
||
fun notifyApproveOrderAuthChallengeReceived(orderId: String) { | ||
val eventName = "card-payments:approve-order:auth-challenge-received" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
private fun sendEvent( | ||
eventName: String, | ||
orderId: String? = null, | ||
setupTokenId: String? = null | ||
) { | ||
analyticsService.sendAnalyticsEvent(eventName, orderId ?: setupTokenId) | ||
} | ||
|
||
fun notifyApproveOrderAuthChallengeStarted(orderId: String?) { | ||
val eventName = "card-payments:approve-order:auth-challenge-started" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
// region Approve Order | ||
fun notifyApproveOrderStarted(orderId: String?) = | ||
sendEvent(ApproveOrderEvent.STARTED, orderId = orderId) | ||
|
||
fun notifyApproveOrderAuthChallengeSucceeded(orderId: String) { | ||
val eventName = "card-payments:approve-order:auth-challenge-succeeded" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
fun notifyApproveOrderSucceeded(orderId: String?) = | ||
sendEvent(ApproveOrderEvent.SUCCEEDED, orderId = orderId) | ||
|
||
fun notifyApproveOrderAuthChallengeCanceled(orderId: String?) { | ||
val eventName = "card-payments:approve-order:auth-challenge-canceled" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
fun notifyApproveOrderFailed(orderId: String?) = | ||
sendEvent(ApproveOrderEvent.FAILED, orderId = orderId) | ||
|
||
fun notifyApproveOrderAuthChallengeFailed(orderId: String?) { | ||
val eventName = "card-payments:approve-order:auth-challenge-failed" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
fun notifyApproveOrderAuthChallengeRequired(orderId: String) = | ||
sendEvent(ApproveOrderEvent.AUTH_CHALLENGE_REQUIRED, orderId = orderId) | ||
|
||
fun notifyApproveOrderUnknownError(orderId: String?) { | ||
val eventName = "card-payments:approve-order:unknown-error" | ||
analyticsService.sendAnalyticsEvent(eventName, orderId) | ||
} | ||
fun notifyApproveOrderAuthChallengePresentationSucceeded(orderId: String?) = | ||
sendEvent(ApproveOrderEvent.AUTH_CHALLENGE_PRESENTATION_SUCCEEDED, orderId = orderId) | ||
|
||
fun notifyApproveOrderAuthChallengePresentationFailed(orderId: String?) = | ||
sendEvent(ApproveOrderEvent.AUTH_CHALLENGE_PRESENTATION_FAILED, orderId = orderId) | ||
|
||
fun notifyApproveOrderAuthChallengeSucceeded(orderId: String?) = | ||
sendEvent(ApproveOrderEvent.AUTH_CHALLENGE_SUCCEEDED, orderId = orderId) | ||
|
||
fun notifyApproveOrderAuthChallengeFailed(orderId: String?) = | ||
sendEvent(ApproveOrderEvent.AUTH_CHALLENGE_FAILED, orderId = orderId) | ||
|
||
fun notifyApproveOrderAuthChallengeCanceled(orderId: String?) = | ||
sendEvent(ApproveOrderEvent.AUTH_CHALLENGE_CANCELED, orderId = orderId) | ||
// endregion | ||
|
||
// region Vault | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice!