Skip to content

Commit

Permalink
Merge pull request #27484 from Expensify/cmartins-createGetDomainCards
Browse files Browse the repository at this point in the history
Create getDomainCards
  • Loading branch information
marcochavezf authored Sep 18, 2023
2 parents 2ee4f91 + b9aa5ab commit ee26eaf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@ const CONST = {
SMALL_NORMAL: 'small-normal',
},
EXPENSIFY_CARD: {
BANK: 'Expensify Card',
FRAUD_TYPES: {
DOMAIN: 'domain',
INDIVIDUAL: 'individal',
Expand Down
12 changes: 11 additions & 1 deletion src/libs/CardUtils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import {Card} from '../types/onyx';
import CONST from '../CONST';

/**
* @returns string with a month in MM format
*/
Expand All @@ -15,4 +18,11 @@ function getYearFromExpirationDateString(expirationDateString: string) {
return cardYear.length === 2 ? `20${cardYear}` : cardYear;
}

export {getMonthFromExpirationDateString, getYearFromExpirationDateString};
function getCompanyCards(cardList: {string: Card}) {
if (!cardList) {
return [];
}
return Object.values(cardList).filter((card) => card.bank !== CONST.EXPENSIFY_CARD.BANK);
}

export {getMonthFromExpirationDateString, getYearFromExpirationDateString, getCompanyCards};

0 comments on commit ee26eaf

Please sign in to comment.