diff --git a/src/libs/Permissions.js b/src/libs/Permissions.js index 33cfb6084308..f0a981b350b3 100644 --- a/src/libs/Permissions.js +++ b/src/libs/Permissions.js @@ -28,16 +28,18 @@ function canUseIOU(betas) { } /** + * @param {Array} betas * @returns {Boolean} */ -function canUsePayWithExpensify() { +function canUsePayWithExpensify(betas) { return _.contains(betas, CONST.BETAS.PAY_WITH_EXPENSIFY) || canUseAllBetas(); } /** + * @param {Array} betas * @returns {Boolean} */ -function canUseFreePlan() { +function canUseFreePlan(betas) { return _.contains(betas, CONST.BETAS.FREE_PLAN) || canUseAllBetas(); } diff --git a/src/pages/iou/IOUDetailsModal.js b/src/pages/iou/IOUDetailsModal.js index 5b00f2aa5556..878220af9793 100644 --- a/src/pages/iou/IOUDetailsModal.js +++ b/src/pages/iou/IOUDetailsModal.js @@ -67,6 +67,9 @@ const propTypes = { email: PropTypes.string, }).isRequired, + /** Beta features list */ + betas: PropTypes.arrayOf(PropTypes.string).isRequired, + ...withLocalizePropTypes, }; @@ -181,7 +184,7 @@ class IOUDetailsModal extends Component { */ addExpensifyPaymentOptionIfAvailable() { if (lodashGet(this.props, 'iouReport.currency') !== CONST.CURRENCY.USD - || !Permissions.canUsePayWithExpensify()) { + || !Permissions.canUsePayWithExpensify(this.props.betas)) { return; } @@ -286,5 +289,8 @@ export default compose( session: { key: ONYXKEYS.SESSION, }, + betas: { + key: ONYXKEYS.BETAS, + }, }), )(IOUDetailsModal);