-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Use Paid language in requests instead of settled and other manual requests polish #19817
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
Changes from all commits
b813311
4dfc645
b70b0d0
8819441
2c72ea4
2474fc8
fae14d5
f1b50bd
3d45e55
9f2736d
06fdad4
aabcbad
73fccc9
b8cb05c
220cdbe
eba644a
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 |
|---|---|---|
|
|
@@ -89,6 +89,7 @@ const MoneyRequestHeader = (props) => { | |
| Policy.isAdminOfFreePolicy([policy]) || (ReportUtils.isMoneyRequestReport(moneyRequestReport) && lodashGet(props.session, 'email', null) === moneyRequestReport.managerEmail); | ||
| const shouldShowSettlementButton = !isSettled && !props.isSingleTransactionView && isPayer; | ||
| const bankAccountRoute = ReportUtils.getBankAccountRoute(props.chatReport); | ||
| const shouldShowPaypal = Boolean(lodashGet(props.personalDetails, [moneyRequestReport.managerEmail, 'payPalMeAddress'])); | ||
| return ( | ||
| <View style={[{backgroundColor: themeColors.highlightBG}, styles.pl0]}> | ||
| <HeaderWithCloseButton | ||
|
|
@@ -153,7 +154,7 @@ const MoneyRequestHeader = (props) => { | |
| <SettlementButton | ||
| currency={props.report.currency} | ||
| policyID={props.report.policyID} | ||
| shouldShowPaypal={Boolean(lodashGet(props.personalDetails, [moneyRequestReport.managerEmail, 'payPalMeAddress']))} | ||
| shouldShowPaypal={shouldShowPaypal} | ||
| chatReportID={props.chatReport.reportID} | ||
| iouReport={props.report} | ||
| onPress={(paymentType) => IOU.payMoneyRequest(paymentType, props.chatReport, props.report)} | ||
|
|
@@ -169,7 +170,7 @@ const MoneyRequestHeader = (props) => { | |
| <SettlementButton | ||
| currency={props.report.currency} | ||
| policyID={props.report.policyID} | ||
| shouldShowPaypal={false} | ||
| shouldShowPaypal={shouldShowPaypal} | ||
|
Contributor
Author
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 was most likely an oversight, this is same button just on mobile or web so not sure why the logic for showing paypal should be different in each |
||
| chatReportID={props.report.chatReportID} | ||
| iouReport={props.report} | ||
| onPress={(paymentType) => IOU.payMoneyRequest(paymentType, props.chatReport, props.report)} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,29 +76,67 @@ class SettlementButton extends React.Component { | |
|
|
||
|
Contributor
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. Isn't this component too big for a button? Should we split it into smaller components based on the use case?
Contributor
Author
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. Thats a good point, I think we can however keep that consideration for its separate PR, this is addressing numerous bugs in the manual requests flow already so lets get it out |
||
| getButtonOptionsFromProps() { | ||
| const buttonOptions = []; | ||
| const isExpenseReport = ReportUtils.isExpenseReport(this.props.iouReport); | ||
| const paymentMethods = { | ||
| [CONST.IOU.PAYMENT_TYPE.EXPENSIFY]: { | ||
| text: this.props.translate('iou.settleExpensify'), | ||
| icon: Expensicons.Wallet, | ||
| value: ReportUtils.isExpenseReport(this.props.iouReport) ? CONST.IOU.PAYMENT_TYPE.VBBA : CONST.IOU.PAYMENT_TYPE.EXPENSIFY, | ||
| value: CONST.IOU.PAYMENT_TYPE.EXPENSIFY, | ||
| }, | ||
| [CONST.IOU.PAYMENT_TYPE.VBBA]: { | ||
| text: this.props.translate('iou.settleExpensify'), | ||
| icon: Expensicons.Wallet, | ||
| value: CONST.IOU.PAYMENT_TYPE.VBBA, | ||
|
Julesssss marked this conversation as resolved.
|
||
| }, | ||
| [CONST.IOU.PAYMENT_TYPE.PAYPAL_ME]: { | ||
| text: this.props.translate('iou.settlePaypalMe'), | ||
| icon: Expensicons.PayPal, | ||
| value: CONST.IOU.PAYMENT_TYPE.PAYPAL_ME, | ||
| }, | ||
| [CONST.IOU.PAYMENT_TYPE.ELSEWHERE]: { | ||
| text: this.props.translate('iou.settleElsewhere'), | ||
| text: isExpenseReport ? this.props.translate('iou.payExpenseElsewhere') : this.props.translate('iou.settleElsewhere'), | ||
|
Contributor
Author
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 expense report should use different text |
||
| icon: Expensicons.Cash, | ||
| value: CONST.IOU.PAYMENT_TYPE.ELSEWHERE, | ||
| }, | ||
| }; | ||
| if (!this.props.shouldShowPaymentOptions && this.props.nvp_lastPaymentMethod[this.props.policyID]) { | ||
| return [paymentMethods[this.props.nvp_lastPaymentMethod[this.props.policyID]]]; | ||
| const canUseWallet = | ||
| !isExpenseReport && this.props.currency === CONST.CURRENCY.USD && Permissions.canUsePayWithExpensify(this.props.betas) && Permissions.canUseWallet(this.props.betas); | ||
|
|
||
| // To achieve the one tap pay experience we need to choose the correct payment type as default, | ||
| // if user already paid for some request or expense, let's use the last payment method or use default. | ||
| if (!this.props.shouldShowPaymentOptions) { | ||
| let paymentMethod = this.props.nvp_lastPaymentMethod[this.props.policyID]; | ||
| if (!paymentMethod) { | ||
| // In case the user hasn't paid a request yet, let's default to VBBA payment type in case of expense reports | ||
| if (isExpenseReport) { | ||
| paymentMethod = CONST.IOU.PAYMENT_TYPE.VBBA; | ||
| } else if (canUseWallet) { | ||
| // If they have Wallet set up, use that payment method as default | ||
| paymentMethod = CONST.IOU.PAYMENT_TYPE.EXPENSIFY; | ||
| } else { | ||
| paymentMethod = CONST.IOU.PAYMENT_TYPE.ELSEWHERE; | ||
| } | ||
| } | ||
|
|
||
| // In case the last payment method has been PayPal, but this request is made in currency unsupported by Paypal, default to Elsewhere | ||
| if (paymentMethod === CONST.IOU.PAYMENT_TYPE.PAYPAL_ME && !_.includes(CONST.PAYPAL_SUPPORTED_CURRENCIES, this.props.currency)) { | ||
| paymentMethod = CONST.IOU.PAYMENT_TYPE.ELSEWHERE; | ||
| } | ||
|
|
||
| // In case of the settlement button in the report preview component, we do not show payment options and the label for Wallet and ACH type is simply "Pay". | ||
| return [ | ||
| { | ||
| ...paymentMethods[paymentMethod], | ||
| text: paymentMethod === CONST.IOU.PAYMENT_TYPE.ELSEWHERE ? this.props.translate('iou.payExpenseElsewhere') : this.props.translate('iou.pay'), | ||
| }, | ||
| ]; | ||
| } | ||
| if (this.props.currency === CONST.CURRENCY.USD && Permissions.canUsePayWithExpensify(this.props.betas) && Permissions.canUseWallet(this.props.betas)) { | ||
| if (canUseWallet) { | ||
| buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.EXPENSIFY]); | ||
| } | ||
| if (isExpenseReport) { | ||
| buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.VBBA]); | ||
| } | ||
| if (this.props.shouldShowPaypal && _.includes(CONST.PAYPAL_SUPPORTED_CURRENCIES, this.props.currency)) { | ||
| buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.PAYPAL_ME]); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -975,7 +975,7 @@ function getMoneyRequestReportName(report) { | |
| const formattedAmount = CurrencyUtils.convertToDisplayString(getMoneyRequestTotal(report), report.currency); | ||
| const payerName = isExpenseReport(report) ? getPolicyName(report) : getDisplayNameForParticipant(report.managerEmail); | ||
|
|
||
| return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount}); | ||
| return Localize.translateLocal(report.hasOutstandingIOU ? 'iou.payerOwesAmount' : 'iou.payerPaidAmount', {payer: payerName, amount: formattedAmount}); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -1254,9 +1254,6 @@ function getIOUReportActionMessage(type, total, comment, currency, paymentType = | |
| const amount = NumberFormatUtils.format(preferredLocale, total / 100, {style: 'currency', currency}); | ||
| let paymentMethodMessage; | ||
| switch (paymentType) { | ||
| case CONST.IOU.PAYMENT_TYPE.EXPENSIFY: | ||
| paymentMethodMessage = '!'; | ||
| break; | ||
| case CONST.IOU.PAYMENT_TYPE.ELSEWHERE: | ||
| paymentMethodMessage = ' elsewhere'; | ||
| break; | ||
|
|
@@ -1279,7 +1276,7 @@ function getIOUReportActionMessage(type, total, comment, currency, paymentType = | |
| iouMessage = `deleted the ${amount} request${comment && ` for ${comment}`}`; | ||
| break; | ||
| case CONST.IOU.REPORT_ACTION_TYPE.PAY: | ||
| iouMessage = isSettlingUp ? `settled up ${amount}${paymentMethodMessage}` : `sent ${amount}${comment && ` for ${comment}`}${paymentMethodMessage}`; | ||
| iouMessage = isSettlingUp ? `paid ${amount}${paymentMethodMessage}` : `sent ${amount}${comment && ` for ${comment}`}${paymentMethodMessage}`; | ||
|
mountiny marked this conversation as resolved.
|
||
| break; | ||
| default: | ||
| break; | ||
|
|
@@ -2010,8 +2007,8 @@ function canRequestMoney(report) { | |
| * @returns {Array} | ||
| */ | ||
| function getMoneyRequestOptions(report, reportParticipants, betas) { | ||
| // In the transaction thread, we do not allow any new money requests | ||
| if (ReportActionsUtils.isTransactionThread(ReportActionsUtils.getParentReportAction(report))) { | ||
| // In any thread, we do not allow any new money requests yet | ||
| if (isThread(report)) { | ||
|
Contributor
Author
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. currently we dont handle creating requests in threads gracefully so lets prevent this option for now |
||
| return []; | ||
| } | ||
|
|
||
|
|
||
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.
There is no reason why we should not show options in the global send money flow