-
Notifications
You must be signed in to change notification settings - Fork 3k
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
GBR and Settlement button for the receiver on the invoice report preview #41859
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
665b508
updated settlement button, added invoice payment
waterim 22edb59
remove unused activeUserID
waterim 5e56c7f
fixed payments and ts issues
waterim 1ea1fc3
remove unused canIOUbePaid part, remove unused useState
waterim 8afc6fc
added translations
waterim a4daf61
Merge remote-tracking branch 'upstream/main' into feat-40437-invoice
waterim faaa568
update params in payInvoice
waterim 1505652
remove PERSONAL & BUSINESS payment types
waterim a52e68d
update isSettled
waterim bff509d
Merge remote-tracking branch 'upstream/main' into feat-40437-invoice
waterim 6c2b1a1
new view of the settlement button
waterim 86f6fb2
fix modal, show amount, update text
waterim 524d640
update hover, remove business button
waterim e0ed718
Revert "draft fix"
waterim 6da0e8e
Revert "Revert "draft fix""
waterim 7ca70bf
update wallet for invoiceReport
waterim 97a41aa
stylings change
waterim cba930e
updated stylings
waterim 35da70f
fixed focus
waterim e5e73cc
translations
waterim 1003662
Merge branch 'main' into feat-40437-invoice
VickyStash bb88d41
Update back title inside the submenu
VickyStash e600f02
Merge branch 'main' into feat-40437-invoice
VickyStash 9b7056f
Minor UI fix
VickyStash 54de5b5
Merge branch 'main' into feat-40437-invoice
VickyStash 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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 |
---|---|---|
|
@@ -227,7 +227,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; | ||
|
@@ -280,6 +280,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} | ||
|
@@ -364,11 +375,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} | ||
|
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
waterim marked this conversation as resolved.
Show resolved
Hide resolved
|
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; | ||
|
||
type PayInvoiceParams = { | ||
reportID: string; | ||
reportActionID: string; | ||
paymentMethodType: PaymentMethodType; | ||
}; | ||
|
||
export default PayInvoiceParams; |
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
Oops, something went wrong.
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.
We forgot to block pay button when report is in draft state and report creator is the admin. See #54538 for more details.