Updated on 2026-08-14

This commit is contained in:
Tangem 2023-02-03 18:32:36 +08:00
parent 2ade5a1407
commit 645cf17efb
24 changed files with 612 additions and 112 deletions

View file

@ -27,6 +27,7 @@ class BasicEventsPreChecker {
BasicTopUpEventConverter().convert(converterData)?.let { Analytics.send(it) }
}
@Suppress("ComplexMethod")
private fun isReadyToSend(data: BasicEventsSourceData): Boolean {
val (scanResponse, walletState, biometricsWalletDataModels) = data
if (walletState.derivationsCheckIsScheduled) {
@ -69,13 +70,14 @@ class BasicEventsPreChecker {
return false
}
if (biometricsWalletDataModels.any {
val isCorrectStatus = biometricsWalletDataModels.any {
it.status is WalletDataModel.Loading ||
it.status is WalletDataModel.NoAccount ||
it.status is WalletDataModel.Unreachable ||
it.status is WalletDataModel.MissedDerivation ||
it.status.isErrorStatus
}) {
}
if (isCorrectStatus) {
Timber.d("FAILED: by status")
return false
}

View file

@ -20,7 +20,8 @@ class ShopOrderToEventConverter : Converter<Pair<Storefront.Checkout, ProductTyp
ProductType.WALLET_3_CARDS -> "3"
}
val amount = "${checkout.totalPriceV2.amount} ${checkout.totalPriceV2.currencyCode.name}"
val code = (checkout.discountApplications.edges.firstOrNull()?.node as? Storefront.DiscountCodeApplication)?.code
val code = (checkout.discountApplications.edges.firstOrNull()?.node as? Storefront.DiscountCodeApplication)
?.code
return Shop.Purchased(sku, count, amount, code)
}