From 57789df04e46bf1fe278680377e52ede7e112be1 Mon Sep 17 00:00:00 2001 From: Cole Eason Date: Tue, 10 Oct 2023 11:24:51 -0700 Subject: [PATCH 1/5] WIP -- allow platinum wallets to transaction --- src/CONST.ts | 2 ++ src/components/KYCWall/BaseKYCWall.js | 2 +- src/pages/EnablePayments/ActivateStep.js | 9 +++++---- src/pages/settings/Wallet/TransferBalancePage.js | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 23957827d140..1a01b6f45651 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1011,8 +1011,10 @@ const CONST = { ACTIVATE: 'ActivateStep', }, TIER_NAME: { + PLATINUM: 'PLATINUM', GOLD: 'GOLD', SILVER: 'SILVER', + BRONZE: 'BRONZE', }, WEB_MESSAGE_TYPE: { STATEMENT: 'STATEMENT_NAVIGATE', diff --git a/src/components/KYCWall/BaseKYCWall.js b/src/components/KYCWall/BaseKYCWall.js index 1c1552d55844..32b5ff9f1421 100644 --- a/src/components/KYCWall/BaseKYCWall.js +++ b/src/components/KYCWall/BaseKYCWall.js @@ -123,7 +123,7 @@ class KYCWall extends React.Component { } if (!isExpenseReport) { // Ask the user to upgrade to a gold wallet as this means they have not yet gone through our Know Your Customer (KYC) checks - const hasGoldWallet = this.props.userWallet.tierName && this.props.userWallet.tierName === CONST.WALLET.TIER_NAME.GOLD; + const hasGoldWallet = this.props.userWallet.tierName && _.contains([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM], this.props.userWallet.tierName); if (!hasGoldWallet) { Log.info('[KYC Wallet] User does not have gold wallet'); Navigation.navigate(this.props.enablePaymentsRoute); diff --git a/src/pages/EnablePayments/ActivateStep.js b/src/pages/EnablePayments/ActivateStep.js index 268c2664e01d..eee96375ec93 100644 --- a/src/pages/EnablePayments/ActivateStep.js +++ b/src/pages/EnablePayments/ActivateStep.js @@ -1,3 +1,4 @@ +import _ from 'underscore'; import React from 'react'; import {withOnyx} from 'react-native-onyx'; import * as LottieAnimations from '../../components/LottieAnimations'; @@ -29,7 +30,7 @@ const defaultProps = { }; function ActivateStep(props) { - const isGoldWallet = props.userWallet.tierName === CONST.WALLET.TIER_NAME.GOLD; + const isActivedWallet = _.contains([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM], props.userWallet.tierName); const animation = isGoldWallet ? LottieAnimations.Fireworks : LottieAnimations.ReviewingBankInfo; const continueButtonText = props.walletTerms.chatReportID ? props.translate('activateStep.continueToPayment') : props.translate('activateStep.continueToTransfer'); @@ -38,9 +39,9 @@ function ActivateStep(props) { diff --git a/src/pages/settings/Wallet/TransferBalancePage.js b/src/pages/settings/Wallet/TransferBalancePage.js index f33c92bea02b..2c3ed1fe2100 100644 --- a/src/pages/settings/Wallet/TransferBalancePage.js +++ b/src/pages/settings/Wallet/TransferBalancePage.js @@ -167,7 +167,7 @@ function TransferBalancePage(props) { const isButtonDisabled = !isTransferable || !selectedAccount; const errorMessage = !_.isEmpty(props.walletTransfer.errors) ? _.chain(props.walletTransfer.errors).values().first().value() : ''; - const shouldShowTransferView = PaymentUtils.hasExpensifyPaymentMethod(paymentCardList, props.bankAccountList) && props.userWallet.tierName === CONST.WALLET.TIER_NAME.GOLD; + const shouldShowTransferView = PaymentUtils.hasExpensifyPaymentMethod(paymentCardList, props.bankAccountList) && _.contains([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM], props.userWallet.tierName); return ( From 1a34570e2ccd47d185e1856c7bf045cfd8d6dc41 Mon Sep 17 00:00:00 2001 From: Cole Eason Date: Wed, 11 Oct 2023 15:28:29 -0700 Subject: [PATCH 2/5] Add Missing underscore import --- src/components/KYCWall/BaseKYCWall.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/KYCWall/BaseKYCWall.js b/src/components/KYCWall/BaseKYCWall.js index 32b5ff9f1421..db3c85ef818c 100644 --- a/src/components/KYCWall/BaseKYCWall.js +++ b/src/components/KYCWall/BaseKYCWall.js @@ -1,3 +1,4 @@ +import _ from 'underscore'; import React from 'react'; import {withOnyx} from 'react-native-onyx'; import {Dimensions} from 'react-native'; @@ -123,9 +124,9 @@ class KYCWall extends React.Component { } if (!isExpenseReport) { // Ask the user to upgrade to a gold wallet as this means they have not yet gone through our Know Your Customer (KYC) checks - const hasGoldWallet = this.props.userWallet.tierName && _.contains([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM], this.props.userWallet.tierName); - if (!hasGoldWallet) { - Log.info('[KYC Wallet] User does not have gold wallet'); + const hasActivatedWallet = this.props.userWallet.tierName && _.contains([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM], this.props.userWallet.tierName); + if (!hasActivatedWallet) { + Log.info('[KYC Wallet] User does not have active wallet'); Navigation.navigate(this.props.enablePaymentsRoute); return; } From 1dba748dfc4ed2f0f399cbaa200b22a1d09c0e06 Mon Sep 17 00:00:00 2001 From: Cole Eason Date: Wed, 11 Oct 2023 15:35:31 -0700 Subject: [PATCH 3/5] Fix missed rename --- src/pages/EnablePayments/ActivateStep.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/EnablePayments/ActivateStep.js b/src/pages/EnablePayments/ActivateStep.js index eee96375ec93..a0aa49aafdb7 100644 --- a/src/pages/EnablePayments/ActivateStep.js +++ b/src/pages/EnablePayments/ActivateStep.js @@ -31,7 +31,7 @@ const defaultProps = { function ActivateStep(props) { const isActivedWallet = _.contains([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM], props.userWallet.tierName); - const animation = isGoldWallet ? LottieAnimations.Fireworks : LottieAnimations.ReviewingBankInfo; + const animation = isActivedWallet ? LottieAnimations.Fireworks : LottieAnimations.ReviewingBankInfo; const continueButtonText = props.walletTerms.chatReportID ? props.translate('activateStep.continueToPayment') : props.translate('activateStep.continueToTransfer'); return ( From e6549d8cae87959bc45f8bbbcc27fce9913b95e3 Mon Sep 17 00:00:00 2001 From: Cole Eason Date: Wed, 11 Oct 2023 15:43:31 -0700 Subject: [PATCH 4/5] prettier --- src/pages/settings/Wallet/TransferBalancePage.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/settings/Wallet/TransferBalancePage.js b/src/pages/settings/Wallet/TransferBalancePage.js index 2c3ed1fe2100..ae54dab569f7 100644 --- a/src/pages/settings/Wallet/TransferBalancePage.js +++ b/src/pages/settings/Wallet/TransferBalancePage.js @@ -167,7 +167,9 @@ function TransferBalancePage(props) { const isButtonDisabled = !isTransferable || !selectedAccount; const errorMessage = !_.isEmpty(props.walletTransfer.errors) ? _.chain(props.walletTransfer.errors).values().first().value() : ''; - const shouldShowTransferView = PaymentUtils.hasExpensifyPaymentMethod(paymentCardList, props.bankAccountList) && _.contains([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM], props.userWallet.tierName); + const shouldShowTransferView = + PaymentUtils.hasExpensifyPaymentMethod(paymentCardList, props.bankAccountList) && + _.contains([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM], props.userWallet.tierName); return ( From 61417ff0da59aa906ce2387e803f475d292b1448 Mon Sep 17 00:00:00 2001 From: Cole Eason Date: Fri, 13 Oct 2023 14:06:41 -0700 Subject: [PATCH 5/5] Rename typoed variable --- src/pages/EnablePayments/ActivateStep.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/EnablePayments/ActivateStep.js b/src/pages/EnablePayments/ActivateStep.js index a0aa49aafdb7..2d23f39d25e5 100644 --- a/src/pages/EnablePayments/ActivateStep.js +++ b/src/pages/EnablePayments/ActivateStep.js @@ -30,8 +30,8 @@ const defaultProps = { }; function ActivateStep(props) { - const isActivedWallet = _.contains([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM], props.userWallet.tierName); - const animation = isActivedWallet ? LottieAnimations.Fireworks : LottieAnimations.ReviewingBankInfo; + const isActivatedWallet = _.contains([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM], props.userWallet.tierName); + const animation = isActivatedWallet ? LottieAnimations.Fireworks : LottieAnimations.ReviewingBankInfo; const continueButtonText = props.walletTerms.chatReportID ? props.translate('activateStep.continueToPayment') : props.translate('activateStep.continueToTransfer'); return ( @@ -39,9 +39,9 @@ function ActivateStep(props) {