Skip to content

Commit

Permalink
Simplify with variables and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Murray committed Oct 27, 2021
1 parent b79a692 commit 4554f48
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pages/iou/IOUModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ class IOUModal extends Component {
payPalMeAddress: lodashGet(personalDetails, 'payPalMeAddress', ''),
phoneNumber: lodashGet(personalDetails, 'phoneNumber', ''),
}));
this.isSendRequest = props.iouType === CONST.IOU.IOU_TYPE.SEND;
this.hasGoldWallet = props.userWallet.tierName && props.userWallet.tiername === CONST.WALLET.TIER_NAME.GOLD;

this.state = {
currentStepIndex: 0,
Expand Down Expand Up @@ -179,7 +181,7 @@ class IOUModal extends Component {
currency: this.props.iou.selectedCurrencyCode,
},
);
if (this.props.iouType === CONST.IOU.IOU_TYPE.SEND) {
if (this.isSendRequest) {
return this.props.translate('iou.send', {
amount: formattedAmount,
});
Expand All @@ -191,7 +193,7 @@ class IOUModal extends Component {
);
}
if (currentStepIndex === 0) {
if (this.props.iouType === CONST.IOU.IOU_TYPE.SEND) {
if (this.isSendRequest) {
return this.props.translate('iou.sendMoney');
}
return this.props.translate(this.props.hasMultipleParticipants ? 'iou.splitBill' : 'iou.requestMoney');
Expand Down Expand Up @@ -247,8 +249,8 @@ class IOUModal extends Component {
createTransaction(splits) {
const reportID = lodashGet(this.props, 'route.params.reportID', '');

if (this.props.iouType === CONST.IOU.IOU_TYPE.SEND
&& (!this.props.userWallet.tierName || this.props.userWallet.tierName === CONST.WALLET.TIER_NAME.SILVER)) {
// If the user is trying to send money, then they need to upgrade to a GOLD wallet
if (this.isSendRequest && !this.hasGoldWallet) {
Navigation.navigate(ROUTES.IOU_ENABLE_PAYMENTS);
return;
}
Expand Down

0 comments on commit 4554f48

Please sign in to comment.