diff --git a/src/languages/en.js b/src/languages/en.js index 0d38c1bcf102..b21ec2fe5094 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -240,6 +240,7 @@ export default { payPalMe: 'PayPal.me/', yourPayPalUsername: 'Your PayPal username', addPayPalAccount: 'Add PayPal Account', + editPayPalAccount: 'Update PayPal Account', growlMessageOnSave: 'Your PayPal username was successfully added', }, paymentsPage: { diff --git a/src/languages/es.js b/src/languages/es.js index 674258988066..6f34b545cbc4 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -231,7 +231,8 @@ export default { enterYourUsernameToGetPaidViaPayPal: 'Escribe tu nombre de usuario para que otros puedan pagarte a través de PayPal.', payPalMe: 'PayPal.me/', yourPayPalUsername: 'Tu usuario de PayPal', - addPayPalAccount: 'Agregar Cuenta de Paypal', + addPayPalAccount: 'Agregar cuenta de PayPal', + editPayPalAccount: 'Actualizar cuenta de PayPal', }, paymentsPage: { paymentMethodsTitle: 'Métodos de pago', diff --git a/src/libs/actions/User.js b/src/libs/actions/User.js index 6e7c895b6552..e2428a124d04 100644 --- a/src/libs/actions/User.js +++ b/src/libs/actions/User.js @@ -69,7 +69,7 @@ function getBetas() { function getUserDetails() { API.Get({ returnValueList: 'account, loginList, nameValuePairs', - nvpNames: [CONST.NVP.BLOCKED_FROM_CONCIERGE, CONST.NVP.PAYPAL_ME_ADDRESS].join(','), + nvpNames: CONST.NVP.PAYPAL_ME_ADDRESS, }) .then((response) => { // Update the User onyx key diff --git a/src/pages/settings/Payments/AddPayPalMePage.js b/src/pages/settings/Payments/AddPayPalMePage.js index 46928e99cd7b..97edbe423773 100644 --- a/src/pages/settings/Payments/AddPayPalMePage.js +++ b/src/pages/settings/Payments/AddPayPalMePage.js @@ -9,7 +9,7 @@ import HeaderWithCloseButton from '../../../components/HeaderWithCloseButton'; import Text from '../../../components/Text'; import ScreenWrapper from '../../../components/ScreenWrapper'; import NameValuePair from '../../../libs/actions/NameValuePair'; -import {getUserDetails} from '../../../libs/actions/User'; +import getPaymentMethods from '../../../libs/actions/PaymentMethods'; import Navigation from '../../../libs/Navigation/Navigation'; import styles from '../../../styles/styles'; import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; @@ -42,7 +42,7 @@ class AddPayPalMePage extends React.Component { } componentDidMount() { - getUserDetails(); + getPaymentMethods(); } componentDidUpdate(prevProps) { @@ -59,6 +59,7 @@ class AddPayPalMePage extends React.Component { setPayPalMeUsername() { NameValuePair.set(CONST.NVP.PAYPAL_ME_ADDRESS, this.state.payPalMeUsername, ONYXKEYS.NVP_PAYPAL_ME_ADDRESS); Growl.show(this.props.translate('addPayPalMePage.growlMessageOnSave'), CONST.GROWL.SUCCESS, 3000); + Navigation.navigate(ROUTES.SETTINGS_PAYMENTS); } render() { @@ -102,7 +103,9 @@ class AddPayPalMePage extends React.Component { onPress={this.setPayPalMeUsername} pressOnEnter style={[styles.mt3]} - text={this.props.translate('addPayPalMePage.addPayPalAccount')} + text={this.props.payPalMeUsername + ? this.props.translate('addPayPalMePage.editPayPalAccount') + : this.props.translate('addPayPalMePage.addPayPalAccount')} /> diff --git a/src/pages/settings/Payments/PaymentMethodList.js b/src/pages/settings/Payments/PaymentMethodList.js index 7e62429e1f38..5d1b3bd3ceef 100644 --- a/src/pages/settings/Payments/PaymentMethodList.js +++ b/src/pages/settings/Payments/PaymentMethodList.js @@ -138,19 +138,14 @@ class PaymentMethodList extends Component { }); } - // Don't show Add Payment Method button if user provided details for all possible payment methods. - // Right now only available method is Paypal.me - // When there is a new payment method, it needs to be added to following if condition. - if (!this.props.payPalMeUsername) { - combinedPaymentMethods.push({ - type: MENU_ITEM, - title: this.props.translate('paymentMethodList.addPaymentMethod'), - icon: Plus, - onPress: e => this.props.onPress(e), - key: 'addPaymentMethodButton', - disabled: this.props.isLoadingPayments, - }); - } + combinedPaymentMethods.push({ + type: MENU_ITEM, + title: this.props.translate('paymentMethodList.addPaymentMethod'), + icon: Plus, + onPress: e => this.props.onPress(e), + key: 'addPaymentMethodButton', + disabled: this.props.isLoadingPayments, + }); return combinedPaymentMethods; } diff --git a/src/pages/settings/Payments/PaymentsPage.js b/src/pages/settings/Payments/PaymentsPage.js index 3d266d1cfa48..70296695c111 100644 --- a/src/pages/settings/Payments/PaymentsPage.js +++ b/src/pages/settings/Payments/PaymentsPage.js @@ -1,8 +1,5 @@ import React from 'react'; import {View} from 'react-native'; -import PropTypes from 'prop-types'; -import {withOnyx} from 'react-native-onyx'; -import ONYXKEYS from '../../../ONYXKEYS'; import PaymentMethodList from './PaymentMethodList'; import ROUTES from '../../../ROUTES'; import HeaderWithCloseButton from '../../../components/HeaderWithCloseButton'; @@ -23,9 +20,6 @@ import CurrentWalletBalance from '../../../components/CurrentWalletBalance'; const PAYPAL = 'payPalMe'; const propTypes = { - /** User's paypal.me username if they have one */ - payPalMeUsername: PropTypes.string, - ...withLocalizePropTypes, }; @@ -129,13 +123,11 @@ class PaymentsPage extends React.Component { left: this.state.anchorPositionLeft, }} > - {!this.props.payPalMeUsername && ( - this.addPaymentMethodTypePressed(PAYPAL)} - /> - )} + this.addPaymentMethodTypePressed(PAYPAL)} + /> @@ -149,9 +141,4 @@ PaymentsPage.displayName = 'PaymentsPage'; export default compose( withLocalize, - withOnyx({ - payPalMeUsername: { - key: ONYXKEYS.NVP_PAYPAL_ME_ADDRESS, - }, - }), )(PaymentsPage);