Skip to content

Commit

Permalink
Merge pull request #55013 from cretadn22/hide-RBR-on-pending-card
Browse files Browse the repository at this point in the history
Hide RBR on pending card transaction
  • Loading branch information
AndrewGable authored Jan 17, 2025
2 parents 46b9e89 + cbf8335 commit 64ed6a5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libs/TransactionUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,10 @@ function isOnHoldByTransactionID(transactionID: string | undefined | null): bool
* Checks if any violations for the provided transaction are of type 'violation'
*/
function hasViolation(transactionID: string | undefined, transactionViolations: OnyxCollection<TransactionViolations>, showInReview?: boolean): boolean {
const transaction = getTransaction(transactionID);
if (isExpensifyCardTransaction(transaction) && isPending(transaction)) {
return false;
}
return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some(
(violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.VIOLATION && (showInReview === undefined || showInReview === (violation.showInReview ?? false)),
);
Expand All @@ -960,6 +964,10 @@ function hasViolation(transactionID: string | undefined, transactionViolations:
* Checks if any violations for the provided transaction are of type 'notice'
*/
function hasNoticeTypeViolation(transactionID: string | undefined, transactionViolations: OnyxCollection<TransactionViolation[]>, showInReview?: boolean): boolean {
const transaction = getTransaction(transactionID);
if (isExpensifyCardTransaction(transaction) && isPending(transaction)) {
return false;
}
return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some(
(violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.NOTICE && (showInReview === undefined || showInReview === (violation.showInReview ?? false)),
);
Expand All @@ -969,6 +977,10 @@ function hasNoticeTypeViolation(transactionID: string | undefined, transactionVi
* Checks if any violations for the provided transaction are of type 'warning'
*/
function hasWarningTypeViolation(transactionID: string | undefined, transactionViolations: OnyxCollection<TransactionViolation[]>, showInReview?: boolean): boolean {
const transaction = getTransaction(transactionID);
if (isExpensifyCardTransaction(transaction) && isPending(transaction)) {
return false;
}
const violations = transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID];
const warningTypeViolations =
violations?.filter(
Expand Down

0 comments on commit 64ed6a5

Please sign in to comment.