-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: Added Condition for restricting pending txns #2789
Merged
Merged
Changes from 9 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
59f7a7b
feat: Method Changes in expense service
howdysuraj dd97215
feat Added check for pending txns
howdysuraj cffa7c1
feat: removed unwanted variable
howdysuraj 9c194b4
feat: function name changed
howdysuraj 50e2985
reverted function name change
howdysuraj d0426cb
Merge branch 'master' of https://github.com/fylein/fyle-mobile-app in…
howdysuraj d320b6b
feat: Added function feature
howdysuraj 1d3a2d5
feat: added test
howdysuraj 5ec31c0
fdescrbe removed
howdysuraj 032c06b
feat: removed add expense button which is not working from day zero
howdysuraj b34a454
Merge branch 'master' of https://github.com/fylein/fyle-mobile-app in…
howdysuraj 7acaa38
feat: changed function name
howdysuraj 03d4565
feat: test and function update
howdysuraj d87c098
Merge branch 'master' of https://github.com/fylein/fyle-mobile-app in…
howdysuraj 7c6284e
feta: test case updated
howdysuraj 1dd0ef2
feat: Added API call
howdysuraj affa3b6
feat: added transactions and fixed tests
howdysuraj a016ebf
fix: filtering of expenses list
howdysuraj 067e8d8
query param fix
howdysuraj be863c3
feat: syncronous behaviour chnages
howdysuraj 2e0eb94
feat :test chages
howdysuraj 39a55c5
feat: All converted to describe
howdysuraj b9dba32
test: disabled a flaky test
howdysuraj 5d8936b
Merge branch 'master' of https://github.com/fylein/fyle-mobile-app in…
howdysuraj c58e82c
test: fix for apiexpenses
howdysuraj 594d93c
test fix
howdysuraj 0fe2bc6
fix for messaging in toast
howdysuraj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,11 @@ import { DateService } from '../../../date.service'; | |
export class ExpensesService { | ||
constructor(private dateService: DateService) {} | ||
|
||
//TODO : ADD CONDITION BASED ON ORG SETTING | ||
restrictPendingTransactionsEnabled(): boolean { | ||
return false; | ||
} | ||
|
||
isExpenseInDraft(expense: Expense): boolean { | ||
return expense.state && expense.state === ExpenseState.DRAFT; | ||
} | ||
|
@@ -27,6 +32,15 @@ export class ExpensesService { | |
return typeof expense.policy_amount === 'number' && expense.policy_amount < 0.0001; | ||
} | ||
|
||
isExpenseInPendingState(expense: Expense): boolean { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesExpenseHavePendingCardTransaction |
||
return ( | ||
expense.state && | ||
expense.state === ExpenseState.COMPLETE && | ||
expense.matched_corporate_card_transactions?.length && | ||
expense.matched_corporate_card_transactions[0]?.status === 'PENDING' | ||
); | ||
} | ||
|
||
excludeCCCExpenses(expenses: Expense[]): Expense[] { | ||
return expenses.filter((expense) => expense.matched_corporate_card_transaction_ids?.length === 0); | ||
} | ||
|
@@ -104,9 +118,19 @@ export class ExpensesService { | |
} | ||
|
||
getReportableExpenses(expenses: Expense[]): Expense[] { | ||
return expenses.filter( | ||
(expense) => !this.isCriticalPolicyViolatedExpense(expense) && !this.isExpenseInDraft(expense) && expense.id | ||
); | ||
if (this.restrictPendingTransactionsEnabled()) { | ||
return expenses.filter( | ||
(expense) => | ||
!this.isCriticalPolicyViolatedExpense(expense) && | ||
!this.isExpenseInDraft(expense) && | ||
expense.id && | ||
!this.isExpenseInPendingState(expense) | ||
); | ||
} else { | ||
return expenses.filter( | ||
(expense) => !this.isCriticalPolicyViolatedExpense(expense) && !this.isExpenseInDraft(expense) && expense.id | ||
); | ||
} | ||
} | ||
|
||
isMergeAllowed(expenses: Expense[]): boolean { | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets not merge these PRs till we get the org settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, thanks