-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Allow setting merchant for split bill #30721
Changes from all commits
c9ef34f
ce57363
41991a4
9d58a0b
1d349a2
0667951
1466ce7
c6aea99
8b91ea7
b72d665
b03d7fb
88e6d92
d39fc86
e40b8c2
7772411
d2bc873
54330f0
4dd99d7
a82e6fc
ac6ef28
b892430
2a86eaf
b716519
83e74bf
6526dda
283dc3e
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 |
---|---|---|
|
@@ -1131,14 +1131,14 @@ function requestMoney( | |
* @param {Number} amount - always in the smallest unit of the currency | ||
* @param {String} comment | ||
* @param {String} currency | ||
* @param {String} merchant | ||
* @param {String} category | ||
* @param {String} tag | ||
* @param {String} existingSplitChatReportID - the report ID where the split bill happens, could be a group chat or a workspace chat | ||
* @param {String} merchant | ||
* | ||
* @return {Object} | ||
*/ | ||
function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, tag, existingSplitChatReportID = '', merchant) { | ||
function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, existingSplitChatReportID = '') { | ||
youssef-lr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const currentUserEmailForIOUSplit = OptionsListUtils.addSMSDomainIfPhoneNumber(currentUserLogin); | ||
const participantAccountIDs = _.map(participants, (participant) => Number(participant.accountID)); | ||
const existingSplitChatReport = | ||
|
@@ -1156,7 +1156,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco | |
'', | ||
'', | ||
'', | ||
merchant, | ||
merchant || Localize.translateLocal('iou.request'), | ||
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 causes regression when user language is Spanish and merchant is not set Screen.Recording.2023-12-25.at.4.37.27.AM.movThere 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. It's okay, we're going to deprecate the
|
||
undefined, | ||
undefined, | ||
undefined, | ||
|
@@ -1357,7 +1357,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco | |
'', | ||
CONST.IOU.TYPE.SPLIT, | ||
splitTransaction.transactionID, | ||
merchant, | ||
merchant || Localize.translateLocal('iou.request'), | ||
undefined, | ||
undefined, | ||
undefined, | ||
|
@@ -1476,23 +1476,23 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco | |
* @param {Number} amount - always in smallest currency unit | ||
* @param {String} comment | ||
* @param {String} currency | ||
* @param {String} merchant | ||
* @param {String} category | ||
* @param {String} tag | ||
* @param {String} existingSplitChatReportID - Either a group DM or a workspace chat | ||
* @param {String} merchant | ||
*/ | ||
function splitBill(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, tag, existingSplitChatReportID = '', merchant) { | ||
function splitBill(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, existingSplitChatReportID = '') { | ||
const {splitData, splits, onyxData} = createSplitsAndOnyxData( | ||
participants, | ||
currentUserLogin, | ||
currentUserAccountID, | ||
amount, | ||
comment, | ||
currency, | ||
merchant, | ||
category, | ||
tag, | ||
existingSplitChatReportID, | ||
merchant, | ||
); | ||
API.write( | ||
'SplitBill', | ||
|
@@ -1525,22 +1525,23 @@ function splitBill(participants, currentUserLogin, currentUserAccountID, amount, | |
* @param {Number} amount - always in smallest currency unit | ||
* @param {String} comment | ||
* @param {String} currency | ||
* @param {String} merchant | ||
* @param {String} category | ||
* @param {String} tag | ||
* @param {String} merchant | ||
*/ | ||
function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, tag, merchant) { | ||
const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, tag, '', merchant); | ||
function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag) { | ||
const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag); | ||
|
||
API.write( | ||
'SplitBillAndOpenReport', | ||
{ | ||
reportID: splitData.chatReportID, | ||
amount, | ||
splits: JSON.stringify(splits), | ||
currency, | ||
merchant, | ||
comment, | ||
category, | ||
merchant, | ||
tag, | ||
transactionID: splitData.transactionID, | ||
reportActionID: splitData.reportActionID, | ||
|
@@ -1562,10 +1563,12 @@ function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccou | |
* @param {String} currentUserLogin | ||
* @param {Number} currentUserAccountID | ||
* @param {String} comment | ||
* @param {String} category | ||
* @param {String} tag | ||
* @param {Object} receipt | ||
* @param {String} existingSplitChatReportID - Either a group DM or a workspace chat | ||
*/ | ||
function startSplitBill(participants, currentUserLogin, currentUserAccountID, comment, receipt, existingSplitChatReportID = '') { | ||
function startSplitBill(participants, currentUserLogin, currentUserAccountID, comment, category, tag, receipt, existingSplitChatReportID = '') { | ||
const currentUserEmailForIOUSplit = OptionsListUtils.addSMSDomainIfPhoneNumber(currentUserLogin); | ||
const participantAccountIDs = _.map(participants, (participant) => Number(participant.accountID)); | ||
const existingSplitChatReport = | ||
|
@@ -1774,6 +1777,8 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co | |
splits: JSON.stringify(splits), | ||
receipt, | ||
comment, | ||
category, | ||
tag, | ||
isFromGroupDM: !existingSplitChatReport, | ||
...(existingSplitChatReport ? {} : {createdReportActionID: splitChatCreatedReportAction.reportActionID}), | ||
}, | ||
|
@@ -1981,6 +1986,8 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, sessi | |
created: transactionCreated, | ||
merchant: transactionMerchant, | ||
comment: transactionComment, | ||
category: transactionCategory, | ||
tag: transactionTag, | ||
} = ReportUtils.getTransactionDetails(updatedTransaction); | ||
|
||
API.write( | ||
|
@@ -1992,6 +1999,8 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, sessi | |
created: transactionCreated, | ||
merchant: transactionMerchant, | ||
comment: transactionComment, | ||
category: transactionCategory, | ||
tag: transactionTag, | ||
splits: JSON.stringify(splits), | ||
}, | ||
{optimisticData, successData, failureData}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,8 +194,17 @@ function IOURequestStepConfirmation({ | |
|
||
// If we have a receipt let's start the split bill by creating only the action, the transaction, and the group DM if needed | ||
if (iouType === CONST.IOU.TYPE.SPLIT && receiptFile) { | ||
const existingSplitChatReportID = CONST.REGEX.NUMBER.test(report.reportID) ? reportID : ''; | ||
IOU.startSplitBill(selectedParticipants, currentUserPersonalDetails.login, currentUserPersonalDetails.accountID, trimmedComment, receiptFile, existingSplitChatReportID); | ||
const existingSplitChatReportID = CONST.REGEX.NUMBER.test(reportID) ? reportID : ''; | ||
IOU.startSplitBill( | ||
selectedParticipants, | ||
currentUserPersonalDetails.login, | ||
currentUserPersonalDetails.accountID, | ||
trimmedComment, | ||
transaction.category, | ||
transaction.tag, | ||
receiptFile, | ||
existingSplitChatReportID, | ||
); | ||
return; | ||
} | ||
|
||
|
@@ -209,10 +218,10 @@ function IOURequestStepConfirmation({ | |
transaction.amount, | ||
trimmedComment, | ||
transaction.currency, | ||
transaction.merchant, | ||
youssef-lr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
transaction.category, | ||
youssef-lr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
transaction.tag, | ||
report.reportID, | ||
transaction.merchant, | ||
); | ||
return; | ||
} | ||
|
@@ -226,9 +235,9 @@ function IOURequestStepConfirmation({ | |
transaction.amount, | ||
trimmedComment, | ||
transaction.currency, | ||
transaction.merchant, | ||
transaction.category, | ||
transaction.tag, | ||
transaction.merchant, | ||
); | ||
return; | ||
} | ||
|
@@ -337,7 +346,6 @@ function IOURequestStepConfirmation({ | |
bankAccountRoute={ReportUtils.getBankAccountRoute(report)} | ||
iouMerchant={transaction.merchant} | ||
iouCreated={transaction.created} | ||
isScanRequest={requestType === CONST.IOU.REQUEST_TYPE.SCAN} | ||
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 change caused a regression #33588 |
||
isDistanceRequest={requestType === CONST.IOU.REQUEST_TYPE.DISTANCE} | ||
shouldShowSmartScanFields={_.isEmpty(lodashGet(transaction, 'receipt.source', ''))} | ||
/> | ||
|
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.
This prop is still being passed to the component.