-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add prohibited expense feature #56550
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
Merged
Merged
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
ce32a0e
Add alcohol and hotel incidentals as prohibited expenses
AndrewGable 1745cf3
Fix type errors and add API commands
AndrewGable eab99cf
Update switch on name
AndrewGable 3566d1a
Add spanish
AndrewGable cbe5404
Add more types
AndrewGable caddee5
Fixing more lint
AndrewGable a1bc562
Add api types
AndrewGable ba86262
Fix more lint
AndrewGable 6b7d9c5
Merge branch 'main' into smarterscan
AndrewGable 6bb05f8
Remove duplicate row
AndrewGable e04647b
Fix string bug
AndrewGable 3c6c4fd
Remove unused variable
AndrewGable f90daf6
Add ;
AndrewGable a90247d
Change submodule
AndrewGable 38fd924
Tweak casing of items
AndrewGable 528609b
Alphabatize all items
AndrewGable 33a8ba3
JSON stringify the response sent to API
AndrewGable 7f16d2a
Fix stringify
AndrewGable 9329f47
Tweak strings one more time
AndrewGable aa1d95c
Translation and const
johnmlee101 cb78304
Last changes
johnmlee101 50f361e
Prettier
johnmlee101 99d87c8
Add en espanol
johnmlee101 bdda7a6
add fake toggle
dangrous 6eb81b8
Revert "add fake toggle"
dangrous 1c3049c
add receiptLineItems beta
dangrous 67d67fd
put prohibitedExpense setup behind the beta
dangrous 20b1b3e
revert to original value if error
dangrous 8ad3095
Merge branch 'main' into smarterscan
dangrous 39cdd2f
prettier
dangrous ebc1bee
fix type errors
dangrous 94dd8d9
merge conflicts
dangrous 3677d8f
merge conflicts
dangrous 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 hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
|
@@ -193,6 +193,7 @@ import type { | |
ViolationsOverCategoryLimitParams, | ||
ViolationsOverLimitParams, | ||
ViolationsPerDayLimitParams, | ||
ViolationsProhibitedExpenseParams, | ||
ViolationsReceiptRequiredParams, | ||
ViolationsRterParams, | ||
ViolationsTagOutOfPolicyParams, | ||
|
@@ -4647,6 +4648,15 @@ const translations = { | |
eReceipts: 'eReceipts', | ||
eReceiptsHint: 'eReceipts are auto-created', | ||
eReceiptsHintLink: 'for most USD credit transactions', | ||
prohibitedDefaultDescription: | ||
'Flag any receipts where alcohol, gambling, or other restricted items appear. Expenses with receipts where these line items appear will require manual review.', | ||
prohibitedExpenses: 'Prohibited expenses', | ||
none: 'None', | ||
alcohol: 'Alcohol', | ||
hotelIncidentals: 'Hotel incidentals', | ||
gambling: 'Gambling', | ||
tobacco: 'Tobacco', | ||
adultEntertainment: 'Adult entertainment', | ||
}, | ||
expenseReportRules: { | ||
examples: 'Examples:', | ||
|
@@ -5362,6 +5372,23 @@ const translations = { | |
} | ||
return message; | ||
}, | ||
prohibitedExpense: ({prohibitedExpenseType}: ViolationsProhibitedExpenseParams) => { | ||
const preMessage = 'Prohibited Expense: '; | ||
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. Hi!, coming from #60216 (BugZero Checklist), the copy has capitalization errors. |
||
switch (prohibitedExpenseType) { | ||
case 'alcohol': | ||
return `${preMessage} Alcohol`; | ||
case 'gambling': | ||
return `${preMessage} Gambling`; | ||
case 'tobacco': | ||
return `${preMessage} Tobacco`; | ||
case 'adultEntertainment': | ||
return `${preMessage} Adult Entertainment`; | ||
case 'hotelIncidentals': | ||
return `${preMessage} Hotel Incidentals`; | ||
default: | ||
return `${preMessage}${prohibitedExpenseType}`; | ||
} | ||
}, | ||
customRules: ({message}: ViolationsCustomRulesParams) => message, | ||
reviewRequired: 'Review required', | ||
rter: ({brokenBankConnection, email, isAdmin, isTransactionOlderThan7Days, member, rterType}: ViolationsRterParams) => { | ||
|
This file contains hidden or 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
This file contains hidden or 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
11 changes: 11 additions & 0 deletions
11
src/libs/API/parameters/SetPolicyProhibitedExpensesParams.ts
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type SetPolicyProhibitedExpensesParams = { | ||
policyID: string; | ||
/** | ||
* A JSON string representing the prohibited expenses | ||
* | ||
* e.g. {'alcohol': true, 'gambling': true, 'hotelIncidentals': true, 'tobacco': true} | ||
*/ | ||
prohibitedExpenses: string; | ||
}; | ||
|
||
export default SetPolicyProhibitedExpensesParams; |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
on the backend we're doing
drugsAndTobacco
but could change it.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.
(update - i just updated the BE to be just tobacco)