-
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
Changes from 12 commits
67077a8
d4a4d7b
c71eedf
56b0a7c
419c505
be8a67d
8eb2447
88e4ca4
02f96fa
a4153eb
9b863ab
c00f14a
9eb037b
3fdc0df
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 |
---|---|---|
|
@@ -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,48 @@ 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 ? ( | ||
<ReportActionItemBasicMessage | ||
message={props.translate(paymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY ? 'iou.waitingOnEnabledWallet' : 'iou.waitingOnBankAccount', {submitterDisplayName})} | ||
> | ||
{shouldShowAddCreditBankAccountButton && ( | ||
techievivek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Button | ||
success | ||
style={[styles.w100, styles.requestPreviewBox]} | ||
text={props.translate('bankAccount.addBankAccount')} | ||
onPress={() => BankAccounts.openPersonalBankAccountSetupView(props.report.reportID)} | ||
pressOnEnter | ||
/> | ||
) : null} | ||
)} | ||
{shouldShowEnableWalletButton && ( | ||
<KYCWall | ||
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. I believe there may be a console error due to using KYCWall in 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. 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. Testing it, thanks. 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. That worked 🎉, but I am curious to learn how it fixed that error? Because there is just a single element right? 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. As 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. Interesting, but by just wrapping the KycWall in a fragment it looks like the error is gone, how does that work? Any idea? 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. Ah no, the user is alreadt on the gold wallet that's why this condition is not being called. 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. The error is still there. What you explained make sense now. Thanks 👍 |
||
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> | ||
)} | ||
techievivek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</ReportActionItemBasicMessage> | ||
); | ||
} else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.MODIFIEDEXPENSE) { | ||
|
@@ -702,6 +738,9 @@ export default compose( | |
key: ({action}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${action.reportActionID}`, | ||
initialValue: {}, | ||
}, | ||
userWallet: { | ||
key: ONYXKEYS.USER_WALLET, | ||
}, | ||
}), | ||
)( | ||
memo( | ||
|
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