Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3370,16 +3370,16 @@ const translations = {
text: 'Learn more about these ',
linkText: 'options.',
},
customFeedDetails: 'Requires setup with your bank. This is typically used by larger companies and is often the best option if you qualify.',
commercialFeedDetails: 'Requires setup with your bank. This is typically used by larger companies and is often the best option if you qualify.',
directFeedDetails: 'The simplest approach. Connect right away using your master credentials. This method is most common.',
enableFeed: {
title: ({provider}: GoBackMessageParams) => `Enable your ${provider} feed`,
heading: 'We have a direct integration with your card issuer and can import your transaction data into Expensify quickly and accurately.\n\nTo get started, simply:',
visa: 'We have global integrations with Visa, though eligibility varies by bank and card program.\n\nTo get started, simply:',
mastercard: 'We have global integrations with Mastercard, though eligibility varies by bank and card program.\n\nTo get started, simply:',
vcf: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) for detailed instructions on how to set up your Visa Commercial Cards.\n\n2. [Contact your bank](${CONST.COMPANY_CARDS_HELP}) to verify they support a custom feed for your program, and ask them to enable it.\n\n3. *Once the feed is enabled and you have its details, continue to the next screen.*`,
gl1025: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) to find out if American Express can enable a custom feed for your program.\n\n2. Once the feed is enabled, Amex will send you a production letter.\n\n3. *Once you have the feed information, continue to the next screen.*`,
cdf: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) for detailed instructions on how to set up your Mastercard Commercial Cards.\n\n 2. [Contact your bank](${CONST.COMPANY_CARDS_HELP}) to verify they support a custom feed for your program, and ask them to enable it.\n\n3. *Once the feed is enabled and you have its details, continue to the next screen.*`,
vcf: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) for detailed instructions on how to set up your Visa Commercial Cards.\n\n2. [Contact your bank](${CONST.COMPANY_CARDS_HELP}) to verify they support a commercial feed for your program, and ask them to enable it.\n\n3. *Once the feed is enabled and you have its details, continue to the next screen.*`,
gl1025: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) to find out if American Express can enable a commercial feed for your program.\n\n2. Once the feed is enabled, Amex will send you a production letter.\n\n3. *Once you have the feed information, continue to the next screen.*`,
cdf: `1. Visit [this help article](${CONST.COMPANY_CARDS_HELP}) for detailed instructions on how to set up your Mastercard Commercial Cards.\n\n 2. [Contact your bank](${CONST.COMPANY_CARDS_HELP}) to verify they support a commercial feed for your program, and ask them to enable it.\n\n3. *Once the feed is enabled and you have its details, continue to the next screen.*`,
stripe: `1. Visit Stripe’s Dashboard, and go to [Settings](${CONST.COMPANY_CARDS_STRIPE_HELP}).\n\n2. Under Product Integrations, click Enable next to Expensify.\n\n3. Once the feed is enabled, click Submit below and we’ll work on adding it.`,
},
whatBankIssuesCard: 'What bank issues these cards?',
Expand Down Expand Up @@ -3415,7 +3415,7 @@ const translations = {
},
assignCard: 'Assign card',
cardNumber: 'Card number',
customFeed: 'Custom feed',
commercialFeed: 'Commercial feed',
feedName: ({feedName}: CompanyCardFeedNameParams) => `${feedName} cards`,
directFeed: 'Direct feed',
whoNeedsCardAssigned: 'Who needs a card assigned?',
Expand Down
4 changes: 2 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3409,7 +3409,7 @@ const translations = {
text: 'Obtén más información sobre estas ',
linkText: 'opciones.',
},
customFeedDetails: 'Requiere configuración con tu banco. Esto suele ser utilizado por empresas más grandes y a menudo es la mejor opción si calificas.',
commercialFeedDetails: 'Requiere configuración con tu banco. Esto suele ser utilizado por empresas más grandes y a menudo es la mejor opción si calificas.',
directFeedDetails: 'El enfoque más simple. Conéctate de inmediato usando tus credenciales maestras. Este método es el más común.',
enableFeed: {
title: ({provider}: GoBackMessageParams) => `Habilita tu feed ${provider}`,
Expand Down Expand Up @@ -3455,7 +3455,7 @@ const translations = {
},
assignCard: 'Asignar tarjeta',
cardNumber: 'Número de la tarjeta',
customFeed: 'Fuente personalizada',
commercialFeed: 'Fuente comercial',
feedName: ({feedName}: CompanyCardFeedNameParams) => `Tarjetas ${feedName}`,
directFeed: 'Fuente directa',
whoNeedsCardAssigned: '¿Quién necesita una tarjeta?',
Expand Down
3 changes: 3 additions & 0 deletions src/libs/CardUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ function getCardFeedIcon(cardFeed: CompanyCardFeed | typeof CONST.EXPENSIFY_CARD
return Illustrations.AmexCompanyCards;
}

/**
* Verify if the feed is a custom feed. Those are also refered to as commercial feeds.
*/
function isCustomFeed(feed: CompanyCardFeed): boolean {
return [CONST.COMPANY_CARD.FEED_BANK_NAME.MASTER_CARD, CONST.COMPANY_CARD.FEED_BANK_NAME.VISA, CONST.COMPANY_CARD.FEED_BANK_NAME.AMEX].some((value) => value === feed);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as CardUtils from '@libs/CardUtils';
import * as PolicyUtils from '@libs/PolicyUtils';
import {getCardFeedIcon, getCompanyFeeds, getCustomOrFormattedFeedName, isCustomFeed} from '@libs/CardUtils';
import {getWorkspaceAccountID, hasPolicyFeedsError} from '@libs/PolicyUtils';
import Navigation from '@navigation/Navigation';
import variables from '@styles/variables';
import ONYXKEYS from '@src/ONYXKEYS';
Expand All @@ -39,12 +39,12 @@ function WorkspaceCompanyCardsListHeaderButtons({policyID, selectedFeed, shouldS
const {translate} = useLocalize();
const theme = useTheme();
const {shouldUseNarrowLayout, isMediumScreenWidth} = useResponsiveLayout();
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);
const workspaceAccountID = getWorkspaceAccountID(policyID);
const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`);
const shouldChangeLayout = isMediumScreenWidth || shouldUseNarrowLayout;
const formattedFeedName = CardUtils.getCustomOrFormattedFeedName(selectedFeed, cardFeeds?.settings?.companyCardNicknames);
const isCustomFeed = CardUtils.isCustomFeed(selectedFeed);
const companyFeeds = CardUtils.getCompanyFeeds(cardFeeds);
const formattedFeedName = getCustomOrFormattedFeedName(selectedFeed, cardFeeds?.settings?.companyCardNicknames);
const isCommercialFeed = isCustomFeed(selectedFeed);
const companyFeeds = getCompanyFeeds(cardFeeds);
const currentFeedData = companyFeeds?.[selectedFeed];

return (
Expand All @@ -60,7 +60,7 @@ function WorkspaceCompanyCardsListHeaderButtons({policyID, selectedFeed, shouldS
accessibilityLabel={formattedFeedName ?? ''}
>
<Icon
src={CardUtils.getCardFeedIcon(selectedFeed)}
src={getCardFeedIcon(selectedFeed)}
height={variables.cardIconHeight}
width={variables.cardIconWidth}
additionalStyles={styles.cardIcon}
Expand All @@ -70,14 +70,14 @@ function WorkspaceCompanyCardsListHeaderButtons({policyID, selectedFeed, shouldS
<CaretWrapper>
<Text style={styles.textStrong}>{formattedFeedName}</Text>
</CaretWrapper>
{PolicyUtils.hasPolicyFeedsError(companyFeeds, selectedFeed) && (
{hasPolicyFeedsError(companyFeeds, selectedFeed) && (
<Icon
src={Expensicons.DotIndicator}
fill={theme.danger}
/>
)}
</View>
<Text style={styles.textLabelSupporting}>{translate(isCustomFeed ? 'workspace.companyCards.customFeed' : 'workspace.companyCards.directFeed')}</Text>
<Text style={styles.textLabelSupporting}>{translate(isCommercialFeed ? 'workspace.companyCards.commercialFeed' : 'workspace.companyCards.directFeed')}</Text>
</View>
</PressableWithFeedback>

Expand Down
10 changes: 5 additions & 5 deletions src/pages/workspace/companyCards/addNew/SelectFeedType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Text from '@components/Text';
import TextLink from '@components/TextLink';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import * as CompanyCards from '@userActions/CompanyCards';
import {setAddNewCompanyCardStepAndData} from '@userActions/CompanyCards';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';

Expand All @@ -27,7 +27,7 @@ function SelectFeedType() {
setHasError(true);
return;
}
CompanyCards.setAddNewCompanyCardStepAndData({
setAddNewCompanyCardStepAndData({
step: typeSelected === CONST.COMPANY_CARDS.FEED_TYPE.DIRECT ? CONST.COMPANY_CARDS.STEP.BANK_CONNECTION : CONST.COMPANY_CARDS.STEP.CARD_TYPE,
data: {selectedFeedType: typeSelected},
});
Expand All @@ -38,14 +38,14 @@ function SelectFeedType() {
}, [addNewCard?.data.selectedFeedType]);

const handleBackButtonPress = () => {
CompanyCards.setAddNewCompanyCardStepAndData({step: CONST.COMPANY_CARDS.STEP.SELECT_BANK});
setAddNewCompanyCardStepAndData({step: CONST.COMPANY_CARDS.STEP.SELECT_BANK});
};

const data = [
{
value: CONST.COMPANY_CARDS.FEED_TYPE.CUSTOM,
text: translate('workspace.companyCards.customFeed'),
alternateText: translate('workspace.companyCards.addNewCard.customFeedDetails'),
text: translate('workspace.companyCards.commercialFeed'),
alternateText: translate('workspace.companyCards.addNewCard.commercialFeedDetails'),
keyForList: CONST.COMPANY_CARDS.FEED_TYPE.CUSTOM,
isSelected: typeSelected === CONST.COMPANY_CARDS.FEED_TYPE.CUSTOM,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function BankConnection({policyID, feed}: BankConnectionStepProps) {
const url = getCompanyCardBankConnection(policyID, bankName);
const workspaceAccountID = getWorkspaceAccountID(policyID);
const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`);

// This does not apply for custom feeds, this is used to check if the feed is expired to push user to reauthenticate
const isFeedExpired = isSelectedFeedExpired(cardFeeds?.settings?.oAuthAccountDetails?.[feed]);

Expand Down