Skip to content

Commit

Permalink
move logic for API switching into the action since this is needed to …
Browse files Browse the repository at this point in the history
…be called in at least 3 places
  • Loading branch information
bondydaa committed May 24, 2023
1 parent 0de3008 commit fd4ec91
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/pages/iou/IOUDetailsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,6 @@ class IOUDetailsModal extends Component {
return reportActionWithPendingAction ? reportActionWithPendingAction.pendingAction : undefined;
}

onPressSettlementButton(paymentMethodType) {
// Payment via Expensify Wallet is handled differently for now so make sure we call the right API
if (paymentMethodType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY) {
IOU.payMoneyRequestWithWallet(this.props.chatReport, this.props.iouReport, recipient);
return;
}

IOU.payMoneyRequest(paymentMethodType, this.props.chatReport, this.props.iouReport)
}

render() {
const sessionEmail = lodashGet(this.props.session, 'email', null);
const pendingAction = this.findPendingAction();
Expand Down Expand Up @@ -185,7 +175,7 @@ class IOUDetailsModal extends Component {
{hasOutstandingIOU && this.props.iouReport.managerEmail === sessionEmail && (
<FixedFooter>
<SettlementButton
onPress={this.onPressSettlementButton}
onPress={(paymentMethodType) => IOU.payMoneyRequest(paymentMethodType, this.props.chatReport, this.props.iouReport)}
shouldShowPaypal={Boolean(lodashGet(this.props, 'iouReport.submitterPayPalMeAddress'))}
currency={lodashGet(this.props, 'iouReport.currency')}
enablePaymentsRoute={ROUTES.IOU_DETAILS_ENABLE_PAYMENTS}
Expand Down

0 comments on commit fd4ec91

Please sign in to comment.