-
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
[Internal QA] Add enable wallet state button if the submitter hasn't completed the kyc #29430
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
67077a8
added enable wallet state
techievivek d4a4d7b
added enable wallet state
techievivek c71eedf
Merge branch 'main' into techievivek_add_waiting_wallet_state
techievivek 56b0a7c
continue testing
techievivek 419c505
Merge remote-tracking branch 'origin/main' into techievivek_add_waiti…
MariaHCD be8a67d
Merge remote-tracking branch 'origin/main' into techievivek_add_waiti…
MariaHCD 8eb2447
DRY logic and check for silver wallet
MariaHCD 88e4ca4
Use the KYCWall
MariaHCD 02f96fa
Show correct messaging to payer
MariaHCD a4153eb
Rename translation prop
MariaHCD 9b863ab
Default value for userWallet
MariaHCD c00f14a
show enable wallet button
techievivek 9eb037b
fix the console error
techievivek 3fdc0df
add everything in fragment
techievivek 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
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
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 |
---|---|---|
|
@@ -70,6 +70,10 @@ import themeColors from '../../../styles/themes/default'; | |
import ReportActionItemBasicMessage from './ReportActionItemBasicMessage'; | ||
import RenderHTML from '../../../components/RenderHTML'; | ||
import ReportAttachmentsContext from './ReportAttachmentsContext'; | ||
import ROUTES from '../../../ROUTES'; | ||
import Navigation from '../../../libs/Navigation/Navigation'; | ||
import KYCWall from '../../../components/KYCWall'; | ||
import userWalletPropTypes from '../../EnablePayments/userWalletPropTypes'; | ||
|
||
const propTypes = { | ||
...windowDimensionsPropTypes, | ||
|
@@ -114,6 +118,9 @@ const propTypes = { | |
|
||
/** Flag to show, hide the thread divider line */ | ||
shouldHideThreadDividerLine: PropTypes.bool, | ||
|
||
/** The user's wallet account */ | ||
userWallet: userWalletPropTypes, | ||
}; | ||
|
||
const defaultProps = { | ||
|
@@ -125,6 +132,7 @@ const defaultProps = { | |
hasOutstandingIOU: false, | ||
iouReport: undefined, | ||
shouldHideThreadDividerLine: false, | ||
userWallet: {}, | ||
}; | ||
|
||
function ReportActionItem(props) { | ||
|
@@ -345,20 +353,50 @@ function ReportActionItem(props) { | |
); | ||
} else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTQUEUED) { | ||
const submitterDisplayName = PersonalDetailsUtils.getDisplayNameOrDefault(props.personalDetailsList, [props.report.ownerAccountID, 'displayName'], props.report.ownerEmail); | ||
const shouldShowAddCreditBankAccountButton = | ||
ReportUtils.isCurrentUserSubmitter(props.report.reportID) && !store.hasCreditBankAccount() && !ReportUtils.isSettled(props.report.reportID); | ||
const paymentType = lodashGet(props.action, 'originalMessage.paymentType', ''); | ||
|
||
const isSubmitterOfUnsettledReport = ReportUtils.isCurrentUserSubmitter(props.report.reportID) && !ReportUtils.isSettled(props.report.reportID); | ||
const shouldShowAddCreditBankAccountButton = isSubmitterOfUnsettledReport && !store.hasCreditBankAccount() && paymentType !== CONST.IOU.PAYMENT_TYPE.EXPENSIFY; | ||
const shouldShowEnableWalletButton = | ||
isSubmitterOfUnsettledReport && | ||
(_.isEmpty(props.userWallet) || props.userWallet.tierName === CONST.WALLET.TIER_NAME.SILVER) && | ||
paymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY; | ||
|
||
children = ( | ||
<ReportActionItemBasicMessage message={props.translate('iou.waitingOnBankAccount', {submitterDisplayName})}> | ||
{shouldShowAddCreditBankAccountButton ? ( | ||
<Button | ||
success | ||
style={[styles.w100, styles.requestPreviewBox]} | ||
text={props.translate('bankAccount.addBankAccount')} | ||
onPress={() => BankAccounts.openPersonalBankAccountSetupView(props.report.reportID)} | ||
pressOnEnter | ||
/> | ||
) : null} | ||
<ReportActionItemBasicMessage | ||
message={props.translate(paymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY ? 'iou.waitingOnEnabledWallet' : 'iou.waitingOnBankAccount', {submitterDisplayName})} | ||
> | ||
<> | ||
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. This fragment should wrap both elements, the button and the |
||
{shouldShowAddCreditBankAccountButton && ( | ||
<Button | ||
success | ||
style={[styles.w100, styles.requestPreviewBox]} | ||
text={props.translate('bankAccount.addBankAccount')} | ||
onPress={() => BankAccounts.openPersonalBankAccountSetupView(props.report.reportID)} | ||
pressOnEnter | ||
/> | ||
)} | ||
{shouldShowEnableWalletButton && ( | ||
<KYCWall | ||
onSuccessfulKYC={() => Navigation.navigate(ROUTES.ENABLE_PAYMENTS)} | ||
enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS} | ||
addBankAccountRoute={ROUTES.BANK_ACCOUNT_PERSONAL} | ||
addDebitCardRoute={ROUTES.SETTINGS_ADD_DEBIT_CARD} | ||
chatReportID={props.report.reportID} | ||
iouReport={props.iouReport} | ||
> | ||
{(triggerKYCFlow, buttonRef) => ( | ||
<Button | ||
ref={buttonRef} | ||
success | ||
style={[styles.w100, styles.requestPreviewBox]} | ||
text={props.translate('iou.enableWallet')} | ||
onPress={triggerKYCFlow} | ||
/> | ||
)} | ||
</KYCWall> | ||
)} | ||
</> | ||
</ReportActionItemBasicMessage> | ||
); | ||
} else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.MODIFIEDEXPENSE) { | ||
|
@@ -702,6 +740,9 @@ export default compose( | |
key: ({action}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${action.reportActionID}`, | ||
initialValue: {}, | ||
}, | ||
userWallet: { | ||
key: ONYXKEYS.USER_WALLET, | ||
}, | ||
}), | ||
)( | ||
memo( | ||
|
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.
@techievivek this should be
Inició
orinició
, can you submit a PR to update please?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.
@cead22 Added here: #30335