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

[NO QA][CardSettings] replace corporateCardList with cardList #25939

Merged
merged 8 commits into from
Aug 31, 2023
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
7 changes: 7 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,13 @@ const CONST = {
MENTION_ICON: 'mention-icon',
SMALL_NORMAL: 'small-normal',
},
EXPENSIFY_CARD: {
FRAUD_TYPES: {
DOMAIN: 'domain',
INDIVIDUAL: 'individal',
NONE: 'none',
},
},
AVATAR_ROW_SIZE: {
DEFAULT: 4,
LARGE_SCREEN: 8,
Expand Down
9 changes: 5 additions & 4 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ const ONYXKEYS = {
/** The user's bank accounts */
BANK_ACCOUNT_LIST: 'bankAccountList',

/** The user's credit cards (renamed from cardList) */
/** The user's payment and P2P cards */
FUND_LIST: 'fundList',

// The user's Expensify cards
CORPORATE_CARD_LIST: 'corporateCardList',
/** The user's cash card and imported cards (including the Expensify Card) */
CARD_LIST: 'cardList',

/** Stores information about the user's saved statements */
WALLET_STATEMENT: 'walletStatement',
Expand Down Expand Up @@ -341,7 +341,8 @@ type OnyxValues = {
[ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes.WalletAdditionalDetails;
[ONYXKEYS.WALLET_TERMS]: OnyxTypes.WalletTerms;
[ONYXKEYS.BANK_ACCOUNT_LIST]: Record<string, OnyxTypes.BankAccount>;
[ONYXKEYS.FUND_LIST]: Record<string, OnyxTypes.Card>;
[ONYXKEYS.FUND_LIST]: Record<string, OnyxTypes.Fund>;
[ONYXKEYS.CARD_LIST]: Record<string, OnyxTypes.Card>;
grgia marked this conversation as resolved.
Show resolved Hide resolved
[ONYXKEYS.WALLET_STATEMENT]: OnyxTypes.WalletStatement;
[ONYXKEYS.PERSONAL_BANK_ACCOUNT]: OnyxTypes.PersonalBankAccount;
[ONYXKEYS.REIMBURSEMENT_ACCOUNT]: OnyxTypes.ReimbursementAccount;
Expand Down
39 changes: 12 additions & 27 deletions src/types/onyx/Card.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
type AdditionalData = {
isBillingCard?: boolean;
isP2PDebitCard?: boolean;
};

type AccountData = {
additionalData?: AdditionalData;
addressName?: string;
addressState?: string;
addressStreet?: string;
addressZip?: number;
cardMonth?: number;

/** The masked credit card number */
cardNumber?: string;

cardYear?: number;
created?: string;
currency?: string;
fundID?: number;
};
import {ValueOf} from 'type-fest';
import CONST from '../../CONST';

type Card = {
flodnv marked this conversation as resolved.
Show resolved Hide resolved
accountData?: AccountData;
accountType?: string;
description?: string;
key?: string;
methodID?: number;
title?: string;
cardID: number;
state: number;
bank: string;
availableSpend: number;
domainName: string;
maskedPan: string;
isVirtual: boolean;
fraud: ValueOf<typeof CONST.EXPENSIFY_CARD.FRAUD_TYPES>;
cardholderFirstName: string;
cardholderLastName: string;
Comment on lines +13 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be optional, or always available?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now always available

};

export default Card;
32 changes: 32 additions & 0 deletions src/types/onyx/Fund.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
type AdditionalData = {
isBillingCard?: boolean;
isP2PDebitCard?: boolean;
};

type AccountData = {
additionalData?: AdditionalData;
addressName?: string;
addressState?: string;
addressStreet?: string;
addressZip?: number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too, I feel like most of these aren't optional...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't modify these , just moved what was in the old Card.ts file into Fund.ts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get that, but that's not really a good reason to not fix issues with code 😄

cardMonth?: number;

/** The masked credit card number */
cardNumber?: string;

cardYear?: number;
created?: string;
currency?: string;
fundID?: number;
};

type Fund = {
grgia marked this conversation as resolved.
Show resolved Hide resolved
accountData?: AccountData;
accountType?: string;
description?: string;
key?: string;
methodID?: number;
title?: string;
};

export default Fund;
2 changes: 2 additions & 0 deletions src/types/onyx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import WalletAdditionalDetails from './WalletAdditionalDetails';
import WalletTerms from './WalletTerms';
import BankAccount from './BankAccount';
import Card from './Card';
import Fund from './Fund';
grgia marked this conversation as resolved.
Show resolved Hide resolved
import WalletStatement from './WalletStatement';
import PersonalBankAccount from './PersonalBankAccount';
import FrequentlyUsedEmoji from './FrequentlyUsedEmoji';
Expand Down Expand Up @@ -70,6 +71,7 @@ export type {
WalletTerms,
BankAccount,
Card,
Fund,
WalletStatement,
PersonalBankAccount,
ReimbursementAccount,
Expand Down