From f174891e7b1c7ff969144b9201f168d31629bc86 Mon Sep 17 00:00:00 2001 From: Matheus Campos Date: Fri, 20 Feb 2026 10:38:50 -0300 Subject: [PATCH 1/4] feat: Add new Google Wallet Tap & Pay error codes and update Android constants with deprecation suppressions --- .../GoogleWalletImplementation.kt | 92 ++++++++++--------- .../wallet/googletapandpay/util/ErrorCode.kt | 22 ++++- .../googletapandpay/GoogleWalletMock.kt | 34 ++++--- package.json | 2 +- src/__tests__/__mocks__/index.ts | 11 +++ src/google-wallet.ios.ts | 7 ++ src/types/google-wallet.types.ts | 16 ++++ 7 files changed, 120 insertions(+), 64 deletions(-) diff --git a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt index 964ad57..667019c 100644 --- a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt +++ b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt @@ -43,7 +43,7 @@ class GoogleWalletImplementation( try { // Inicializar TapAndPayClient diretamente (sem reflexão!) tapAndPayClient = TapAndPay.getClient(reactContext) - + // Inicializar WalletOpener walletOpener = WalletOpener(reactContext) @@ -74,7 +74,7 @@ class GoogleWalletImplementation( } else { WalletLogger.d(TAG, "🔍 [GOOGLE] Intent data é null") } - + WalletLogger.i(TAG, "Push tokenize OK - Retornando resolve vazio") resolve(null) } @@ -89,7 +89,7 @@ class GoogleWalletImplementation( val errorCodeName = ErrorCode.getErrorCodeName(resultCode) val message = ErrorCode.getErrorMessage(resultCode) val errorMessage = "$message ($errorCodeName) - result_code:$resultCode" - + WalletLogger.w(TAG, "PUSH_TOKENIZE_ERROR: $errorMessage") reject("PUSH_TOKENIZE_ERROR", errorMessage) } @@ -109,7 +109,7 @@ class GoogleWalletImplementation( val errorCodeName = ErrorCode.getErrorCodeName(resultCode) val message = ErrorCode.getErrorMessage(resultCode) val errorMessage = "$message ($errorCodeName) - result_code:$resultCode" - + WalletLogger.w(TAG, "CREATE_WALLET_ERROR: $errorMessage") reject("CREATE_WALLET_ERROR", errorMessage) } @@ -135,13 +135,13 @@ class GoogleWalletImplementation( WalletLogger.w(TAG, "❌ [GOOGLE] Android ${Build.VERSION.SDK_INT} não suportado. Versão mínima requerida: Android 9.0 (API ${MIN_ANDROID_VERSION})") return false } - + // Verificar se o cliente TapAndPay está inicializado if (tapAndPayClient == null) { WalletLogger.w(TAG, "❌ [GOOGLE] Cliente TapAndPay não foi inicializado") return false } - + WalletLogger.d(TAG, "✅ [GOOGLE] Android ${Build.VERSION.SDK_INT} suportado e SDK disponível") return true } @@ -547,10 +547,10 @@ class GoogleWalletImplementation( try { intentListenerActive = true checkPendingDataFromMainActivity() - + // Processar eventos de nenhuma intent pendentes GoogleWalletModule.processNoIntentReceivedEvent(reactContext) - + promise.resolve(true) } catch (e: Exception) { WalletLogger.e(TAG, "SET_INTENT_LISTENER_ERROR: ${e.message}", e) @@ -634,7 +634,7 @@ class GoogleWalletImplementation( val webUrl = GOOGLE_WALLET_PLAY_STORE_URL val success = walletOpener!!.openWallet(packageName, appName, playStoreUrl, webUrl) - + if (success) { WalletLogger.d(TAG, "✅ [GOOGLE] Wallet aberto com sucesso") promise.resolve(true) @@ -690,10 +690,16 @@ class GoogleWalletImplementation( put("TAP_AND_PAY_SAVE_CARD_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_SAVE_CARD_ERROR) put("TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION", TapAndPayStatusCodes.TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION) put("TAP_AND_PAY_TOKENIZATION_DECLINED", TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZATION_DECLINED) +```kotlin + @Suppress("DEPRECATION") put("TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR) +``` put("TAP_AND_PAY_TOKENIZE_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZE_ERROR) put("TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED", TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED) +```kotlin + @Suppress("DEPRECATION") put("TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT", TapAndPayStatusCodes.TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT) +``` put("TAP_AND_PAY_USER_CANCELED_FLOW", TapAndPayStatusCodes.TAP_AND_PAY_USER_CANCELED_FLOW) put("TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED", TapAndPayStatusCodes.TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED) @@ -725,33 +731,33 @@ class GoogleWalletImplementation( try { // Verificar se há dados pendentes val hasData = hasPendingData() - + if (hasData) { WalletLogger.d(TAG, "✅ [GOOGLE] Dados pendentes encontrados") - + // Obter os dados pendentes sem limpar val data = getPendingIntentDataWithoutClearing() val action = getPendingIntentAction() val callingPackage = getPendingCallingPackage() - + if (data != null && data.isNotEmpty()) { WalletLogger.d(TAG, "📋 [GOOGLE] Processando dados pendentes: ${data.length} caracteres") WalletLogger.d(TAG, "📋 [GOOGLE] Action: $action, CallingPackage: $callingPackage") - + // Verificar se action e callingPackage estão disponíveis if (action == null) { WalletLogger.e(TAG, "❌ [GOOGLE] Action é null - não é possível processar intent") return } - + if (callingPackage == null) { WalletLogger.e(TAG, "❌ [GOOGLE] CallingPackage é null - não é possível processar intent") return } - + // Processar os dados como um intent usando os valores reais processWalletIntentData(data, action, callingPackage) - + // Limpar dados após processamento bem-sucedido clearPendingData() } else { @@ -772,18 +778,18 @@ class GoogleWalletImplementation( WalletLogger.d(TAG, "🔍 [GOOGLE] processWalletIntentData chamado") try { WalletLogger.d(TAG, "✅ [GOOGLE] Intent processado: $action") - + // Determinar o tipo de intent baseado na action val intentType = if (action.endsWith(".action.ACTIVATE_TOKEN")) { "ACTIVATE_TOKEN" } else { "WALLET_INTENT" } - + // Decodificar dados de base64 para string normal var decodedData = data var dataFormat = "raw" - + try { // Tentar decodificar como base64 val decodedBytes = android.util.Base64.decode(data, android.util.Base64.DEFAULT) @@ -795,22 +801,22 @@ class GoogleWalletImplementation( WalletLogger.w(TAG, "⚠️ [GOOGLE] Não foi possível decodificar como base64, usando dados originais: ${e.message}") dataFormat = "raw" } - + val eventData = Arguments.createMap() eventData.putString("action", action) eventData.putString("type", intentType) eventData.putString("data", decodedData) eventData.putString("dataFormat", dataFormat) eventData.putString("callingPackage", callingPackage) - + // Adicionar dados originais em base64 para referência eventData.putString("originalData", data) - + WalletLogger.d(TAG, "🔍 [GOOGLE] Evento preparado - Action: $action, Type: $intentType, Format: $dataFormat") - + // Enviar evento para React Native sendEventToReactNative("GoogleWalletIntentReceived", eventData) - + } catch (e: Exception) { WalletLogger.e(TAG, "❌ [GOOGLE] Erro ao processar dados da intent: ${e.message}", e) } @@ -864,10 +870,10 @@ class GoogleWalletImplementation( private const val GOOGLE_WALLET_PACKAGE = "com.google.android.gms" private const val GOOGLE_WALLET_APP_PACKAGE = "com.google.android.apps.walletnfcrel" private val GOOGLE_WALLET_PLAY_STORE_URL = "https://play.google.com/store/apps/details?id=$GOOGLE_WALLET_APP_PACKAGE&hl=pt_BR" - + // Versão mínima do Android suportada pelo Google Wallet: Android 9.0 (Pie) - API level 28 private const val MIN_ANDROID_VERSION = Build.VERSION_CODES.P - + // Variáveis estáticas para armazenar dados da intent @Volatile private var pendingIntentData: String? = null @@ -875,11 +881,11 @@ class GoogleWalletImplementation( private var pendingIntentAction: String? = null @Volatile private var pendingCallingPackage: String? = null - + // Flag para indicar se há dados pendentes @Volatile private var hasPendingIntentData: Boolean = false - + @JvmStatic fun getPendingIntentData(): String? { val data = pendingIntentData @@ -892,16 +898,16 @@ class GoogleWalletImplementation( } return data } - + @JvmStatic fun getPendingIntentAction(): String? = pendingIntentAction - + @JvmStatic fun getPendingCallingPackage(): String? = pendingCallingPackage - + @JvmStatic fun getPendingIntentDataWithoutClearing(): String? = pendingIntentData - + @JvmStatic fun clearPendingData() { pendingIntentData = null @@ -909,33 +915,33 @@ class GoogleWalletImplementation( pendingCallingPackage = null hasPendingIntentData = false } - + @JvmStatic fun hasPendingData(): Boolean = hasPendingIntentData @JvmStatic fun processIntent(activity: Activity, intent: Intent) { WalletLogger.d(TAG, "🔍 [GOOGLE] processIntent chamado") - + WalletLogger.d(TAG, "🔍 [GOOGLE] Intent encontrada: ${intent.action}") - + // Verificar se é um intent do Google Pay/Wallet if (isGooglePayIntent(intent)) { WalletLogger.d(TAG, "✅ [GOOGLE] Intent do Google Pay detectada") - + // Extrair dados da intent val extraText = intent.getStringExtra(Intent.EXTRA_TEXT) if (!extraText.isNullOrEmpty()) { WalletLogger.d(TAG, "🔍 [GOOGLE] Dados EXTRA_TEXT encontrados: ${extraText.length} caracteres") - + // Armazenar dados para processamento posterior pendingIntentData = extraText pendingIntentAction = intent.action pendingCallingPackage = activity.callingPackage hasPendingIntentData = true - + WalletLogger.d(TAG, "✅ [GOOGLE] Dados armazenados para processamento - Action: ${intent.action}, CallingPackage: ${activity.callingPackage}") - + // Limpar intent para evitar reprocessamento activity.intent = Intent() } else { @@ -945,7 +951,7 @@ class GoogleWalletImplementation( WalletLogger.d(TAG, "🔍 [GOOGLE] Intent não relacionada ao Google Pay") } } - + /** * Verifica se uma intent é relacionada ao Google Pay/Wallet */ @@ -953,10 +959,10 @@ class GoogleWalletImplementation( val action = intent.action WalletLogger.d(TAG, "🔍 [GOOGLE] Verificando intent - Action: $action") - + // Verificar action val isValidAction = action != null && action.endsWith(".action.ACTIVATE_TOKEN") - + return isValidAction } @@ -967,7 +973,7 @@ class GoogleWalletImplementation( fun isValidCallingPackage(activity: Activity): Boolean { val callingPackage = activity.callingPackage WalletLogger.d(TAG, "🔍 [GOOGLE] Chamador: $callingPackage") - + return callingPackage != null && (callingPackage == GOOGLE_WALLET_PACKAGE || callingPackage == GOOGLE_WALLET_APP_PACKAGE) } } diff --git a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt index 84b7573..4f35f5a 100644 --- a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt +++ b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt @@ -26,7 +26,7 @@ object ErrorCode { CommonStatusCodes.CONNECTION_SUSPENDED_DURING_CALL -> "CONNECTION_SUSPENDED_DURING_CALL" CommonStatusCodes.RECONNECTION_TIMED_OUT_DURING_UPDATE -> "RECONNECTION_TIMED_OUT_DURING_UPDATE" CommonStatusCodes.RECONNECTION_TIMED_OUT -> "RECONNECTION_TIMED_OUT" - + // TapAndPay Status Codes TapAndPayStatusCodes.TAP_AND_PAY_NO_ACTIVE_WALLET -> "TAP_AND_PAY_NO_ACTIVE_WALLET" TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_NOT_FOUND -> "TAP_AND_PAY_TOKEN_NOT_FOUND" @@ -36,17 +36,23 @@ object ErrorCode { TapAndPayStatusCodes.TAP_AND_PAY_SAVE_CARD_ERROR -> "TAP_AND_PAY_SAVE_CARD_ERROR" TapAndPayStatusCodes.TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION -> "TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION" TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZATION_DECLINED -> "TAP_AND_PAY_TOKENIZATION_DECLINED" +```kotlin + @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR -> "TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR" +``` TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZE_ERROR -> "TAP_AND_PAY_TOKENIZE_ERROR" TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED -> "TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED" +```kotlin + @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT -> "TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT" +``` TapAndPayStatusCodes.TAP_AND_PAY_USER_CANCELED_FLOW -> "TAP_AND_PAY_USER_CANCELED_FLOW" TapAndPayStatusCodes.TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED -> "TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED" - + else -> "UNKNOWN_ERROR_$errorCode" } } - + fun getErrorMessage(errorCode: Int): String { return when (errorCode) { // Common Status Codes - Mensagens amigáveis @@ -69,7 +75,7 @@ object ErrorCode { CommonStatusCodes.CONNECTION_SUSPENDED_DURING_CALL -> "Conexão suspensa durante chamada" CommonStatusCodes.RECONNECTION_TIMED_OUT_DURING_UPDATE -> "Tempo de reconexão esgotado durante atualização" CommonStatusCodes.RECONNECTION_TIMED_OUT -> "Tempo de reconexão esgotado" - + // TapAndPay Status Codes - Mensagens amigáveis TapAndPayStatusCodes.TAP_AND_PAY_NO_ACTIVE_WALLET -> "Nenhuma carteira ativa" TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_NOT_FOUND -> "Token não encontrado" @@ -79,13 +85,19 @@ object ErrorCode { TapAndPayStatusCodes.TAP_AND_PAY_SAVE_CARD_ERROR -> "Erro ao salvar cartão" TapAndPayStatusCodes.TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION -> "Inelegível para tokenização" TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZATION_DECLINED -> "Tokenização recusada" +```kotlin + @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR -> "Erro ao verificar elegibilidade" +``` TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZE_ERROR -> "Erro ao tokenizar" TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED -> "Ativação do token necessária" +```kotlin + @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT -> "Tempo limite de entrega de credenciais" +``` TapAndPayStatusCodes.TAP_AND_PAY_USER_CANCELED_FLOW -> "Usuário cancelou a operação" TapAndPayStatusCodes.TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED -> "Falha ao registrar cartões virtuais" - + else -> "Erro desconhecido" } } diff --git a/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt b/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt index 97ff5a9..038aa68 100644 --- a/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt +++ b/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt @@ -39,7 +39,7 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog private const val GOOGLE_WALLET_PACKAGE = "com.google.android.gms" private const val GOOGLE_WALLET_APP_PACKAGE = "com.google.android.apps.walletnfcrel" private val GOOGLE_WALLET_PLAY_STORE_URL = "https://play.google.com/store/apps/details?id=$GOOGLE_WALLET_APP_PACKAGE&hl=pt_BR" - + // Versão mínima do Android suportada pelo Google Wallet: Android 9.0 (Pie) - API level 28 private const val MIN_ANDROID_VERSION = android.os.Build.VERSION_CODES.P @@ -443,7 +443,7 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog WalletLogger.w(TAG, "❌ [MOCK] Android ${android.os.Build.VERSION.SDK_INT} não suportado. Versão mínima requerida: Android 9.0 (API ${MIN_ANDROID_VERSION})") return false } - + WalletLogger.d(TAG, "✅ [MOCK] Android ${android.os.Build.VERSION.SDK_INT} suportado") return true } @@ -466,14 +466,14 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog override fun checkWalletAvailability(promise: Promise) { WalletLogger.d(TAG, "🔍 [MOCK] checkWalletAvailability chamado") - + // Verificar versão mínima do Android (Android 9.0 - API level 28) if (android.os.Build.VERSION.SDK_INT < MIN_ANDROID_VERSION) { WalletLogger.w(TAG, "❌ [MOCK] Android ${android.os.Build.VERSION.SDK_INT} não suportado. Versão mínima requerida: Android 9.0 (API ${MIN_ANDROID_VERSION})") promise.resolve(false) return } - + fetchFromLocalAPI( endpoint = "/wallet/availability", defaultResponse = { true }, @@ -675,11 +675,11 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog promise: Promise ) { WalletLogger.d(TAG, "🔍 [MOCK] isTokenized chamado - LastFour: $fpanLastFour, Network: $cardNetwork, Provider: $tokenServiceProvider") - + if (!ensureWalletAvailable(promise, "isTokenized")) { return } - + val endpoint = "/wallet/is-tokenized?lastFour=$fpanLastFour&network=$cardNetwork&provider=$tokenServiceProvider" fetchFromLocalAPI( endpoint = endpoint, @@ -707,11 +707,11 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog promise: Promise ) { WalletLogger.d(TAG, "🔍 [MOCK] viewToken chamado - Provider: $tokenServiceProvider, TokenId: $issuerTokenId") - + if (!ensureWalletAvailable(promise, "viewToken")) { return } - + val endpoint = "/wallet/view-token?provider=$tokenServiceProvider&tokenId=$issuerTokenId" fetchFromLocalAPI( endpoint = endpoint, @@ -781,7 +781,7 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog if (!ensureWalletAvailable(promise, "addCardToWallet")) { return } - + // Validar dados do cartão (mesmo que na implementação real) val validationError = validateCardData(cardData) if (validationError != null) { @@ -913,11 +913,11 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog override fun createWalletIfNeeded(promise: Promise) { WalletLogger.d(TAG, "🔍 [MOCK] createWalletIfNeeded chamado") - + if (!ensureWalletAvailable(promise, "createWalletIfNeeded")) { return } - + fetchFromLocalAPI( endpoint = "/wallet/create", defaultResponse = { true }, @@ -1076,7 +1076,7 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog // Verificar dados pendentes da MainActivity automaticamente checkPendingDataFromMainActivity() - + // Processar eventos de nenhuma intent pendentes GoogleWalletModule.processNoIntentReceivedEvent(reactContext) @@ -1193,10 +1193,14 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog constants["TAP_AND_PAY_SAVE_CARD_ERROR"] = 15019 constants["TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION"] = 15021 constants["TAP_AND_PAY_TOKENIZATION_DECLINED"] = 15022 - constants["TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR"] = 15023 +```kotlin + constants["TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR"] = 15023 // Deprecated +``` constants["TAP_AND_PAY_TOKENIZE_ERROR"] = 15024 constants["TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED"] = 15025 - constants["TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT"] = 15026 +```kotlin + constants["TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT"] = 15026 // Deprecated +``` constants["TAP_AND_PAY_USER_CANCELED_FLOW"] = 15027 constants["TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED"] = 15028 @@ -1248,7 +1252,7 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog val webUrl = GOOGLE_WALLET_PLAY_STORE_URL val success = walletOpener!!.openWallet(packageName, appName, playStoreUrl, webUrl) - + if (success) { WalletLogger.d(TAG, "✅ [MOCK] Wallet aberto com sucesso") promise.resolve(true) diff --git a/package.json b/package.json index bebc15d..8c731c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@platformbuilders/wallet-bridge-react-native", - "version": "1.1.1", + "version": "1.1.2", "description": "Este repositório contém um pacote React Native para integração com carteiras digitais. Ele atua como uma ponte (bridge) que se conecta aos SDKs nativos de cada carteira, abstraindo a complexidade dos fluxos de provisionamento (Push e App2App). Inicialmente compatível com Google Pay Wallet, com planos de expansão para Samsung Pay e Apple Wallet.", "main": "./lib/module/index.js", "types": "./lib/typescript/src/index.d.ts", diff --git a/src/__tests__/__mocks__/index.ts b/src/__tests__/__mocks__/index.ts index 7141636..448e5f3 100644 --- a/src/__tests__/__mocks__/index.ts +++ b/src/__tests__/__mocks__/index.ts @@ -50,6 +50,13 @@ export const mockGoogleWalletConstants: GoogleWalletConstants = { TAP_AND_PAY_INVALID_TOKEN_STATE: 3, TAP_AND_PAY_ATTESTATION_ERROR: 4, TAP_AND_PAY_UNAVAILABLE: 5, + TAP_AND_PAY_SAVE_CARD_ERROR: 6, + TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION: 7, + TAP_AND_PAY_TOKENIZATION_DECLINED: 8, + TAP_AND_PAY_TOKENIZE_ERROR: 9, + TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: 10, + TAP_AND_PAY_USER_CANCELED_FLOW: 11, + TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED: 12, // Token States TOKEN_STATE_ACTIVE: 1, @@ -119,6 +126,8 @@ export const mockGoogleWalletModule = { setActivationResult: jest.fn().mockResolvedValue(true), finishActivity: jest.fn().mockResolvedValue(true), openWallet: jest.fn().mockResolvedValue(true), + setLogListener: jest.fn().mockResolvedValue(true), + removeLogListener: jest.fn().mockResolvedValue(true), }; // ============================================================================ @@ -257,6 +266,8 @@ export const mockSamsungWalletModule = { setActivationResult: jest.fn().mockResolvedValue(true), finishActivity: jest.fn().mockResolvedValue(true), openWallet: jest.fn().mockResolvedValue(true), + setLogListener: jest.fn().mockResolvedValue(true), + removeLogListener: jest.fn().mockResolvedValue(true), }; // ============================================================================ diff --git a/src/google-wallet.ios.ts b/src/google-wallet.ios.ts index 7661447..52254ef 100644 --- a/src/google-wallet.ios.ts +++ b/src/google-wallet.ios.ts @@ -49,6 +49,13 @@ const iOS_STUB_CONSTANTS: GoogleWalletConstants = { TAP_AND_PAY_INVALID_TOKEN_STATE: 3, TAP_AND_PAY_ATTESTATION_ERROR: 4, TAP_AND_PAY_UNAVAILABLE: 5, + TAP_AND_PAY_SAVE_CARD_ERROR: 6, + TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION: 7, + TAP_AND_PAY_TOKENIZATION_DECLINED: 8, + TAP_AND_PAY_TOKENIZE_ERROR: 9, + TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: 10, + TAP_AND_PAY_USER_CANCELED_FLOW: 11, + TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED: 12, // Google Token State TOKEN_STATE_ACTIVE: 1, diff --git a/src/types/google-wallet.types.ts b/src/types/google-wallet.types.ts index 64069d0..27b18fb 100644 --- a/src/types/google-wallet.types.ts +++ b/src/types/google-wallet.types.ts @@ -120,6 +120,22 @@ export interface GoogleWalletConstants { TAP_AND_PAY_ATTESTATION_ERROR: number; /** A API TapAndPay não pode ser chamada pelo aplicativo atual. Se você receber este erro, certifique-se de que está chamando a API usando um nome de pacote e impressão digital que adicionamos à nossa lista de permissões. */ TAP_AND_PAY_UNAVAILABLE: number; + /** Falha ao salvar o FPAN como um cartão nos registros. */ + TAP_AND_PAY_SAVE_CARD_ERROR: number; + /** O cartão não é elegível para tokenização. */ + TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION: number; + /** A tokenização foi recusada pelo TSP (caminho vermelho). */ + TAP_AND_PAY_TOKENIZATION_DECLINED: number; + /** Não é possível chamar a API TapAndPay pelo aplicativo atual. */ + TAP_AND_PAY_TOKENIZE_ERROR: number; + /** A tentativa de provisionamento foi bem-sucedida, mas precisa concluir a verificação extra (caminho amarelo). + * O Google Pay recomenda enfaticamente que os tokens de caminho amarelo não sejam provisionados por push. */ + TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: number; + /** A tentativa de provisionamento falhou porque o usuário cancelou intencionalmente o fluxo. + * É possível (embora raro) ainda conseguir um token se o usuário cancelar o fluxo mais tarde na tentativa. */ + TAP_AND_PAY_USER_CANCELED_FLOW: number; + /** Falha tentativa de inscrição nos cartões virtuais. */ + TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED: number; //GOGLE TOKEN STATE /** O token está ativo e disponível para pagamentos. */ From e495f7ff874b9fe7de98c517bf45dfeb29c7416b Mon Sep 17 00:00:00 2001 From: Matheus Campos Date: Fri, 20 Feb 2026 11:48:21 -0300 Subject: [PATCH 2/4] fix: Remove extraneous kotlin block markers from Google Wallet files. --- .../wallet/googletapandpay/GoogleWalletImplementation.kt | 4 ---- .../com/builders/wallet/googletapandpay/util/ErrorCode.kt | 4 ---- .../com/builders/wallet/googletapandpay/GoogleWalletMock.kt | 4 ---- 3 files changed, 12 deletions(-) diff --git a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt index 667019c..bb58426 100644 --- a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt +++ b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt @@ -690,16 +690,12 @@ class GoogleWalletImplementation( put("TAP_AND_PAY_SAVE_CARD_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_SAVE_CARD_ERROR) put("TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION", TapAndPayStatusCodes.TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION) put("TAP_AND_PAY_TOKENIZATION_DECLINED", TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZATION_DECLINED) -```kotlin @Suppress("DEPRECATION") put("TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR) -``` put("TAP_AND_PAY_TOKENIZE_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZE_ERROR) put("TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED", TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED) -```kotlin @Suppress("DEPRECATION") put("TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT", TapAndPayStatusCodes.TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT) -``` put("TAP_AND_PAY_USER_CANCELED_FLOW", TapAndPayStatusCodes.TAP_AND_PAY_USER_CANCELED_FLOW) put("TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED", TapAndPayStatusCodes.TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED) diff --git a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt index 4f35f5a..21646d8 100644 --- a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt +++ b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt @@ -85,16 +85,12 @@ object ErrorCode { TapAndPayStatusCodes.TAP_AND_PAY_SAVE_CARD_ERROR -> "Erro ao salvar cartão" TapAndPayStatusCodes.TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION -> "Inelegível para tokenização" TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZATION_DECLINED -> "Tokenização recusada" -```kotlin @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR -> "Erro ao verificar elegibilidade" -``` TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZE_ERROR -> "Erro ao tokenizar" TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED -> "Ativação do token necessária" -```kotlin @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT -> "Tempo limite de entrega de credenciais" -``` TapAndPayStatusCodes.TAP_AND_PAY_USER_CANCELED_FLOW -> "Usuário cancelou a operação" TapAndPayStatusCodes.TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED -> "Falha ao registrar cartões virtuais" diff --git a/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt b/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt index 038aa68..c374d29 100644 --- a/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt +++ b/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt @@ -1193,14 +1193,10 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog constants["TAP_AND_PAY_SAVE_CARD_ERROR"] = 15019 constants["TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION"] = 15021 constants["TAP_AND_PAY_TOKENIZATION_DECLINED"] = 15022 -```kotlin constants["TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR"] = 15023 // Deprecated -``` constants["TAP_AND_PAY_TOKENIZE_ERROR"] = 15024 constants["TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED"] = 15025 -```kotlin constants["TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT"] = 15026 // Deprecated -``` constants["TAP_AND_PAY_USER_CANCELED_FLOW"] = 15027 constants["TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED"] = 15028 From c399e8cff05f4dc51ec5989a01aedb0dfef48b01 Mon Sep 17 00:00:00 2001 From: Matheus Campos Date: Fri, 20 Feb 2026 12:34:15 -0300 Subject: [PATCH 3/4] feat: Add Google Wallet error codes for eligibility check and payment credentials timeout and remove deprecation flags. --- .../GoogleWalletImplementation.kt | 2 -- .../wallet/googletapandpay/util/ErrorCode.kt | 8 ------- .../googletapandpay/GoogleWalletMock.kt | 4 ++-- src/__tests__/__mocks__/index.ts | 24 ++++++++++--------- src/google-wallet.ios.ts | 22 +++++++++-------- src/types/google-wallet.types.ts | 4 ++++ 6 files changed, 31 insertions(+), 33 deletions(-) diff --git a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt index bb58426..7f32169 100644 --- a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt +++ b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt @@ -690,11 +690,9 @@ class GoogleWalletImplementation( put("TAP_AND_PAY_SAVE_CARD_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_SAVE_CARD_ERROR) put("TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION", TapAndPayStatusCodes.TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION) put("TAP_AND_PAY_TOKENIZATION_DECLINED", TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZATION_DECLINED) - @Suppress("DEPRECATION") put("TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR) put("TAP_AND_PAY_TOKENIZE_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZE_ERROR) put("TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED", TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED) - @Suppress("DEPRECATION") put("TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT", TapAndPayStatusCodes.TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT) put("TAP_AND_PAY_USER_CANCELED_FLOW", TapAndPayStatusCodes.TAP_AND_PAY_USER_CANCELED_FLOW) put("TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED", TapAndPayStatusCodes.TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED) diff --git a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt index 21646d8..885f95b 100644 --- a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt +++ b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt @@ -36,16 +36,10 @@ object ErrorCode { TapAndPayStatusCodes.TAP_AND_PAY_SAVE_CARD_ERROR -> "TAP_AND_PAY_SAVE_CARD_ERROR" TapAndPayStatusCodes.TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION -> "TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION" TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZATION_DECLINED -> "TAP_AND_PAY_TOKENIZATION_DECLINED" -```kotlin - @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR -> "TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR" -``` TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZE_ERROR -> "TAP_AND_PAY_TOKENIZE_ERROR" TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED -> "TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED" -```kotlin - @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT -> "TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT" -``` TapAndPayStatusCodes.TAP_AND_PAY_USER_CANCELED_FLOW -> "TAP_AND_PAY_USER_CANCELED_FLOW" TapAndPayStatusCodes.TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED -> "TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED" @@ -85,11 +79,9 @@ object ErrorCode { TapAndPayStatusCodes.TAP_AND_PAY_SAVE_CARD_ERROR -> "Erro ao salvar cartão" TapAndPayStatusCodes.TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION -> "Inelegível para tokenização" TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZATION_DECLINED -> "Tokenização recusada" - @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR -> "Erro ao verificar elegibilidade" TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZE_ERROR -> "Erro ao tokenizar" TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED -> "Ativação do token necessária" - @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT -> "Tempo limite de entrega de credenciais" TapAndPayStatusCodes.TAP_AND_PAY_USER_CANCELED_FLOW -> "Usuário cancelou a operação" TapAndPayStatusCodes.TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED -> "Falha ao registrar cartões virtuais" diff --git a/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt b/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt index c374d29..4cbef87 100644 --- a/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt +++ b/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt @@ -1193,10 +1193,10 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog constants["TAP_AND_PAY_SAVE_CARD_ERROR"] = 15019 constants["TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION"] = 15021 constants["TAP_AND_PAY_TOKENIZATION_DECLINED"] = 15022 - constants["TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR"] = 15023 // Deprecated + constants["TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR"] = 15023 constants["TAP_AND_PAY_TOKENIZE_ERROR"] = 15024 constants["TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED"] = 15025 - constants["TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT"] = 15026 // Deprecated + constants["TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT"] = 15026 constants["TAP_AND_PAY_USER_CANCELED_FLOW"] = 15027 constants["TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED"] = 15028 diff --git a/src/__tests__/__mocks__/index.ts b/src/__tests__/__mocks__/index.ts index 448e5f3..d31da87 100644 --- a/src/__tests__/__mocks__/index.ts +++ b/src/__tests__/__mocks__/index.ts @@ -5,15 +5,15 @@ // que utilizam a biblioteca BuildersWallet import type { - GoogleTokenInfo, - GoogleTokenStatus, - GoogleWalletConstants, - GoogleWalletData, + GoogleTokenInfo, + GoogleTokenStatus, + GoogleWalletConstants, + GoogleWalletData, } from '../../types/google-wallet.types'; import type { - SamsungCard, - SamsungWalletConstants, - SamsungWalletInfo, + SamsungCard, + SamsungWalletConstants, + SamsungWalletInfo, } from '../../types/samsung-wallet.types'; // ============================================================================ @@ -53,10 +53,12 @@ export const mockGoogleWalletConstants: GoogleWalletConstants = { TAP_AND_PAY_SAVE_CARD_ERROR: 6, TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION: 7, TAP_AND_PAY_TOKENIZATION_DECLINED: 8, - TAP_AND_PAY_TOKENIZE_ERROR: 9, - TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: 10, - TAP_AND_PAY_USER_CANCELED_FLOW: 11, - TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED: 12, + TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR: 9, + TAP_AND_PAY_TOKENIZE_ERROR: 10, + TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: 11, + TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT: 12, + TAP_AND_PAY_USER_CANCELED_FLOW: 13, + TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED: 14, // Token States TOKEN_STATE_ACTIVE: 1, diff --git a/src/google-wallet.ios.ts b/src/google-wallet.ios.ts index 52254ef..e3dbca7 100644 --- a/src/google-wallet.ios.ts +++ b/src/google-wallet.ios.ts @@ -7,12 +7,12 @@ import type { GoogleActivationStatus } from './enums'; import type { - GooglePushTokenizeRequestForCard, - GoogleTokenInfo, - GoogleTokenStatus, - GoogleWalletConstants, - GoogleWalletData, - GoogleWalletSpec, + GooglePushTokenizeRequestForCard, + GoogleTokenInfo, + GoogleTokenStatus, + GoogleWalletConstants, + GoogleWalletData, + GoogleWalletSpec, } from './types/google-wallet.types'; // ============================================================================ @@ -52,10 +52,12 @@ const iOS_STUB_CONSTANTS: GoogleWalletConstants = { TAP_AND_PAY_SAVE_CARD_ERROR: 6, TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION: 7, TAP_AND_PAY_TOKENIZATION_DECLINED: 8, - TAP_AND_PAY_TOKENIZE_ERROR: 9, - TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: 10, - TAP_AND_PAY_USER_CANCELED_FLOW: 11, - TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED: 12, + TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR: 9, + TAP_AND_PAY_TOKENIZE_ERROR: 10, + TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: 11, + TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT: 12, + TAP_AND_PAY_USER_CANCELED_FLOW: 13, + TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED: 14, // Google Token State TOKEN_STATE_ACTIVE: 1, diff --git a/src/types/google-wallet.types.ts b/src/types/google-wallet.types.ts index 27b18fb..a6c3ee3 100644 --- a/src/types/google-wallet.types.ts +++ b/src/types/google-wallet.types.ts @@ -126,11 +126,15 @@ export interface GoogleWalletConstants { TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION: number; /** A tokenização foi recusada pelo TSP (caminho vermelho). */ TAP_AND_PAY_TOKENIZATION_DECLINED: number; + /** Ocorreu um erro ao verificar a elegibilidade para Tap and Pay. */ + TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR: number; /** Não é possível chamar a API TapAndPay pelo aplicativo atual. */ TAP_AND_PAY_TOKENIZE_ERROR: number; /** A tentativa de provisionamento foi bem-sucedida, mas precisa concluir a verificação extra (caminho amarelo). * O Google Pay recomenda enfaticamente que os tokens de caminho amarelo não sejam provisionados por push. */ TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: number; + /** O tempo limite para a entrega das credenciais de pagamento foi atingido. */ + TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT: number; /** A tentativa de provisionamento falhou porque o usuário cancelou intencionalmente o fluxo. * É possível (embora raro) ainda conseguir um token se o usuário cancelar o fluxo mais tarde na tentativa. */ TAP_AND_PAY_USER_CANCELED_FLOW: number; From ffce8a524ca8b24e58b76271a43e2e69c438dae8 Mon Sep 17 00:00:00 2001 From: Matheus Campos Date: Fri, 20 Feb 2026 12:34:15 -0300 Subject: [PATCH 4/4] feat: Add Google Wallet error codes for eligibility check and payment credentials timeout and remove deprecation flags. --- .../googletapandpay/GoogleWalletImplementation.kt | 2 -- .../builders/wallet/googletapandpay/util/ErrorCode.kt | 8 -------- .../wallet/googletapandpay/GoogleWalletMock.kt | 4 ++-- src/__tests__/__mocks__/index.ts | 10 ++++++---- src/google-wallet.ios.ts | 10 ++++++---- src/types/google-wallet.types.ts | 4 ++++ 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt index bb58426..7f32169 100644 --- a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt +++ b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/GoogleWalletImplementation.kt @@ -690,11 +690,9 @@ class GoogleWalletImplementation( put("TAP_AND_PAY_SAVE_CARD_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_SAVE_CARD_ERROR) put("TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION", TapAndPayStatusCodes.TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION) put("TAP_AND_PAY_TOKENIZATION_DECLINED", TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZATION_DECLINED) - @Suppress("DEPRECATION") put("TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR) put("TAP_AND_PAY_TOKENIZE_ERROR", TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZE_ERROR) put("TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED", TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED) - @Suppress("DEPRECATION") put("TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT", TapAndPayStatusCodes.TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT) put("TAP_AND_PAY_USER_CANCELED_FLOW", TapAndPayStatusCodes.TAP_AND_PAY_USER_CANCELED_FLOW) put("TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED", TapAndPayStatusCodes.TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED) diff --git a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt index 21646d8..885f95b 100644 --- a/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt +++ b/android/src/googleWallet/java/com/builders/wallet/googletapandpay/util/ErrorCode.kt @@ -36,16 +36,10 @@ object ErrorCode { TapAndPayStatusCodes.TAP_AND_PAY_SAVE_CARD_ERROR -> "TAP_AND_PAY_SAVE_CARD_ERROR" TapAndPayStatusCodes.TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION -> "TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION" TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZATION_DECLINED -> "TAP_AND_PAY_TOKENIZATION_DECLINED" -```kotlin - @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR -> "TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR" -``` TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZE_ERROR -> "TAP_AND_PAY_TOKENIZE_ERROR" TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED -> "TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED" -```kotlin - @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT -> "TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT" -``` TapAndPayStatusCodes.TAP_AND_PAY_USER_CANCELED_FLOW -> "TAP_AND_PAY_USER_CANCELED_FLOW" TapAndPayStatusCodes.TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED -> "TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED" @@ -85,11 +79,9 @@ object ErrorCode { TapAndPayStatusCodes.TAP_AND_PAY_SAVE_CARD_ERROR -> "Erro ao salvar cartão" TapAndPayStatusCodes.TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION -> "Inelegível para tokenização" TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZATION_DECLINED -> "Tokenização recusada" - @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR -> "Erro ao verificar elegibilidade" TapAndPayStatusCodes.TAP_AND_PAY_TOKENIZE_ERROR -> "Erro ao tokenizar" TapAndPayStatusCodes.TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED -> "Ativação do token necessária" - @Suppress("DEPRECATION") TapAndPayStatusCodes.TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT -> "Tempo limite de entrega de credenciais" TapAndPayStatusCodes.TAP_AND_PAY_USER_CANCELED_FLOW -> "Usuário cancelou a operação" TapAndPayStatusCodes.TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED -> "Falha ao registrar cartões virtuais" diff --git a/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt b/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt index c374d29..4cbef87 100644 --- a/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt +++ b/android/src/main/java/com/builders/wallet/googletapandpay/GoogleWalletMock.kt @@ -1193,10 +1193,10 @@ class GoogleWalletMock(private val reactContext: ReactApplicationContext) : Goog constants["TAP_AND_PAY_SAVE_CARD_ERROR"] = 15019 constants["TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION"] = 15021 constants["TAP_AND_PAY_TOKENIZATION_DECLINED"] = 15022 - constants["TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR"] = 15023 // Deprecated + constants["TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR"] = 15023 constants["TAP_AND_PAY_TOKENIZE_ERROR"] = 15024 constants["TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED"] = 15025 - constants["TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT"] = 15026 // Deprecated + constants["TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT"] = 15026 constants["TAP_AND_PAY_USER_CANCELED_FLOW"] = 15027 constants["TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED"] = 15028 diff --git a/src/__tests__/__mocks__/index.ts b/src/__tests__/__mocks__/index.ts index 448e5f3..3746c1c 100644 --- a/src/__tests__/__mocks__/index.ts +++ b/src/__tests__/__mocks__/index.ts @@ -53,10 +53,12 @@ export const mockGoogleWalletConstants: GoogleWalletConstants = { TAP_AND_PAY_SAVE_CARD_ERROR: 6, TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION: 7, TAP_AND_PAY_TOKENIZATION_DECLINED: 8, - TAP_AND_PAY_TOKENIZE_ERROR: 9, - TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: 10, - TAP_AND_PAY_USER_CANCELED_FLOW: 11, - TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED: 12, + TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR: 9, + TAP_AND_PAY_TOKENIZE_ERROR: 10, + TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: 11, + TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT: 12, + TAP_AND_PAY_USER_CANCELED_FLOW: 13, + TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED: 14, // Token States TOKEN_STATE_ACTIVE: 1, diff --git a/src/google-wallet.ios.ts b/src/google-wallet.ios.ts index 52254ef..b25ff4b 100644 --- a/src/google-wallet.ios.ts +++ b/src/google-wallet.ios.ts @@ -52,10 +52,12 @@ const iOS_STUB_CONSTANTS: GoogleWalletConstants = { TAP_AND_PAY_SAVE_CARD_ERROR: 6, TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION: 7, TAP_AND_PAY_TOKENIZATION_DECLINED: 8, - TAP_AND_PAY_TOKENIZE_ERROR: 9, - TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: 10, - TAP_AND_PAY_USER_CANCELED_FLOW: 11, - TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED: 12, + TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR: 9, + TAP_AND_PAY_TOKENIZE_ERROR: 10, + TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: 11, + TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT: 12, + TAP_AND_PAY_USER_CANCELED_FLOW: 13, + TAP_AND_PAY_ENROLL_FOR_VIRTUAL_CARDS_FAILED: 14, // Google Token State TOKEN_STATE_ACTIVE: 1, diff --git a/src/types/google-wallet.types.ts b/src/types/google-wallet.types.ts index 27b18fb..a6c3ee3 100644 --- a/src/types/google-wallet.types.ts +++ b/src/types/google-wallet.types.ts @@ -126,11 +126,15 @@ export interface GoogleWalletConstants { TAP_AND_PAY_INELIGIBLE_FOR_TOKENIZATION: number; /** A tokenização foi recusada pelo TSP (caminho vermelho). */ TAP_AND_PAY_TOKENIZATION_DECLINED: number; + /** Ocorreu um erro ao verificar a elegibilidade para Tap and Pay. */ + TAP_AND_PAY_CHECK_ELIGIBILITY_ERROR: number; /** Não é possível chamar a API TapAndPay pelo aplicativo atual. */ TAP_AND_PAY_TOKENIZE_ERROR: number; /** A tentativa de provisionamento foi bem-sucedida, mas precisa concluir a verificação extra (caminho amarelo). * O Google Pay recomenda enfaticamente que os tokens de caminho amarelo não sejam provisionados por push. */ TAP_AND_PAY_TOKEN_ACTIVATION_REQUIRED: number; + /** O tempo limite para a entrega das credenciais de pagamento foi atingido. */ + TAP_AND_PAY_PAYMENT_CREDENTIALS_DELIVERY_TIMEOUT: number; /** A tentativa de provisionamento falhou porque o usuário cancelou intencionalmente o fluxo. * É possível (embora raro) ainda conseguir um token se o usuário cancelar o fluxo mais tarde na tentativa. */ TAP_AND_PAY_USER_CANCELED_FLOW: number;