Skip to content

Commit

Permalink
add isDistanceRequest implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
arosiclair committed Aug 22, 2023
1 parent 35d08c4 commit 6c8815b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,11 @@ const CONST = {
DARK: 'dark',
SYSTEM: 'system',
},
TRANSACTION: {
TYPE: {
CUSTOM_UNIT: 'customUnit',
},
},
JSON_CODE: {
SUCCESS: 200,
BAD_REQUEST: 400,
Expand Down
11 changes: 10 additions & 1 deletion src/libs/TransactionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,17 @@ function isReceiptBeingScanned(transaction) {
return transaction.receipt.state === CONST.IOU.RECEIPT_STATE.SCANREADY || transaction.receipt.state === CONST.IOU.RECEIPT_STATE.SCANNING;
}

/**
* @param {Object} transaction
* @param {String} transaction.type
* @param {Object} [transaction.customUnit]
* @param {String} [transaction.customUnit.name]
* @returns {Boolean}
*/
function isDistanceRequest(transaction) {
return true;
const type = lodashGet(transaction, 'comment.type');
const customUnitName = lodashGet(transaction, 'comment.customUnit.name');
return type === CONST.TRANSACTION.TYPE.CUSTOM_UNIT && customUnitName === CONST.CUSTOM_UNITS.NAME_DISTANCE;
}

export {
Expand Down

0 comments on commit 6c8815b

Please sign in to comment.