Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/libs/TransactionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function buildOptimisticTransaction(
created = '',
source = '',
originalTransactionID = '',
merchant = CONST.TRANSACTION.DEFAULT_MERCHANT,
merchant = '',
receipt = {},
filename = '',
existingTransactionID = null,
Expand All @@ -60,13 +60,16 @@ function buildOptimisticTransaction(
commentJSON.originalTransactionID = originalTransactionID;
}

// For the SmartScan to run successfully, we need to pass the merchant field empty to the API
const defaultMerchant = _.isEmpty(receipt) ? CONST.TRANSACTION.DEFAULT_MERCHANT : '';
Comment thread
mountiny marked this conversation as resolved.
Comment thread
Gonals marked this conversation as resolved.

return {
transactionID,
amount,
currency,
reportID,
comment: commentJSON,
merchant: merchant || CONST.TRANSACTION.DEFAULT_MERCHANT,
merchant: merchant || defaultMerchant,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was redundant. It's just optimistic data, not affect api call.
As merchant is set to empty optimistically, it caused description briefly showing before api response.

created: created || DateUtils.getDBTime(),
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
receipt,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ function setMoneyRequestParticipants(participants) {
* @param {String} receiptSource
*/
function setMoneyRequestReceipt(receiptPath, receiptSource) {
Onyx.merge(ONYXKEYS.IOU, {receiptPath, receiptSource});
Onyx.merge(ONYXKEYS.IOU, {receiptPath, receiptSource, merchant: ''});
}

function createEmptyTransaction() {
Expand Down