Skip to content

Commit

Permalink
Merge pull request #25924 from Expensify/alberto-emptyMerchant
Browse files Browse the repository at this point in the history
Default to empty merchant for receipt requests
  • Loading branch information
mountiny authored Aug 25, 2023
2 parents f3af8ce + 443127e commit 68a9fcd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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 : '';

return {
transactionID,
amount,
currency,
reportID,
comment: commentJSON,
merchant: merchant || CONST.TRANSACTION.DEFAULT_MERCHANT,
merchant: merchant || defaultMerchant,
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

0 comments on commit 68a9fcd

Please sign in to comment.