Skip to content

feat: Enable non USD flow behind beta flag #56931

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
be5ed96
Merge branch 'main' of github.com:Expensify/App into feat/50912-enabl…
MrMuzyk Feb 13, 2025
5e48ccd
polish
MrMuzyk Feb 14, 2025
a834580
Merge branch 'main' of github.com:Expensify/App into feat/50912-enabl…
MrMuzyk Feb 14, 2025
da3bd35
break
MrMuzyk Feb 17, 2025
5c8a448
Merge branch 'main' of github.com:Expensify/App into feat/50912-enabl…
MrMuzyk Feb 17, 2025
50b8f51
more fixes
MrMuzyk Feb 19, 2025
fd191a0
Merge branch 'main' of github.com:Expensify/App into feat/50912-enabl…
MrMuzyk Feb 20, 2025
a47329f
few more integration places
MrMuzyk Feb 20, 2025
580e0de
css fixes
MrMuzyk Feb 21, 2025
c0daa51
Merge branch 'main' of github.com:Expensify/App into feat/50912-enabl…
MrMuzyk Feb 21, 2025
7b42422
Merge branch 'feat/50911-continue-vbba' of github.com:callstack-inter…
MrMuzyk Feb 21, 2025
fa0d293
break
MrMuzyk Feb 24, 2025
1770937
Merge branch 'main' of github.com:Expensify/App into feat/50912-enabl…
MrMuzyk Feb 24, 2025
ba0a424
confirmation substep
MrMuzyk Feb 24, 2025
ee347c8
fix: linter
MrMuzyk Feb 24, 2025
a640dbd
fix: signer linter
MrMuzyk Feb 24, 2025
2b33645
Merge branch 'main' of github.com:Expensify/App into feat/50912-enabl…
MrMuzyk Feb 24, 2025
cbe1089
Merge branch 'main' of github.com:Expensify/App into feat/50912-enabl…
MrMuzyk Feb 25, 2025
599042a
usd flow fixes
MrMuzyk Feb 25, 2025
c63af45
linter
MrMuzyk Feb 25, 2025
167c9a7
lint
MrMuzyk Feb 25, 2025
65a4156
revert submodule change
Mar 3, 2025
48ec504
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
MrMuzyk Mar 3, 2025
83bcdf8
fix
MrMuzyk Mar 3, 2025
b0cc1f4
reset, update currency, loading corpay fields fix, default value acco…
MrMuzyk Mar 4, 2025
dbda52e
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
MrMuzyk Mar 6, 2025
70983c3
prettier
MrMuzyk Mar 6, 2025
3fa982c
Merge branch 'feat/58087-padding-in-vba' of github.com:callstack-inte…
MrMuzyk Mar 12, 2025
35a5096
fix: bring back addressStep changes
MrMuzyk Mar 12, 2025
7c236a4
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Mar 13, 2025
0248425
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Mar 18, 2025
8cf6ef3
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Mar 20, 2025
198120d
fix: lint prettier
MrMuzyk Mar 20, 2025
2e1ae1f
ts and remove unused file
MrMuzyk Mar 20, 2025
ea8d20d
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Mar 24, 2025
d65b646
feat: add href for currencies list and remove comment
MrMuzyk Mar 24, 2025
15017cd
fix: checks
MrMuzyk Mar 24, 2025
8902c7e
fix: remove outdated comments
MrMuzyk Mar 24, 2025
5a01753
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Mar 25, 2025
db6b190
fixes
MrMuzyk Mar 26, 2025
188879b
move comment
MrMuzyk Mar 26, 2025
b143863
fix: update displayed list of countries to EU members only
MrMuzyk Mar 28, 2025
8f5d3d5
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Apr 1, 2025
e152409
hide behind beta
MrMuzyk Apr 1, 2025
9c39436
lint, accept only single file
MrMuzyk Apr 2, 2025
99df7be
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Apr 2, 2025
7eac6cf
linter
MrMuzyk Apr 2, 2025
f2d2129
remove unused vbba currency
MrMuzyk Apr 2, 2025
a086078
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Apr 4, 2025
ead1d11
revert removal of nzd
MrMuzyk Apr 4, 2025
4980c72
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Apr 7, 2025
8c2b521
fix: separate utils for dierct and global reimbursements
MrMuzyk Apr 7, 2025
0da12be
Merge branch 'feat/step-6-logic' of github.com:callstack-internal/Exp…
MrMuzyk Apr 9, 2025
4db1483
lint
MrMuzyk Apr 9, 2025
f8b808e
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Apr 10, 2025
e787ac6
Merge branch 'feat/50907-GR-Phase3-Step5-nav-api-call' of github.com:…
MrMuzyk Apr 11, 2025
eb50534
Merge branch 'feat/step-6-logic' of github.com:callstack-internal/Exp…
MrMuzyk Apr 11, 2025
1231354
Merge branch 'feat/step-6-logic' of github.com:callstack-internal/Exp…
MrMuzyk Apr 11, 2025
64df8e7
fix: not found screen for eur
MrMuzyk Apr 14, 2025
67542b0
fix: back button for beneficial owners step
MrMuzyk Apr 14, 2025
a27eaf7
Merge branch 'feat/step-6-logic' of github.com:callstack-internal/Exp…
MrMuzyk Apr 15, 2025
ee9ef1c
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Apr 16, 2025
bead070
linter
MrMuzyk Apr 16, 2025
ca05726
linter
MrMuzyk Apr 16, 2025
7a23adc
fix
MrMuzyk Apr 16, 2025
4ea076f
fix: hang tight alignments
MrMuzyk Apr 16, 2025
9eaa3a5
fix: remove comment
MrMuzyk Apr 16, 2025
33524e3
fix: bring back old modal for the transition period
MrMuzyk Apr 16, 2025
a79a1f6
Merge branch 'main' of https://github.com/Expensify/App into feat/509…
MrMuzyk Apr 17, 2025
e76fc1a
update finish screen
MrMuzyk Apr 17, 2025
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
35 changes: 5 additions & 30 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ const CONST = {
},
NON_USD_BANK_ACCOUNT: {
ALLOWED_FILE_TYPES: ['pdf', 'jpg', 'jpeg', 'png'],
FILE_LIMIT: 10,
FILE_LIMIT: 1,
TOTAL_FILES_SIZE_LIMIT: 5242880,
PURPOSE_OF_TRANSACTION_ID: 'Intercompany_Payment',
CURRENT_USER_KEY: 'currentUser',
Expand Down Expand Up @@ -796,6 +796,7 @@ const CONST = {
RECEIPT_LINE_ITEMS: 'receiptLineItems',
LEFT_HAND_BAR: 'leftHandBar',
WALLET: 'newdotWallet',
GLOBAL_REIMBURSEMENTS_ON_ND: 'globalReimbursementsOnND',
},
BUTTON_STATES: {
DEFAULT: 'default',
Expand Down Expand Up @@ -1084,6 +1085,7 @@ const CONST = {
ENCRYPTION_AND_SECURITY_HELP_URL: 'https://help.expensify.com/articles/new-expensify/settings/Encryption-and-Data-Security',
PLAN_TYPES_AND_PRICING_HELP_URL: 'https://help.expensify.com/articles/new-expensify/billing-and-subscriptions/Plan-types-and-pricing',
MERGE_ACCOUNT_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/settings/Merge-accounts',
CONNECT_A_BUSINESS_BANK_ACCOUNT_HELP_URL: 'https://help.expensify.com/articles/new-expensify/expenses-&-payments/Connect-a-Business-Bank-Account',
TEST_RECEIPT_URL: `${CLOUDFRONT_URL}/images/fake-receipt__tacotodds.png`,
// Use Environment.getEnvironmentURL to get the complete URL with port number
DEV_NEW_EXPENSIFY_URL: 'https://dev.new.expensify.com:',
Expand Down Expand Up @@ -3987,61 +3989,34 @@ const CONST = {
ZW: 'Zimbabwe',
},

ALL_EUROPEAN_COUNTRIES: {
AL: 'Albania',
AD: 'Andorra',
ALL_EUROPEAN_UNION_COUNTRIES: {
AT: 'Austria',
BY: 'Belarus',
BE: 'Belgium',
BA: 'Bosnia & Herzegovina',
BG: 'Bulgaria',
HR: 'Croatia',
CY: 'Cyprus',
CZ: 'Czech Republic',
DK: 'Denmark',
EE: 'Estonia',
FO: 'Faroe Islands',
FI: 'Finland',
FR: 'France',
GE: 'Georgia',
DE: 'Germany',
GI: 'Gibraltar',
GR: 'Greece',
GL: 'Greenland',
HU: 'Hungary',
IS: 'Iceland',
IE: 'Ireland',
IM: 'Isle of Man',
IT: 'Italy',
JE: 'Jersey',
XK: 'Kosovo',
LV: 'Latvia',
LI: 'Liechtenstein',
LT: 'Lithuania',
LU: 'Luxembourg',
LV: 'Latvia',
MT: 'Malta',
MD: 'Moldova',
MC: 'Monaco',
ME: 'Montenegro',
NL: 'Netherlands',
MK: 'North Macedonia',
NO: 'Norway',
PL: 'Poland',
PT: 'Portugal',
RO: 'Romania',
RU: 'Russia',
SM: 'San Marino',
RS: 'Serbia',
SK: 'Slovakia',
SI: 'Slovenia',
ES: 'Spain',
SJ: 'Svalbard & Jan Mayen',
SE: 'Sweden',
CH: 'Switzerland',
TR: 'Turkey',
UA: 'Ukraine',
GB: 'United Kingdom',
VA: 'Vatican City',
},

// Sources: https://github.com/Expensify/App/issues/14958#issuecomment-1442138427
Expand Down
15 changes: 10 additions & 5 deletions src/components/SettlementButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {useEffect, useMemo, useRef} from 'react';
import type {GestureResponderEvent} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import type {TupleToUnion} from 'type-fest';
import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu';
import type {PaymentType} from '@components/ButtonWithDropdownMenu/types';
import * as Expensicons from '@components/Icon/Expensicons';
Expand Down Expand Up @@ -35,6 +36,8 @@ type KYCFlowEvent = GestureResponderEvent | KeyboardEvent | undefined;

type TriggerKYCFlow = (event: KYCFlowEvent, iouPaymentType: PaymentMethodType) => void;

type CurrencyType = TupleToUnion<typeof CONST.DIRECT_REIMBURSEMENT_CURRENCIES>;

function SettlementButton({
addDebitCardRoute = ROUTES.IOU_SEND_ADD_DEBIT_CARD,
addBankAccountRoute = '',
Expand Down Expand Up @@ -75,7 +78,8 @@ function SettlementButton({
const {translate} = useLocalize();
const {isOffline} = useNetwork();
// The app would crash due to subscribing to the entire report collection if chatReportID is an empty string. So we should have a fallback ID here.
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID || CONST.DEFAULT_NUMBER_ID}`);
/* eslint-disable-next-line rulesdir/no-default-id-values */
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID || CONST.DEFAULT_NUMBER_ID}`, {canBeMissing: true});
const isUserValidated = useAccountValidation();
const policyEmployeeAccountIDs = policyID ? getPolicyEmployeeAccountIDs(policyID) : [];
const reportBelongsToWorkspace = policyID ? doesReportBelongToWorkspace(chatReport, policyEmployeeAccountIDs, policyID) : false;
Expand All @@ -87,12 +91,13 @@ function SettlementButton({
}
return (paymentMethod?.[policyIDKey] as LastPaymentMethodType)?.lastUsed;
},
canBeMissing: true,
});

const isLoadingLastPaymentMethod = isLoadingOnyxValue(lastPaymentMethodResult);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
const [bankAccountList = {}] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [fundList = {}] = useOnyx(ONYXKEYS.FUND_LIST);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {canBeMissing: true});
const [bankAccountList = {}] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST, {canBeMissing: true});
const [fundList = {}] = useOnyx(ONYXKEYS.FUND_LIST, {canBeMissing: true});
const lastPaymentMethodRef = useRef(lastPaymentMethod);

useEffect(() => {
Expand Down Expand Up @@ -156,7 +161,7 @@ function SettlementButton({

if (isInvoiceReport) {
const formattedPaymentMethods = formatPaymentMethods(bankAccountList, fundList, styles);
const isCurrencySupported = isCurrencySupportedForDirectReimbursement(currency);
const isCurrencySupported = isCurrencySupportedForDirectReimbursement(currency as CurrencyType);
const getPaymentSubitems = (payAsBusiness: boolean) =>
formattedPaymentMethods.map((formattedPaymentMethod) => ({
text: formattedPaymentMethod?.title ?? '',
Expand Down
6 changes: 3 additions & 3 deletions src/components/UploadFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import AttachmentPicker from './AttachmentPicker';
import Button from './Button';
import DotIndicatorMessage from './DotIndicatorMessage';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import {Close, Paperclip} from './Icon/Expensicons';
import {PressableWithFeedback} from './Pressable';
import Text from './Text';

Expand Down Expand Up @@ -129,7 +129,7 @@ function UploadFile({
key={file.name}
>
<Icon
src={Expensicons.Paperclip}
src={Paperclip}
fill={theme.icon}
medium
/>
Expand All @@ -145,7 +145,7 @@ function UploadFile({
accessibilityLabel={translate('common.remove')}
>
<Icon
src={Expensicons.Close}
src={Close}
fill={theme.icon}
medium
/>
Expand Down
9 changes: 7 additions & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import type {
ConnectionNameParams,
ConnectionParams,
CurrencyCodeParams,
CurrencyInputDisabledTextParams,
CustomersOrJobsLabelParams,
CustomUnitRateParams,
DateParams,
Expand Down Expand Up @@ -2693,7 +2694,6 @@ const translations = {
letsDoubleCheck: 'Let’s double check that everything looks fine.',
thisBankAccount: 'This bank account will be used for business payments on your workspace',
accountNumber: 'Account number',
bankStatement: 'Bank statement',
chooseFile: 'Choose file',
uploadYourLatest: 'Upload your latest statement',
pleaseUpload: ({lastFourDigits}: LastFourDigitsParams) => `Please upload the most recent monthly statement for your business bank account ending in ${lastFourDigits}.`,
Expand Down Expand Up @@ -4622,7 +4622,8 @@ const translations = {
nameIsRequiredError: "You'll need to give your workspace a name",
currencyInputLabel: 'Default currency',
currencyInputHelpText: 'All expenses on this workspace will be converted to this currency.',
currencyInputDisabledText: "The default currency can't be changed because this workspace is linked to a USD bank account.",
currencyInputDisabledText: ({currency}: CurrencyInputDisabledTextParams) =>
`The default currency can't be changed because this workspace is linked to a ${currency} bank account.`,
save: 'Save',
genericFailureMessage: 'An error occurred while updating the workspace. Please try again.',
avatarUploadFailureMessage: 'An error occurred uploading the avatar. Please try again.',
Expand Down Expand Up @@ -4651,6 +4652,10 @@ const translations = {
workspaceCurrency: 'Workspace currency',
updateCurrencyPrompt: 'It looks like your workspace is currently set to a different currency than USD. Please click the button below to update your currency to USD now.',
updateToUSD: 'Update to USD',
updateWorkspaceCurrency: 'Update workspace currency',
workspaceCurrencyNotSupported: 'Workspace currency not supported',
yourWorkspace: 'Your workspace is set to an unsupported currency. View the',
listOfSupportedCurrencies: 'list of supported currencies',
},
changeOwner: {
changeOwnerPageTitle: 'Transfer owner',
Expand Down
9 changes: 7 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import type {
ConnectionNameParams,
ConnectionParams,
CurrencyCodeParams,
CurrencyInputDisabledTextParams,
CustomersOrJobsLabelParams,
CustomUnitRateParams,
DateParams,
Expand Down Expand Up @@ -2718,7 +2719,6 @@ const translations = {
letsDoubleCheck: 'Verifiquemos que todo esté bien.',
thisBankAccount: 'Esta cuenta bancaria se utilizará para pagos comerciales en tu espacio de trabajo.',
accountNumber: 'Número de cuenta',
bankStatement: 'Extracto bancario',
chooseFile: 'Elegir archivo',
uploadYourLatest: '¿Cuáles son los detalles de tu cuenta bancaria comercial?',
pleaseUpload: ({lastFourDigits}: LastFourDigitsParams) => `Por favor suba el estado de cuenta mensual más reciente de tu cuenta bancaria comercial que termina en ${lastFourDigits}.`,
Expand Down Expand Up @@ -4670,7 +4670,8 @@ const translations = {
nameIsRequiredError: 'Debes definir un nombre para tu espacio de trabajo',
currencyInputLabel: 'Moneda por defecto',
currencyInputHelpText: 'Todas los gastos en este espacio de trabajo serán convertidos a esta moneda.',
currencyInputDisabledText: 'La moneda predeterminada no se puede cambiar porque este espacio de trabajo está vinculado a una cuenta bancaria en USD.',
currencyInputDisabledText: ({currency}: CurrencyInputDisabledTextParams) =>
`La moneda predeterminada no se puede cambiar porque este espacio de trabajo está vinculado a una cuenta bancaria en ${currency}.`,
save: 'Guardar',
genericFailureMessage: 'Se ha producido un error al guardar el espacio de trabajo. Por favor, inténtalo de nuevo.',
avatarUploadFailureMessage: 'No se pudo subir el avatar. Por favor, inténtalo de nuevo.',
Expand Down Expand Up @@ -4700,6 +4701,10 @@ const translations = {
updateCurrencyPrompt:
'Parece que tu espacio de trabajo está configurado actualmente en una moneda diferente a USD. Por favor, haz clic en el botón de abajo para actualizar tu moneda a USD ahora.',
updateToUSD: 'Actualizar a USD',
updateWorkspaceCurrency: 'Actualizar la moneda del espacio de trabajo',
workspaceCurrencyNotSupported: 'Moneda del espacio de trabajo no soportada',
yourWorkspace: 'Tu espacio de trabajo está configurado en una moneda no soportada. Consulta la',
listOfSupportedCurrencies: 'lista de monedas soportadas',
},
changeOwner: {
changeOwnerPageTitle: 'Transferir la propiedad',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,10 @@ type ReviewParams = {
amount: string;
};

type CurrencyInputDisabledTextParams = {
currency: string;
};

export type {
AuthenticationErrorParams,
ImportMembersSuccessfullDescriptionParams,
Expand Down Expand Up @@ -936,4 +940,5 @@ export type {
NeedCategoryForExportToIntegrationParams,
SubscriptionSettingsSummaryParams,
ReviewParams,
CurrencyInputDisabledTextParams,
};
5 changes: 5 additions & 0 deletions src/libs/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ function canUseInAppProvisioning(betas: OnyxEntry<Beta[]>): boolean {
return !!betas?.includes(CONST.BETAS.WALLET) || canUseAllBetas(betas);
}

function canUseGlobalReimbursementsOnND(betas: OnyxEntry<Beta[]>): boolean {
return !!betas?.includes(CONST.BETAS.GLOBAL_REIMBURSEMENTS_ON_ND) || canUseAllBetas(betas);
}

export default {
canUseDefaultRooms,
canUseLinkPreviews,
Expand All @@ -81,4 +85,5 @@ export default {
canUseProhibitedExpenses,
canUseLeftHandBar,
canUseInAppProvisioning,
canUseGlobalReimbursementsOnND,
};
10 changes: 9 additions & 1 deletion src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import escapeRegExp from 'lodash/escapeRegExp';
import lodashUnion from 'lodash/union';
import type {NullishDeep, OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import type {TupleToUnion, ValueOf} from 'type-fest';
import type {ReportExportType} from '@components/ButtonWithDropdownMenu/types';
import * as API from '@libs/API';
import type {
Expand Down Expand Up @@ -268,6 +268,13 @@ function isCurrencySupportedForDirectReimbursement(currency: string) {
return currency === CONST.CURRENCY.USD;
}

/**
* Checks if the currency is supported for global reimbursement
*/
function isCurrencySupportedForGlobalReimbursement(currency: TupleToUnion<typeof CONST.DIRECT_REIMBURSEMENT_CURRENCIES>, canUseGlobalReimbursementsOnND: boolean) {
return canUseGlobalReimbursementsOnND ? CONST.DIRECT_REIMBURSEMENT_CURRENCIES.includes(currency) : currency === CONST.CURRENCY.USD;
}

/**
* Returns the policy of the report
*/
Expand Down Expand Up @@ -5213,6 +5220,7 @@ export {
setPolicyCustomTaxName,
clearPolicyErrorField,
isCurrencySupportedForDirectReimbursement,
isCurrencySupportedForGlobalReimbursement,
getInvoicePrimaryWorkspace,
createDraftWorkspace,
savePreferredExportMethod,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ function ConnectedVerifiedBankAccount({
{shouldShowResetModal && (
<WorkspaceResetBankAccountModal
reimbursementAccount={reimbursementAccount}
setShouldShowConnectedVerifiedBankAccount={setShouldShowConnectedVerifiedBankAccount}
isNonUSDWorkspace={isNonUSDWorkspace}
setShouldShowConnectedVerifiedBankAccount={setShouldShowConnectedVerifiedBankAccount}
setUSDBankAccountStep={setUSDBankAccountStep}
setNonUSDBankAccountStep={setNonUSDBankAccountStep}
/>
Expand Down
14 changes: 9 additions & 5 deletions src/pages/ReimbursementAccount/NonUSD/BankInfo/BankInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ type BankInfoProps = {
function BankInfo({onBackButtonPress, onSubmit, policyID}: BankInfoProps) {
const {translate} = useLocalize();

const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT);
const [reimbursementAccountDraft] = useOnyx(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM_DRAFT);
const [corpayFields] = useOnyx(ONYXKEYS.CORPAY_FIELDS, {initWithStoredValues: false});
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {canBeMissing: false});
const [reimbursementAccountDraft] = useOnyx(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM_DRAFT, {canBeMissing: false});
const [corpayFields] = useOnyx(ONYXKEYS.CORPAY_FIELDS, {initWithStoredValues: false, canBeMissing: true});
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {canBeMissing: false});
const currency = policy?.outputCurrency ?? '';
const country = reimbursementAccount?.achData?.[COUNTRY] ?? reimbursementAccountDraft?.[COUNTRY] ?? '';
const inputKeys = getInputKeysForBankInfoStep(corpayFields);
Expand Down Expand Up @@ -65,6 +65,10 @@ function BankInfo({onBackButtonPress, onSubmit, policyID}: BankInfoProps) {
}, [onSubmit, reimbursementAccount?.errors, reimbursementAccount?.isCreateCorpayBankAccount, reimbursementAccount?.isLoading, reimbursementAccount?.isSuccess]);

useEffect(() => {
if (country === '') {
return;
}

getCorpayBankAccountFields(country, currency);
}, [country, currency]);

Expand Down Expand Up @@ -93,7 +97,7 @@ function BankInfo({onBackButtonPress, onSubmit, policyID}: BankInfoProps) {
}
};

if (corpayFields !== undefined && corpayFields?.isLoading === false && corpayFields?.isSuccess === false) {
if (corpayFields !== undefined && corpayFields?.isLoading === false && corpayFields?.isSuccess !== undefined && corpayFields?.isSuccess === false) {
return <NotFoundPage />;
}

Expand Down
Loading
Loading