-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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/44305 be integration configure expensify cards for policy #46564
Changes from all commits
1a19a65
3abc929
8cc9256
ed8ac0c
c822a00
1e51c2a
e2b5d8e
91f4dfc
03a18c7
abfb9cf
8c040fb
3eec68c
bd89ae2
e883b68
cb8a142
c4bf48d
8c66efd
4620f69
a3c40c6
784f1f2
ee65625
b76ab11
39545cd
c25fba0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type ConfigureExpensifyCardsForPolicyParams = { | ||
policyID: string; | ||
bankAccountID: number; | ||
}; | ||
|
||
export default ConfigureExpensifyCardsForPolicyParams; |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -26,12 +26,12 @@ function CardReconciliationPage({policy, route}: CardReconciliationPageProps) { | |||||||||||||||||||||||||||||||||||||
const styles = useThemeStyles(); | ||||||||||||||||||||||||||||||||||||||
const {translate} = useLocalize(); | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
const [reconciliationConnection] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION}${policy?.id}`); | ||||||||||||||||||||||||||||||||||||||
const [isContinuousReconciliationOn] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION}${policy?.id}`); | ||||||||||||||||||||||||||||||||||||||
const [reconciliationConnection] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION}${policy?.workspaceAccountID}`); | ||||||||||||||||||||||||||||||||||||||
const [isContinuousReconciliationOn] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_USE_CONTINUOUS_RECONCILIATION}${policy?.workspaceAccountID}`); | ||||||||||||||||||||||||||||||||||||||
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${policy?.workspaceAccountID}`); | ||||||||||||||||||||||||||||||||||||||
const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); | ||||||||||||||||||||||||||||||||||||||
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_EXPENSIFY_CARD_SETTINGS}${policy?.id}`); | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? -1; | ||||||||||||||||||||||||||||||||||||||
const paymentBankAccountID = cardSettings?.paymentBankAccountID ?? 0; | ||||||||||||||||||||||||||||||||||||||
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. Why do we need to change this line? 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. yes, it caused some problems in another place, we want the value falsy (-1 is truthy) 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. @koko57 Could you detail which problem is in other places? Because we have a below rule App/contributingGuides/STYLE.md Lines 474 to 490 in 9812479
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. but here you have a string, I wonder why we need to change it here as we have a number. And as I said - it caused a problem here #45901 (comment) 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. 1. The current place (in this PR)
If we use 0 as a fallback value for --> It mean that we always use My suggestion:
--> It mean that if 2. Your case that you mentioned hereWhy do we need a fallback value in this case?
My suggestion: : We don't need fallback value
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. @DylanDylann what is the difference here? bankAccountList?.[0] vs bankAccountList?.[-1]? bankAccountList is an object |
||||||||||||||||||||||||||||||||||||||
const bankAccountTitle = bankAccountList?.[paymentBankAccountID]?.title ?? ''; | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
const policyID = policy?.id ?? '-1'; | ||||||||||||||||||||||||||||||||||||||
|
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.
@koko57 I am curious about the difference between
policyID
andworkspaceAccountID
. Could you help to explain this?cc @mountiny
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.
we use workspaceAccountID instead of policyID for the expensifyCard identifier
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.
@koko57 Are these two IDs the same or different? We're using a different key (workspaceAccountID), but the value remains the same, correct?
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.
I'm asking this because I noticed that in the functions updateExpensifyCardLimit and updateSettlementFrequency, we define workspaceAccountID, but when calling these functions, we pass policyID.
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.
@DylanDylann They should pass workspaceAccountID, I should have corrected them too - I can do it in this PR or I will do it while integrating with the BE. workspaceAccountID and policyID have different values
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.
They are different IDs and are used for different concepts in the backend.
It's a bit complicated, and it's built like that for historical reasons, but the card functionality is tied to "domain." A domain is a row in the accounts table (the same as using an account when they sign up). The domain accounts are specific given the email format they use.
Now to have an expensify card in oldDot you need to have a verified domain (like expensify.com). We are changing that for the workspace feeds, but we still create this fake account in the database that is 1:1 tied to the policy. The workpaceAccountID is the accountID of this "fake" domain account. policyID is just an ID of the policy