-
Notifications
You must be signed in to change notification settings - Fork 3.2k
GBR and Settlement button for the receiver on the invoice report preview #41859
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 16 commits
665b508
22edb59
5e56c7f
1ea1fc3
8afc6fc
a4daf61
faaa568
1505652
a52e68d
bff509d
6c2b1a1
86f6fb2
524d640
e0ed718
6da0e8e
7ca70bf
97a41aa
cba930e
35da70f
e5e73cc
1003662
bb88d41
e600f02
9b7056f
54de5b5
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 |
---|---|---|
|
@@ -213,7 +213,7 @@ function ReportPreview({ | |
|
||
const shouldDisableApproveButton = shouldShowApproveButton && !ReportUtils.isAllowedToApproveExpenseReport(iouReport); | ||
|
||
const shouldShowSettlementButton = !ReportUtils.isInvoiceReport(iouReport) && (shouldShowPayButton || shouldShowApproveButton) && !showRTERViolationMessage; | ||
const shouldShowSettlementButton = (shouldShowPayButton || shouldShowApproveButton) && !showRTERViolationMessage; | ||
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. Here |
||
|
||
const shouldPromptUserToAddBankAccount = ReportUtils.hasMissingPaymentMethod(userWallet, iouReportID); | ||
const shouldShowRBR = !iouSettled && hasErrors; | ||
|
@@ -263,6 +263,17 @@ function ReportPreview({ | |
}; | ||
}, [formattedMerchant, formattedDescription, moneyRequestComment, translate, numberOfRequests, numberOfScanningReceipts, numberOfPendingRequests]); | ||
|
||
const confirmPayment = (paymentMethodType?: PaymentMethodType) => { | ||
if (!paymentMethodType || !chatReport || !iouReport) { | ||
return; | ||
} | ||
if (ReportUtils.isInvoiceReport(iouReport)) { | ||
IOU.payInvoice(paymentMethodType, chatReport, iouReport); | ||
} else { | ||
IOU.payMoneyRequest(paymentMethodType, chatReport, iouReport); | ||
} | ||
}; | ||
|
||
return ( | ||
<OfflineWithFeedback | ||
pendingAction={iouReport?.pendingFields?.preview} | ||
|
@@ -347,11 +358,12 @@ function ReportPreview({ | |
</View> | ||
{shouldShowSettlementButton && ( | ||
<SettlementButton | ||
formattedAmount={getDisplayAmount() ?? ''} | ||
currency={iouReport?.currency} | ||
policyID={policyID} | ||
chatReportID={chatReportID} | ||
iouReport={iouReport} | ||
onPress={(paymentType?: PaymentMethodType) => chatReport && iouReport && paymentType && IOU.payMoneyRequest(paymentType, chatReport, iouReport)} | ||
onPress={confirmPayment} | ||
enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS} | ||
addBankAccountRoute={bankAccountRoute} | ||
shouldHidePaymentOptions={!shouldShowPayButton} | ||
|
waterim marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -666,6 +666,9 @@ export default { | |
settledElsewhere: 'Pagado de otra forma', | ||
settleExpensify: ({formattedAmount}: SettleExpensifyCardParams) => (formattedAmount ? `Pagar ${formattedAmount} con Expensify` : `Pagar con Expensify`), | ||
payElsewhere: ({formattedAmount}: SettleExpensifyCardParams) => (formattedAmount ? `Pagar ${formattedAmount} de otra forma` : `Pagar de otra forma`), | ||
settlePersonal: ({formattedAmount}: SettleExpensifyCardParams) => (formattedAmount ? `Pay ${formattedAmount} as an individual` : `Pay as an individual`), | ||
settlePayment: ({formattedAmount}: SettleExpensifyCardParams) => `Pagar ${formattedAmount}`, | ||
settleBusiness: ({formattedAmount}: SettleExpensifyCardParams) => (formattedAmount ? `Pay ${formattedAmount} as a business` : `Pay as a business`), | ||
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. These need spanish translation. |
||
nextStep: 'Pasos Siguientes', | ||
finished: 'Finalizado', | ||
sendInvoice: ({amount}: RequestAmountParams) => `Enviar factura de ${amount}`, | ||
|
@@ -2495,6 +2498,14 @@ export default { | |
viewUnpaidInvoices: 'Ver facturas emitidas pendientes', | ||
sendInvoice: 'Enviar factura', | ||
sendFrom: 'Enviar desde', | ||
paymentMethods: { | ||
personal: 'Personal', | ||
business: 'Empresas', | ||
chooseInvoiceMethod: 'Elija un método de pago:', | ||
addBankAccount: 'Añadir cuenta bancaria', | ||
payingAsIndividual: 'Pago individual', | ||
payingAsBusiness: 'Pagar como una empresa', | ||
}, | ||
}, | ||
travel: { | ||
unlockConciergeBookingTravel: 'Desbloquea la reserva de viajes con Concierge', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; | ||
|
||
type PayInvoiceParams = { | ||
reportID: string; | ||
reportActionID: string; | ||
paymentMethodType: PaymentMethodType; | ||
}; | ||
|
||
export default PayInvoiceParams; |
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 forgot to block pay button when report is in draft state and report creator is the admin. See #54538 for more details.