Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#45949 & #45950 Divide workflows page into three sections & Update payment section with bank icon #46020

Merged
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
9 changes: 6 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1239,19 +1239,20 @@ export default {
workflowTitle: 'Spend',
workflowDescription: 'Configure a workflow from the moment spend occurs, including approval and payment.',
delaySubmissionTitle: 'Delay submissions',
delaySubmissionDescription: 'Expenses are shared right away for better spend visibility. Set a slower cadence if needed.',
delaySubmissionDescription: 'Delay expense submissions based on a custom schedule, or keep this option disabled to maintain realtime spend visibility.',
submissionFrequency: 'Submission frequency',
submissionFrequencyDateOfMonth: 'Date of month',
addApprovalsTitle: 'Add approvals',
addApprovalButton: 'Add approval workflow',
approver: 'Approver',
connectBankAccount: 'Connect bank account',
addApprovalsDescription: 'Require additional approval before authorizing a payment.',
makeOrTrackPaymentsTitle: 'Payments',
makeOrTrackPaymentsDescription: 'Add an authorized payer for payments made in Expensify, or track payments made elsewhere.',
makeOrTrackPaymentsTitle: 'Make or track payments',
makeOrTrackPaymentsDescription: 'Add an authorized payer for payments made in Expensify, or simply track payments made elsewhere.',
editor: {
submissionFrequency: 'Choose how long Expensify should wait before sharing error-free spend.',
},
frequencyDescription: 'Choose how often you’d like expenses to submit automatically, or make it manual',
frequencies: {
weekly: 'Weekly',
monthly: 'Monthly',
Expand Down Expand Up @@ -1290,6 +1291,8 @@ export default {
title: 'Authorized payer',
genericErrorMessage: 'The authorized payer could not be changed. Please try again.',
admins: 'Admins',
payer: 'Payer',
paymentAccount: 'Payment account',
},
reportFraudPage: {
title: 'Report virtual card fraud',
Expand Down
9 changes: 6 additions & 3 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1248,19 +1248,20 @@ export default {
workflowTitle: 'Gasto',
workflowDescription: 'Configure un flujo de trabajo desde el momento en que se produce el gasto, incluida la aprobación y el pago',
delaySubmissionTitle: 'Retrasar envíos',
delaySubmissionDescription: 'Los gastos se comparten de inmediato para una mejor visibilidad del gasto. Establece una cadencia más lenta si es necesario.',
delaySubmissionDescription: 'Retrasa la presentación de gastos en base a un calendario personalizado, o mantén esta opción desactivada para seguir viendo los gastos en tiempo real.',
submissionFrequency: 'Frecuencia de envíos',
submissionFrequencyDateOfMonth: 'Fecha del mes',
addApprovalsTitle: 'Requerir aprobaciones',
addApprovalButton: 'Añadir flujo de aprobación',
approver: 'Aprobador',
connectBankAccount: 'Conectar cuenta bancaria',
addApprovalsDescription: 'Requiere una aprobación adicional antes de autorizar un pago.',
makeOrTrackPaymentsTitle: 'Pagos',
makeOrTrackPaymentsDescription: 'Añade un pagador autorizado para los pagos realizados en Expensify, o realiza un seguimiento de los pagos realizados en otro lugar.',
makeOrTrackPaymentsTitle: 'Realizar o seguir pagos',
makeOrTrackPaymentsDescription: 'Añade un pagador autorizado para los pagos realizados en Expensify, o simplemente realiza un seguimiento de los pagos realizados en otro lugar.',
editor: {
submissionFrequency: 'Elige cuánto tiempo Expensify debe esperar antes de compartir los gastos sin errores.',
},
frequencyDescription: 'Elige la frecuencia de presentación automática de gastos, o preséntalos manualmente',
frequencies: {
weekly: 'Semanal',
monthly: 'Mensual',
Expand Down Expand Up @@ -1299,6 +1300,8 @@ export default {
title: 'Pagador autorizado',
genericErrorMessage: 'El pagador autorizado no se pudo cambiar. Por favor, inténtalo mas tarde.',
admins: 'Administradores',
payer: 'Pagador',
paymentAccount: 'Cuenta de pago',
},
reportFraudPage: {
title: 'Reportar fraude con la tarjeta virtual',
Expand Down
9 changes: 7 additions & 2 deletions src/libs/PaymentUtils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type {ValueOf} from 'type-fest';
import getBankIcon from '@components/Icon/BankIcons';
import type {ThemeStyles} from '@styles/index';
import CONST from '@src/CONST';
import type BankAccount from '@src/types/onyx/BankAccount';
import type Fund from '@src/types/onyx/Fund';
import type PaymentMethod from '@src/types/onyx/PaymentMethod';
import type {ACHAccount} from '@src/types/onyx/Policy';
import * as Localize from './Localize';
import BankAccountModel from './models/BankAccount';

type AccountType = BankAccount['accountType'] | Fund['accountType'];
type AccountType = ValueOf<typeof CONST.PAYMENT_METHODS> | undefined;

/**
* Check to see if user has either a debit card or personal bank account added that can be used with a wallet.
Expand All @@ -25,11 +27,14 @@ function hasExpensifyPaymentMethod(fundList: Record<string, Fund>, bankAccountLi
return validBankAccount || (shouldIncludeDebitCard && validDebitCard);
}

function getPaymentMethodDescription(accountType: AccountType, account: BankAccount['accountData'] | Fund['accountData']): string {
function getPaymentMethodDescription(accountType: AccountType, account: BankAccount['accountData'] | Fund['accountData'] | ACHAccount): string {
if (account) {
if (accountType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT && 'accountNumber' in account) {
return `${Localize.translateLocal('paymentMethodList.accountLastFour')} ${account.accountNumber?.slice(-4)}`;
}
if (accountType === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT && 'accountNumber' in account) {
return `${Localize.translateLocal('paymentMethodList.accountLastFour')} ${account.accountNumber?.slice(-4)}`;
}
if (accountType === CONST.PAYMENT_METHODS.DEBIT_CARD && 'cardNumber' in account) {
return `${Localize.translateLocal('paymentMethodList.cardLastFour')} ${account.cardNumber?.slice(-4)}`;
}
Expand Down
19 changes: 17 additions & 2 deletions src/pages/workspace/workflows/ToggleSettingsOptionRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ type ToggleSettingOptionRowProps = {
/** Used to apply styles to the Title */
titleStyle?: StyleProp<TextStyle>;

/** Used to apply styles to the Subtitle */
subtitleStyle?: StyleProp<TextStyle>;

/** Whether the option is enabled or not */
isActive: boolean;

Expand Down Expand Up @@ -76,6 +79,7 @@ function ToggleSettingOptionRow({
title,
customTitle,
subtitle,
subtitleStyle,
switchAccessibilityLabel,
shouldPlaceSubtitleBelowSwitch,
shouldEscapeText = undefined,
Expand Down Expand Up @@ -119,8 +123,19 @@ function ToggleSettingOptionRow({
</View>
);
}
return <Text style={[styles.mutedNormalTextLabel, shouldPlaceSubtitleBelowSwitch ? styles.mt1 : {...styles.mt1, ...styles.mr5}]}>{subtitle}</Text>;
}, [subtitle, shouldParseSubtitle, styles.mutedNormalTextLabel, styles.mt1, styles.mr5, styles.flexRow, styles.renderHTML, shouldPlaceSubtitleBelowSwitch, processedSubtitle]);
return <Text style={[styles.mutedNormalTextLabel, shouldPlaceSubtitleBelowSwitch ? styles.mt1 : {...styles.mt1, ...styles.mr5}, subtitleStyle]}>{subtitle}</Text>;
}, [
subtitle,
shouldParseSubtitle,
styles.mutedNormalTextLabel,
styles.mt1,
styles.mr5,
styles.flexRow,
styles.renderHTML,
shouldPlaceSubtitleBelowSwitch,
subtitleStyle,
processedSubtitle,
]);

return (
<OfflineWithFeedback
Expand Down
Loading
Loading