Skip to content

Commit

Permalink
fix: rename to private
Browse files Browse the repository at this point in the history
  • Loading branch information
koko57 committed Aug 12, 2024
1 parent b76ab11 commit 39545cd
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,13 @@ const ONYXKEYS = {
WORKSPACE_CARDS_LIST: 'card_',

/** Expensify cards settings */
EXPENSIFY_CARD_SETTINGS: 'expensifyCardSettings_',
PRIVATE_EXPENSIFY_CARD_SETTINGS: 'private_expensifyCardSettings_',

/** Stores which connection is set up to use Continuous Reconciliation */
EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION: 'expensifyCard_continuousReconciliationConnection_',
PRIVATE_EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION: 'private_expensifyCard_continuousReconciliationConnection_',

/** The value that indicates whether Continuous Reconciliation should be used on the domain */
EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION: 'expensifyCard_useContinuousReconciliation_',
PRIVATE_EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION: 'private_expensifyCard_useContinuousReconciliation_',
},

/** List of Form ids */
Expand Down Expand Up @@ -737,10 +737,10 @@ type OnyxCollectionValuesMapping = {
[ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS]: OnyxTypes.PolicyConnectionSyncProgress;
[ONYXKEYS.COLLECTION.SNAPSHOT]: OnyxTypes.SearchResults;
[ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END]: OnyxTypes.BillingGraceEndPeriod;
[ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS]: OnyxTypes.ExpensifyCardSettings;
[ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS]: OnyxTypes.ExpensifyCardSettings;
[ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST]: OnyxTypes.WorkspaceCardsList;
[ONYXKEYS.COLLECTION.EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION]: OnyxTypes.PolicyConnectionName;
[ONYXKEYS.COLLECTION.EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION]: boolean;
[ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION]: OnyxTypes.PolicyConnectionName;
[ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION]: boolean;
};

type OnyxValuesMapping = {
Expand Down
18 changes: 9 additions & 9 deletions src/libs/actions/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ function revealVirtualCardDetails(cardID: number): Promise<ExpensifyCardDetails>
function updateSettlementFrequency(workspaceAccountID: number, frequency: ValueOf<typeof CONST.EXPENSIFY_CARD.FREQUENCY_SETTING>) {
// TODO: remove this code when the API is ready
if (frequency === CONST.EXPENSIFY_CARD.FREQUENCY_SETTING.DAILY) {
Onyx.merge(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`, {
Onyx.merge(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`, {
monthlySettlementDate: null,
});
} else {
Onyx.merge(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`, {
Onyx.merge(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`, {
monthlySettlementDate: new Date(),
});
}
Expand All @@ -222,7 +222,7 @@ function updateSettlementFrequency(workspaceAccountID: number, frequency: ValueO
// const optimisticData: OnyxUpdate[] = [
// {
// onyxMethod: Onyx.METHOD.MERGE,
// key: `${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// value: {
// monthlySettlementDate: '',
// },
Expand All @@ -232,7 +232,7 @@ function updateSettlementFrequency(workspaceAccountID: number, frequency: ValueO
// const successData: OnyxUpdate[] = [
// {
// onyxMethod: Onyx.METHOD.MERGE,
// key: `${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// value: {
// monthlySettlementDate: '',
// },
Expand All @@ -242,7 +242,7 @@ function updateSettlementFrequency(workspaceAccountID: number, frequency: ValueO
// const failureData: OnyxUpdate[] = [
// {
// onyxMethod: Onyx.METHOD.MERGE,
// key: `${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// value: {
// monthlySettlementDate: null,
// },
Expand All @@ -259,15 +259,15 @@ function updateSettlementFrequency(workspaceAccountID: number, frequency: ValueO

function updateSettlementAccount(workspaceAccountID: number, accountID: number) {
// TODO: remove this code when the API is ready
Onyx.merge(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`, {
Onyx.merge(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`, {
paymentBankAccountID: accountID,
});

// TODO: uncomment this code when the API is ready
// const optimisticData: OnyxUpdate[] = [
// {
// onyxMethod: Onyx.METHOD.MERGE,
// key: `${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// value: {
// paymentBankAccountID: accountID,
// },
Expand All @@ -277,7 +277,7 @@ function updateSettlementAccount(workspaceAccountID: number, accountID: number)
// const successData: OnyxUpdate[] = [
// {
// onyxMethod: Onyx.METHOD.MERGE,
// key: `${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// value: {
// paymentBankAccountID: accountID,
// },
Expand All @@ -287,7 +287,7 @@ function updateSettlementAccount(workspaceAccountID: number, accountID: number)
// const failureData: OnyxUpdate[] = [
// {
// onyxMethod: Onyx.METHOD.MERGE,
// key: `${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
// value: {
// paymentBankAccountID: null,
// },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ function CardReconciliationPage({policy, route}: CardReconciliationPageProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();

const [reconciliationConnection] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION}${policy?.workspaceAccountID}`);
const [isContinuousReconciliationOn] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION}${policy?.workspaceAccountID}`);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${policy?.workspaceAccountID}`);
const [reconciliationConnection] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION}${policy?.workspaceAccountID}`);
const [isContinuousReconciliationOn] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION}${policy?.workspaceAccountID}`);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${policy?.workspaceAccountID}`);
const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);

const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function ReconciliationAccountSettingsPage({route}: ReconciliationAccountSetting
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);

const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`);
const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? 0;

const selectedBankAccount = useMemo(() => bankAccountList?.[paymentBankAccountID.toString()], [paymentBankAccountID, bankAccountList]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function WorkspaceCardListHeader() {
const isLessThanMediumScreen = isMediumScreenWidth || isSmallScreenWidth;

// TODO: uncomment the code line below to use cardSettings data from Onyx when it's supported
// const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${policyID}`);
// const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`);
const cardSettings = mockedSettings;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function WorkspaceCardSettingsPage({route}: WorkspaceCardSettingsPageProps) {
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);

const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`);

const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? 0;
// const isMonthlySettlementAllowed = cardSettings?.isMonthlySettlementAllowed ?? true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function WorkspaceExpensifyCardPage({route}: WorkspaceExpensifyCardPageProps) {
const policyID = route.params.policyID ?? '-1';
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);

const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`);
const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? 0;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ function WorkspaceSettlementAccountPage({route}: WorkspaceSettlementAccountPageP
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);

const [bankAccountsList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`);
const [isUsedContinuousReconciliation] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION}${workspaceAccountID}`);
const [reconciliationConnection] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION}${workspaceAccountID}`);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`);
const [isUsedContinuousReconciliation] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION}${workspaceAccountID}`);
const [reconciliationConnection] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION}${workspaceAccountID}`);

const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? 0;
const paymentBankAccountNumber = bankAccountsList?.[paymentBankAccountID.toString()]?.accountData?.accountNumber ?? '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function WorkspaceSettlementFrequencyPage({route}: WorkspaceSettlementFrequencyP
const policyID = route.params?.policyID ?? '-1';
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);

const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`);

// TODO: change true for false after API is ready - true is for testing purposes
const shouldShowMonthlyOption = cardSettings?.isMonthlySettlementAllowed ?? true;
Expand Down

0 comments on commit 39545cd

Please sign in to comment.