Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fa5e27d
Add the Xero currency conversion cost account setting
ishpaul777 Aug 17, 2026
1e1e421
Add the Xero currency conversion cost account selector
ishpaul777 Aug 17, 2026
961aebd
Show the currency conversion cost account on the Xero advanced page
ishpaul777 Aug 17, 2026
ab0c240
Generate translations for the Xero currency conversion cost account
ishpaul777 Aug 17, 2026
11555f8
Describe the Xero currency conversion cost as a spend money transaction
ishpaul777 Aug 17, 2026
fa7229a
Merge branch 'Expensify:main' into ishpaul/672453-xero-fx-expense-acc…
ishpaul777 Aug 23, 2026
5eed525
Drop the obsolete globalReimbursements beta check from the FX gate
ishpaul777 Aug 25, 2026
4a55c44
Merge branch 'Expensify:main' into ishpaul/672453-xero-fx-expense-acc…
ishpaul777 Aug 31, 2026
a45711d
Drop manual memoization and hardcoded policy ID fallback from the Xer…
ishpaul777 Sep 7, 2026
cda78c6
Scope getXeroExpenseAccounts to the account list and cover it with tests
ishpaul777 Sep 7, 2026
ffc6ae0
Cover the Xero currency conversion fee account rollback and missing p…
ishpaul777 Sep 7, 2026
324d0ef
Hide the currency conversion cost settings unless the workspace pays …
ishpaul777 Sep 7, 2026
e1b42a9
Pass the policy to the currency conversion cost gate on the Xero adva…
ishpaul777 Sep 7, 2026
fd26757
Let admins search the QuickBooks Online currency conversion cost acco…
ishpaul777 Sep 7, 2026
560798c
Let admins search the Xero currency conversion cost account list
ishpaul777 Sep 7, 2026
4fcac71
Merge remote-tracking branch 'upstream/main' into ishpaul/672453-xero…
ishpaul777 Sep 7, 2026
548569a
Drop internal service references from the currency conversion cost co…
ishpaul777 Sep 7, 2026
28cc28f
Rename the currency conversion cost gate hook to say what it checks
ishpaul777 Sep 7, 2026
5f80e94
Merge branch 'Expensify:main' into ishpaul/672453-xero-fx-expense-acc…
ishpaul777 Sep 8, 2026
92259ec
Include FX_EXPENSE_ACCOUNT in subscribedAdvancedSettings for QBO and …
ishpaul777 Sep 9, 2026
fca2cb5
Merge branch 'Expensify:main' into ishpaul/672453-xero-fx-expense-acc…
ishpaul777 Sep 10, 2026
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
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3110,6 +3110,7 @@ const CONST = {
ENABLED: 'enabled',
REIMBURSEMENT_ACCOUNT_ID: 'reimbursementAccountID',
INVOICE_COLLECTIONS_ACCOUNT_ID: 'invoiceCollectionsAccountID',
FX_EXPENSE_ACCOUNT: 'fxExpenseAccount',
SYNC_REIMBURSED_REPORTS: 'syncReimbursedReports',
ENABLE_NEW_CATEGORIES: 'enableNewCategories',
EXPORTER: 'exporter',
Expand Down
9 changes: 9 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4317,6 +4317,15 @@ const ROUTES = {
return `workspaces/${policyID}/accounting/xero/advanced/invoice-account-selector` as const;
},
},
POLICY_ACCOUNTING_XERO_FX_EXPENSE_ACCOUNT_SELECTOR: {
route: 'workspaces/:policyID/accounting/xero/advanced/fx-expense-account-selector',
getRoute: (policyID: string | undefined) => {
if (!policyID) {
Log.warn('Invalid policyID is used to build the POLICY_ACCOUNTING_XERO_FX_EXPENSE_ACCOUNT_SELECTOR route');
}
return `workspaces/${policyID}/accounting/xero/advanced/fx-expense-account-selector` as const;
},
},
POLICY_ACCOUNTING_XERO_BILL_PAYMENT_ACCOUNT_SELECTOR: {
route: 'workspaces/:policyID/accounting/xero/advanced/bill-payment-account-selector',
getRoute: (policyID: string | undefined) => {
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ const SCREENS = {
XERO_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Invoice_Account_Selector',
DYNAMIC_XERO_EXPORT_PREFERRED_EXPORTER_SELECT: 'Dynamic_Workspace_Accounting_Xero_Export_Preferred_Exporter_Select',
XERO_BILL_PAYMENT_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Bill_Payment_Account_Selector',
XERO_FX_EXPENSE_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Fx_Expense_Account_Selector',
DYNAMIC_XERO_EXPORT_BANK_ACCOUNT_SELECT: 'Dynamic_Policy_Accounting_Xero_Export_Bank_Account_Select',
DYNAMIC_XERO_NON_REIMBURSABLE_DEFAULT_CONTACT_SELECT: 'Dynamic_Policy_Accounting_Xero_Non_Reimbursable_Default_Contact_Select',
NETSUITE_IMPORT_MAPPING: 'Policy_Accounting_NetSuite_Import_Mapping',
Expand Down
18 changes: 18 additions & 0 deletions src/hooks/useCanConfigureCurrencyConversionFees.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import CONST from '@src/CONST';
import type {Policy} from '@src/types/onyx';

import type {OnyxEntry} from 'react-native-onyx';

import usePermissions from './usePermissions';

/**
* Whether the currency conversion cost settings are available for a workspace. The cost only arises when
* the workspace reimburses through Expensify, so every surface that exposes these settings gates on this.
*/
function useCanConfigureCurrencyConversionFees(policy: OnyxEntry<Policy>): boolean {
const {isBetaEnabled} = usePermissions();

return isBetaEnabled(CONST.BETAS.GLOBAL_REIMBURSEMENT_FX) && policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES;
}

export default useCanConfigureCurrencyConversionFees;
15 changes: 0 additions & 15 deletions src/hooks/useIsGlobalReimbursementFXEnabled.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5135,6 +5135,9 @@ ${amount} für ${merchant} – ${date}`,
xeroInvoiceCollectionAccount: 'Xero-Forderungskonto für Rechnungen',
xeroBillPaymentAccountDescription: 'Wählen Sie, von wo aus Sie Rechnungen bezahlen möchten, und wir erstellen die Zahlung in Xero.',
invoiceAccountSelectorDescription: 'Wählen Sie aus, wohin Rechnungzahlungen eingehen sollen, und wir erstellen die Zahlung in Xero.',
xeroFxExpenseAccount: 'Xero-Konto für Währungsumrechnungsgebühren',
fxExpenseAccountDescription:
'Wenn Ihr Unternehmen die Kosten für die Währungsumrechnung bei einer im Ausland getätigten Zahlung übernimmt, buchen wir diese Kosten in Xero auf dieses Konto als „Geldausgabe“-Transaktion.',
},
exportDate: {
label: 'Rechnungsdatum des Einkaufs',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/el.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5213,6 +5213,9 @@ ${amount} για ${merchant} - ${date}`,
xeroInvoiceCollectionAccount: 'Λογαριασμός εισπράξεων τιμολογίων Xero',
xeroBillPaymentAccountDescription: 'Επιλέξτε από πού θα πληρώνονται οι λογαριασμοί και θα δημιουργήσουμε την πληρωμή στο Xero.',
invoiceAccountSelectorDescription: 'Επιλέξτε πού θέλετε να λαμβάνετε τις πληρωμές τιμολογίων και θα δημιουργήσουμε την πληρωμή στο Xero.',
xeroFxExpenseAccount: 'λογαριασμός προμήθειας μετατροπής συναλλάγματος Xero',
fxExpenseAccountDescription:
'Όταν η εταιρεία σας καλύπτει το κόστος μετατροπής νομίσματος για μια πληρωμή που έγινε στο εξωτερικό, θα καταχωρούμε αυτό το κόστος σε αυτόν τον λογαριασμό στο Xero ως συναλλαγή «εξόδου χρημάτων».',
},
exportDate: {
label: 'Ημερομηνία τιμολογίου αγοράς',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5252,6 +5252,9 @@ const translations = {
xeroInvoiceCollectionAccount: 'Xero invoice collections account',
xeroBillPaymentAccountDescription: "Choose where to pay bills from and we'll create the payment in Xero.",
invoiceAccountSelectorDescription: "Choose where to receive invoice payments and we'll create the payment in Xero.",
xeroFxExpenseAccount: 'Xero currency conversion fee account',
fxExpenseAccountDescription:
"When your company covers the currency conversion cost on a payment made abroad, we'll post that cost to this account in Xero as a spend money transaction.",
},
exportDate: {
label: 'Purchase bill date',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5068,6 +5068,9 @@ ${amount} para ${merchant} - ${date}`,
xeroInvoiceCollectionAccount: 'Cuenta de cobro de las facturas Xero',
xeroBillPaymentAccountDescription: 'Elige desde dónde pagar las facturas y crearemos el pago en Xero.',
invoiceAccountSelectorDescription: 'Elige dónde recibir los pagos de facturas y crearemos el pago en Xero.',
xeroFxExpenseAccount: 'Cuenta de comisión por conversión de divisa de Xero',
fxExpenseAccountDescription:
'Cuando tu empresa cubra el coste de conversión de moneda en un pago realizado en el extranjero, registraremos ese coste en esta cuenta en Xero como una transacción de gasto de dinero.',
},
exportDate: {
label: 'Fecha de la factura de compra',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5142,6 +5142,9 @@ ${amount} pour ${merchant} - ${date}`,
xeroInvoiceCollectionAccount: 'Compte d’encaissement des factures Xero',
xeroBillPaymentAccountDescription: 'Choisissez d’où payer les factures et nous créerons le paiement dans Xero.',
invoiceAccountSelectorDescription: 'Choisissez où recevoir les paiements de factures et nous créerons le paiement dans Xero.',
xeroFxExpenseAccount: 'Compte de frais de conversion de devise Xero',
fxExpenseAccountDescription:
'Lorsque votre entreprise prend en charge le coût de conversion de devise sur un paiement effectué à l’étranger, nous comptabiliserons ce coût sur ce compte dans Xero en tant qu’opération de décaissement.',
},
exportDate: {
label: 'Date de facture d’achat',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5102,6 +5102,9 @@ ${amount} per ${merchant} - ${date}`,
xeroInvoiceCollectionAccount: 'Conto incassi fatture Xero',
xeroBillPaymentAccountDescription: 'Scegli da dove pagare le fatture e creeremo il pagamento in Xero.',
invoiceAccountSelectorDescription: 'Scegli dove ricevere i pagamenti delle fatture e creeremo il pagamento in Xero.',
xeroFxExpenseAccount: 'Conto commissioni conversione valuta Xero',
fxExpenseAccountDescription:
'Quando la tua azienda copre il costo di conversione valutaria su un pagamento effettuato all’estero, registreremo quel costo su questo conto in Xero come transazione di tipo “spesa di denaro”.',
},
exportDate: {
label: 'Data fattura di acquisto',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5060,6 +5060,8 @@ ${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? 'あなたの'
xeroInvoiceCollectionAccount: 'Xero請求書回収勘定',
xeroBillPaymentAccountDescription: '請求書の支払元を選択すると、Xero 内に支払処理を作成します。',
invoiceAccountSelectorDescription: '請求書の入金先を選択すると、Xero に支払いが作成されます。',
xeroFxExpenseAccount: 'Xero 通貨換算手数料勘定',
fxExpenseAccountDescription: '海外で行われた支払いに対する通貨換算コストを御社が負担する場合、そのコストは「支出入金取引」として Xero のこの勘定科目に計上します。',
},
exportDate: {
label: '仕入請求書の日付',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5099,6 +5099,9 @@ ${amount} voor ${merchant} - ${date}`,
xeroInvoiceCollectionAccount: 'Xero-incasso rekening voor facturen',
xeroBillPaymentAccountDescription: 'Kies vanwaar je rekeningen wilt betalen en wij maken de betaling aan in Xero.',
invoiceAccountSelectorDescription: 'Kies waar je factuurbetalingen wilt ontvangen en wij maken de betaling aan in Xero.',
xeroFxExpenseAccount: 'Xero-account voor valutaconversiekosten',
fxExpenseAccountDescription:
'Wanneer je bedrijf de kosten voor valutaconversie dekt voor een betaling in het buitenland, boeken we die kosten op deze rekening in Xero als een ‘spend money’-transactie.',
},
exportDate: {
label: 'Aankoopfactuurdatum',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5127,6 +5127,9 @@ ${amount} dla ${merchant} - ${date}`,
xeroInvoiceCollectionAccount: 'Konto rozliczeniowe faktur Xero',
xeroBillPaymentAccountDescription: 'Wybierz, z jakiego konta opłacać rachunki, a my utworzymy płatność w Xero.',
invoiceAccountSelectorDescription: 'Wybierz, gdzie chcesz otrzymywać płatności za faktury, a my utworzymy płatność w Xero.',
xeroFxExpenseAccount: 'Konto opłat za przewalutowanie Xero',
fxExpenseAccountDescription:
'Gdy twoja firma pokrywa koszt przewalutowania przy płatności dokonanej za granicą, zaksięgujemy ten koszt na tym koncie w Xero jako transakcję „wydanie pieniędzy”.',
},
exportDate: {
label: 'Data rachunku zakupu',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5095,6 +5095,9 @@ ${amount} para ${merchant} - ${date}`,
xeroInvoiceCollectionAccount: 'Conta de recebimentos de faturas do Xero',
xeroBillPaymentAccountDescription: 'Escolha de onde pagar as contas e nós criaremos o pagamento no Xero.',
invoiceAccountSelectorDescription: 'Escolha onde receber os pagamentos de faturas e nós criaremos o pagamento no Xero.',
xeroFxExpenseAccount: 'Conta de taxa de conversão de moeda do Xero',
fxExpenseAccountDescription:
'Quando sua empresa cobrir o custo de conversão de moeda em um pagamento feito no exterior, nós lançaremos esse custo nesta conta no Xero como uma transação de saída de dinheiro.',
},
exportDate: {
label: 'Data da fatura de compra',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4930,6 +4930,8 @@ ${amount},商户:${merchant} - 日期:${date}`,
xeroInvoiceCollectionAccount: 'Xero 发票收款账户',
xeroBillPaymentAccountDescription: '选择从哪里支付账单,我们会在 Xero 中创建相应的付款。',
invoiceAccountSelectorDescription: '选择接收发票付款的账户,我们会在 Xero 中创建这笔付款。',
xeroFxExpenseAccount: 'Xero 货币转换手续费科目',
fxExpenseAccountDescription: '当您的公司承担境外付款的货币兑换成本时,我们会在 Xero 中将该成本记入此科目,作为一笔“支出款项”交易。',
},
exportDate: {
label: '采购账单日期',
Expand Down
2 changes: 2 additions & 0 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ const WRITE_COMMANDS = {
UPDATE_XERO_SYNC_INVOICE_COLLECTIONS_ACCOUNT_ID: 'UpdateXeroSyncInvoiceCollectionsAccountID',
UPDATE_XERO_SYNC_SYNC_REIMBURSED_REPORTS: 'UpdateXeroSyncSyncReimbursedReports',
UPDATE_XERO_SYNC_REIMBURSEMENT_ACCOUNT_ID: 'UpdateXeroSyncReimbursementAccountID',
UPDATE_XERO_FX_EXPENSE_ACCOUNT: 'UpdateXeroFxExpenseAccount',
REQUEST_FEED_SETUP: 'RequestFeedSetup',
SET_COMPANY_CARD_FEED_NAME: 'SetFeedName',
DELETE_COMPANY_CARD_FEED: 'RemoveFeed',
Expand Down Expand Up @@ -1375,6 +1376,7 @@ type WriteCommandParameters = {
[WRITE_COMMANDS.UPDATE_XERO_SYNC_INVOICE_COLLECTIONS_ACCOUNT_ID]: Parameters.UpdateXeroGenericTypeParams;
[WRITE_COMMANDS.UPDATE_XERO_SYNC_SYNC_REIMBURSED_REPORTS]: Parameters.UpdateXeroGenericTypeParams;
[WRITE_COMMANDS.UPDATE_XERO_SYNC_REIMBURSEMENT_ACCOUNT_ID]: Parameters.UpdateXeroGenericTypeParams;
[WRITE_COMMANDS.UPDATE_XERO_FX_EXPENSE_ACCOUNT]: Parameters.UpdateXeroGenericTypeParams;

// Invoice API
[WRITE_COMMANDS.SET_INVOICING_TRANSFER_BANK_ACCOUNT]: Parameters.SetInvoicingTransferBankAccountParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,8 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/export/DynamicXeroPreferredExporterSelectPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_PAYMENT_ACCOUNT_SELECTOR]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/advanced/XeroBillPaymentAccountSelectorPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_FX_EXPENSE_ACCOUNT_SELECTOR]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/advanced/XeroFxExpenseAccountSelectorPage').default,

[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_SUBSIDIARY_SELECTOR]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/netsuite/NetSuiteSubsidiarySelector').default,
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_REUSE_EXISTING_CONNECTIONS]: () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const WORKSPACE_TO_RHP: Partial<Record<keyof WorkspaceSplitNavigatorParamList, s
SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR,
SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_EXPORT_PREFERRED_EXPORTER_SELECT,
SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_PAYMENT_ACCOUNT_SELECTOR,
SCREENS.WORKSPACE.ACCOUNTING.XERO_FX_EXPENSE_ACCOUNT_SELECTOR,
SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_EXPORT_BANK_ACCOUNT_SELECT,
SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_NON_REIMBURSABLE_DEFAULT_CONTACT_SELECT,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_SUBSIDIARY_SELECTOR,
Expand Down
1 change: 1 addition & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
[SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_XERO_INVOICE_SELECTOR.route},
[SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: DYNAMIC_ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT.path,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_PAYMENT_ACCOUNT_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_XERO_BILL_PAYMENT_ACCOUNT_SELECTOR.route},
[SCREENS.WORKSPACE.ACCOUNTING.XERO_FX_EXPENSE_ACCOUNT_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_XERO_FX_EXPENSE_ACCOUNT_SELECTOR.route},
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_SUBSIDIARY_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_NETSUITE_SUBSIDIARY_SELECTOR.route},
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_TOKEN_INPUT]: {path: ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.route},
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_SETUP]: {path: ROUTES.POLICY_ACCOUNTING_NETSUITE_SETUP.route},
Expand Down
3 changes: 3 additions & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,9 @@ type SettingsNavigatorParamList = {
[SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_PAYMENT_ACCOUNT_SELECTOR]: {
policyID: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.XERO_FX_EXPENSE_ACCOUNT_SELECTOR]: {
policyID: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_SAGE_INTACCT_PREREQUISITES]: {
policyID: string;
};
Expand Down
12 changes: 12 additions & 0 deletions src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {
} from '@src/types/onyx';
import type {ErrorFields, PendingAction, PendingFields} from '@src/types/onyx/OnyxCommon';
import type {
Account,
ApprovalRule,
ConnectionLastSync,
ConnectionName,
Expand Down Expand Up @@ -2135,6 +2136,16 @@ function getXeroBankAccounts(policy: Policy | undefined, selectedBankAccountId:
}));
}

/** Only profit and loss accounts can take a currency conversion cost, so these are kept apart from the bank accounts. */
function getXeroExpenseAccounts(expenseAccounts: Account[] | undefined, selectedExpenseAccountID: string | undefined): SelectorType[] {
return (expenseAccounts ?? []).map(({id, name}) => ({
value: id,
text: name,
keyForList: id,
isSelected: selectedExpenseAccountID === id,
}));
}

function areSettingsInErrorFields(settings?: string[], errorFields?: ErrorFields) {
if (settings === undefined || errorFields === undefined) {
return false;
Expand Down Expand Up @@ -3363,6 +3374,7 @@ export {
findCurrentXeroOrganization,
getCurrentXeroOrganizationName,
getXeroBankAccounts,
getXeroExpenseAccounts,
hasPolicyWithXeroConnection,
getNetSuiteVendorOptions,
canUseTaxNetSuite,
Expand Down
17 changes: 17 additions & 0 deletions src/libs/actions/connections/Xero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,22 @@ function updateXeroSyncReimbursementAccountID(
API.write(WRITE_COMMANDS.UPDATE_XERO_SYNC_REIMBURSEMENT_ACCOUNT_ID, parameters, {optimisticData, failureData, successData});
}

function updateXeroFxExpenseAccount(policyID: string | undefined, settingValue: string, oldSettingValue?: string) {
if (!policyID || settingValue === oldSettingValue) {
return;
}

const parameters: UpdateXeroGenericTypeParams = {
policyID,
settingValue: JSON.stringify(settingValue),
Comment thread
ishpaul777 marked this conversation as resolved.
idempotencyKey: String(CONST.XERO_CONFIG.FX_EXPENSE_ACCOUNT),
};

const {optimisticData, failureData, successData} = prepareXeroOptimisticData(policyID, CONST.XERO_CONFIG.FX_EXPENSE_ACCOUNT, settingValue, oldSettingValue);

API.write(WRITE_COMMANDS.UPDATE_XERO_FX_EXPENSE_ACCOUNT, parameters, {optimisticData, failureData, successData});
}

function updateXeroSyncSyncReimbursedReports(
policyID: string | undefined,
syncReimbursedReports: Partial<Connections['xero']['config']['sync']['syncReimbursedReports']>,
Expand Down Expand Up @@ -605,4 +621,5 @@ export {
updateXeroSyncInvoiceCollectionsAccountID,
updateXeroSyncSyncReimbursedReports,
updateXeroSyncReimbursementAccountID,
updateXeroFxExpenseAccount,
};
Loading
Loading