Skip to content

Commit

Permalink
[APPC-4731] missing analytics field
Browse files Browse the repository at this point in the history
  • Loading branch information
rodolfobcardoso committed Jan 14, 2025
1 parent 4dee2cf commit ebd52ed
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ internal class Erc681ReceiverPresenter(
transactionType = transaction?.type,
context = BillingAnalytics.WALLET_PAYMENT_METHOD,
oemId = attribution.oemId,
isWebViewPayment = true,
)
firstImpression = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ class OneStepPaymentReceiver : BaseActivity() {
transactionType = transaction?.type,
context = BillingAnalytics.WALLET_PAYMENT_METHOD,
oemId = attribution.oemId,
isWebViewPayment = true,
)
firstImpression = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ class WebViewPaymentActivity : AppCompatActivity() {
if (mappedPaymentType == PaymentMethodsAnalytics.PAYMENT_METHOD_CC)
wasCvcRequired
else null,
isWebViewPayment = true,
)
}
.subscribe({}, { it.printStackTrace() })
Expand All @@ -387,7 +388,8 @@ class WebViewPaymentActivity : AppCompatActivity() {
transactionType = transaction.type,
errorCode = errorCode,
errorDetails = errorReason,
riskRules = null
riskRules = null,
isWebViewPayment = true,
)
}
.subscribe({}, { it.printStackTrace() })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ class BillingAnalytics @Inject constructor(
errorCode: String,
errorDetails: String?,
riskRules: String?,
isOnboardingPayment: Boolean
isOnboardingPayment: Boolean,
isWebViewPayment:Boolean,
) {
val eventData = createConclusionWalletEventMap(
packageName = packageName,
Expand All @@ -307,6 +308,7 @@ class BillingAnalytics @Inject constructor(
this[EVENT_ERROR_CODE] = errorCode
errorDetails?.let { this[EVENT_ERROR_DETAILS] = it }
riskRules?.let { this[EVENT_CODE_RISK_RULES] = it }
this[EVENT_PAYMENT_CHANNEL] = if (isWebViewPayment) WEBVIEW else APPCOINS_WALLET
}

analytics.logEvent(
Expand All @@ -328,6 +330,7 @@ class BillingAnalytics @Inject constructor(
valueUsd: String,
isStoredCard: Boolean?,
wasCvcRequired: Boolean?,
isWebViewPayment:Boolean,
) {
val eventData: MutableMap<String, Any?> = createConclusionWalletEventMap(
packageName = packageName,
Expand Down Expand Up @@ -358,6 +361,7 @@ class BillingAnalytics @Inject constructor(
}

eventData[EVENT_OEMID] = oemIdPreferencesDataSource.getCurrentOemId()
eventData[EVENT_PAYMENT_CHANNEL] = if (isWebViewPayment) WEBVIEW else APPCOINS_WALLET
analytics.logEvent(
eventData,
WALLET_PAYMENT_CONCLUSION,
Expand Down Expand Up @@ -401,7 +405,8 @@ class BillingAnalytics @Inject constructor(
context: String,
oemId: String?,
purchaseDetails: String?,
isOnboardingPayment: Boolean
isOnboardingPayment: Boolean,
isWebViewPayment: Boolean,
) {
val eventData = mutableMapOf<String, Any?>(
EVENT_PACKAGE_NAME to packageName,
Expand All @@ -410,6 +415,7 @@ class BillingAnalytics @Inject constructor(
EVENT_TRANSACTION_TYPE to transactionType,
EVENT_CONTEXT to context,
EVENT_OEMID to (oemId ?: ""),
EVENT_PAYMENT_CHANNEL to if (isWebViewPayment) WEBVIEW else APPCOINS_WALLET,
).apply {
purchaseDetails?.let { this[EVENT_PAYMENT_METHOD] = it }
if (isOnboardingPayment) this[EVENT_ONBOARDING_PAYMENT] = true
Expand Down Expand Up @@ -545,6 +551,9 @@ class BillingAnalytics @Inject constructor(
private const val EVENT_STORED_CARD_CVC_REQUIRED = "stored_card_cvc_required"
private const val EVENT_STORED_CARD_CVC_NOT_REQUIRED = "stored_card_cvc_not_required"
private const val EVENT_NEW_CARD = "new_card"
private const val EVENT_PAYMENT_CHANNEL = "payment_channel"
private const val WEBVIEW = "appcoins_wallet_android_webview"
private const val APPCOINS_WALLET = "appcoins_wallet_android"
const val ACTION_BUY = "buy"
const val ACTION_NEXT = "next"
const val ACTION_CANCEL = "cancel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ interface EventSender {
errorCode: String,
errorDetails: String?,
riskRules: String?,
isOnboardingPayment: Boolean = false
isOnboardingPayment: Boolean = false,
isWebViewPayment: Boolean = false
)

fun sendPaymentSuccessEvent(
Expand All @@ -116,6 +117,7 @@ interface EventSender {
valueUsd: String,
isStoredCard: Boolean? = null,
wasCvcRequired: Boolean? = null,
isWebViewPayment: Boolean = false,
)

fun sendPaymentPendingEvent(
Expand All @@ -135,7 +137,8 @@ interface EventSender {
context: String,
oemId: String?,
purchaseDetails: String? = null,
isOnboardingPayment: Boolean = false
isOnboardingPayment: Boolean = false,
isWebViewPayment: Boolean = false,
)

fun sendPaypalUrlEvent(
Expand Down

0 comments on commit ebd52ed

Please sign in to comment.