diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js
index ce1c248962aa..7391b8ccd933 100644
--- a/src/components/ReportActionItem/MoneyRequestPreview.js
+++ b/src/components/ReportActionItem/MoneyRequestPreview.js
@@ -170,8 +170,7 @@ function MoneyRequestPreview(props) {
const isDeleted = lodashGet(props.action, 'pendingAction', null) === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
// Show the merchant for IOUs and expenses only if they are custom or not related to scanning smartscan
- const shouldShowMerchant =
- !_.isEmpty(requestMerchant) && !props.isBillSplit && requestMerchant !== CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT && requestMerchant !== CONST.TRANSACTION.DEFAULT_MERCHANT;
+ const shouldShowMerchant = !_.isEmpty(requestMerchant) && requestMerchant !== CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT && requestMerchant !== CONST.TRANSACTION.DEFAULT_MERCHANT;
const shouldShowDescription = !_.isEmpty(description) && !shouldShowMerchant && !isScanning;
const receiptImages = hasReceipt ? [ReceiptUtils.getThumbnailAndImageURIs(props.transaction)] : [];
@@ -324,7 +323,7 @@ function MoneyRequestPreview(props) {
)}
- {shouldShowMerchant && (
+ {shouldShowMerchant && !props.isBillSplit && (
{hasPendingWaypoints ? requestMerchant.replace(CONST.REGEX.FIRST_SPACE, props.translate('common.tbd')) : requestMerchant}
@@ -336,7 +335,9 @@ function MoneyRequestPreview(props) {
{!isCurrentUserManager && props.shouldShowPendingConversionMessage && (
{props.translate('iou.pendingConversionMessage')}
)}
- {shouldShowDescription && {description}}
+ {(shouldShowDescription || (shouldShowMerchant && props.isBillSplit)) && (
+ {shouldShowDescription ? description : requestMerchant}
+ )}
{props.isBillSplit && !_.isEmpty(participantAccountIDs) && requestAmount > 0 && (
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index d9de984ad12c..1d66ee0c96c8 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -882,10 +882,11 @@ function requestMoney(
* @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 = '') {
+function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, tag, existingSplitChatReportID = '', merchant) {
const currentUserEmailForIOUSplit = OptionsListUtils.addSMSDomainIfPhoneNumber(currentUserLogin);
const participantAccountIDs = _.map(participants, (participant) => Number(participant.accountID));
const existingSplitChatReport =
@@ -895,11 +896,6 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco
const splitChatReport = existingSplitChatReport || ReportUtils.buildOptimisticChatReport(participantAccountIDs);
const isOwnPolicyExpenseChat = splitChatReport.isOwnPolicyExpenseChat;
- // ReportID is -2 (aka "deleted") on the group transaction: https://github.com/Expensify/Auth/blob/3fa2698654cd4fbc30f9de38acfca3fbeb7842e4/auth/command/SplitTransaction.cpp#L24-L27
- const formattedParticipants = isOwnPolicyExpenseChat
- ? [currentUserLogin, ReportUtils.getReportName(splitChatReport)]
- : Localize.arrayToString([currentUserLogin, ..._.map(participants, (participant) => participant.login || '')]);
-
const splitTransaction = TransactionUtils.buildOptimisticTransaction(
amount,
currency,
@@ -908,7 +904,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco
'',
'',
'',
- `${Localize.translateLocal('iou.splitBill')} ${Localize.translateLocal('common.with')} ${formattedParticipants} [${DateUtils.getDBTime().slice(0, 10)}]`,
+ merchant,
undefined,
undefined,
undefined,
@@ -1099,7 +1095,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco
'',
CONST.IOU.TYPE.SPLIT,
splitTransaction.transactionID,
- undefined,
+ merchant,
undefined,
undefined,
undefined,
@@ -1221,9 +1217,21 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco
* @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 = '') {
- const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, tag, existingSplitChatReportID);
+function splitBill(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, tag, existingSplitChatReportID = '', merchant) {
+ const {splitData, splits, onyxData} = createSplitsAndOnyxData(
+ participants,
+ currentUserLogin,
+ currentUserAccountID,
+ amount,
+ comment,
+ currency,
+ category,
+ tag,
+ existingSplitChatReportID,
+ merchant,
+ );
API.write(
'SplitBill',
{
@@ -1233,6 +1241,7 @@ function splitBill(participants, currentUserLogin, currentUserAccountID, amount,
currency,
comment,
category,
+ merchant,
tag,
transactionID: splitData.transactionID,
reportActionID: splitData.reportActionID,
@@ -1256,9 +1265,10 @@ function splitBill(participants, currentUserLogin, currentUserAccountID, amount,
* @param {String} currency
* @param {String} category
* @param {String} tag
+ * @param {String} merchant
*/
-function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, tag) {
- const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, tag);
+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);
API.write(
'SplitBillAndOpenReport',
{
@@ -1268,6 +1278,7 @@ function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccou
currency,
comment,
category,
+ merchant,
tag,
transactionID: splitData.transactionID,
reportActionID: splitData.reportActionID,
diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js
index 44995e6ec3d8..50efdd511481 100644
--- a/src/pages/iou/steps/MoneyRequestConfirmPage.js
+++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js
@@ -236,6 +236,7 @@ function MoneyRequestConfirmPage(props) {
props.iou.category,
props.iou.tag,
reportID,
+ props.iou.merchant,
);
return;
}
@@ -251,6 +252,7 @@ function MoneyRequestConfirmPage(props) {
props.iou.currency,
props.iou.category,
props.iou.tag,
+ props.iou.merchant,
);
return;
}
@@ -283,6 +285,7 @@ function MoneyRequestConfirmPage(props) {
receiptFile,
iouType,
reportID,
+ props.iou.merchant,
],
);
diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js
index 944ec944648a..18793e88d624 100644
--- a/tests/actions/IOUTest.js
+++ b/tests/actions/IOUTest.js
@@ -1115,9 +1115,7 @@ describe('actions/IOU', () => {
expect(carlosTransaction.merchant).toBe(CONST.TRANSACTION.DEFAULT_MERCHANT);
expect(julesTransaction.merchant).toBe(CONST.TRANSACTION.DEFAULT_MERCHANT);
expect(vitTransaction.merchant).toBe(CONST.TRANSACTION.DEFAULT_MERCHANT);
- expect(groupTransaction.merchant).toBe(
- `Split bill with ${RORY_EMAIL}, ${CARLOS_EMAIL}, ${JULES_EMAIL}, and ${VIT_EMAIL} [${DateUtils.getDBTime().slice(0, 10)}]`,
- );
+ expect(groupTransaction.merchant).toBe(CONST.TRANSACTION.DEFAULT_MERCHANT);
expect(carlosTransaction.comment.source).toBe(CONST.IOU.TYPE.SPLIT);
expect(julesTransaction.comment.source).toBe(CONST.IOU.TYPE.SPLIT);