Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add New payments page #3727

Merged
merged 60 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
b5a4d74
Move PayPalMe to its own page, and update translations
stitesExpensify Jun 17, 2021
bebb9ed
Rename createMenu to popoverMenu
stitesExpensify Jun 17, 2021
c913cdc
Fix imports
stitesExpensify Jun 17, 2021
27ee1a0
Merge branch 'main' of github.com:Expensify/Expensify.cash into stite…
stitesExpensify Jun 21, 2021
5666d7a
Update category for page move
stitesExpensify Jun 22, 2021
a8c7ce2
Update paymentsPage to display payment methods
stitesExpensify Jun 22, 2021
0d38afa
Create paymentsMethodList component
stitesExpensify Jun 22, 2021
b20f1ed
Add onPress for payment methods
stitesExpensify Jun 22, 2021
34639bc
Add method for adding payment methods button
stitesExpensify Jun 22, 2021
c5f7418
Move getting the paypal.me nvp to getPaymentMethods
stitesExpensify Jun 22, 2021
06e2d0d
Move all payment method list creation into PaymentMethodList
stitesExpensify Jun 22, 2021
fbac189
Update payment methods to use description
stitesExpensify Jun 22, 2021
6dc0dab
Merge branch 'main' of github.com:Expensify/Expensify.cash into stite…
stitesExpensify Jun 22, 2021
3141bb2
style
stitesExpensify Jun 22, 2021
bef7c3f
style
stitesExpensify Jun 22, 2021
427dd5d
Add popover to get to paypal page
stitesExpensify Jun 23, 2021
78d3449
Add appropriate icons
stitesExpensify Jun 23, 2021
1bcdca0
Remove unused state vars
stitesExpensify Jun 23, 2021
92ad5b9
Style
stitesExpensify Jun 23, 2021
9dce8a5
Style
stitesExpensify Jun 23, 2021
24d2c4e
Split paymentspage into native files because of popover positioning
stitesExpensify Jun 24, 2021
cb7f241
Merge branch 'main' of github.com:Expensify/Expensify.cash into stite…
stitesExpensify Jun 24, 2021
fb43ddc
Merge branch 'main' of github.com:Expensify/Expensify.cash into stite…
stitesExpensify Jun 24, 2021
e79f03e
Revert podfile changes
stitesExpensify Jun 24, 2021
27e482d
Revert podfile lock changes
stitesExpensify Jun 24, 2021
4bf5e08
Remove accidental update
stitesExpensify Jun 28, 2021
da1dc60
Remove accidental update
stitesExpensify Jun 28, 2021
39a3c44
Remove useless button
stitesExpensify Jun 29, 2021
167a28c
Move getting the element location to a module
stitesExpensify Jun 29, 2021
8d7d303
Style
stitesExpensify Jun 29, 2021
5ba671f
Move PaymentsPage back into a single file
stitesExpensify Jun 29, 2021
d83dc8f
Remove unnecessary eslint comments and unnecessary prop
stitesExpensify Jun 29, 2021
9ce87fc
Move paymentList logic to its own function
stitesExpensify Jun 29, 2021
a491c92
Fix prop comments
stitesExpensify Jun 29, 2021
feb78ab
Adding more comments
stitesExpensify Jun 29, 2021
ff8383a
Add paypal.me to es
stitesExpensify Jun 29, 2021
fecf78e
Kebab case
stitesExpensify Jun 29, 2021
ab57107
Remove remenant createMenu references
stitesExpensify Jun 29, 2021
39e7a8d
Pretty up lodash
stitesExpensify Jun 29, 2021
135b797
Style
stitesExpensify Jun 29, 2021
a3b07fd
Add better keys
stitesExpensify Jun 29, 2021
d9a9886
Update state var name to be more consistent
stitesExpensify Jun 29, 2021
bb2a83f
Move __cash__ to a const
stitesExpensify Jun 29, 2021
8371ae2
Merge branch 'main' of github.com:Expensify/Expensify.cash into stite…
stitesExpensify Jun 29, 2021
7546948
Add translations
stitesExpensify Jun 29, 2021
5b6c033
Remove line too long errors
stitesExpensify Jun 29, 2021
66341fd
Add wallet constant and use wallet icon for wallet
stitesExpensify Jun 30, 2021
5b869c3
Fix proptype
stitesExpensify Jun 30, 2021
015e61e
Move paypal constant
stitesExpensify Jun 30, 2021
2711bf1
Remove useless inverted prop
stitesExpensify Jun 30, 2021
2aa3cf0
Remove padding that we don't want
stitesExpensify Jun 30, 2021
1b095ea
Merge branch 'main' of github.com:Expensify/Expensify.cash into stite…
stitesExpensify Jun 30, 2021
13874c2
Move position by 20
stitesExpensify Jun 30, 2021
6d1f555
Merge branch 'main' of github.com:Expensify/Expensify.cash into stite…
stitesExpensify Jul 1, 2021
0e0f7b6
Fix capitalization
stitesExpensify Jul 1, 2021
046338c
Comment style
stitesExpensify Jul 1, 2021
ca87f1c
Change name to be more generic and accurate
stitesExpensify Jul 1, 2021
b2225da
Cleanup render
stitesExpensify Jul 1, 2021
a6693be
Style cleanup
stitesExpensify Jul 1, 2021
edf3bb6
Remove unnecessary translation
stitesExpensify Jul 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions assets/images/creditcard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions assets/images/paypal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/CONST.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/ROUTES.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
SETTINGS_ABOUT: 'settings/about',
SETTINGS_APP_DOWNLOAD_LINKS: 'settings/about/app-download-links',
SETTINGS_PAYMENTS: 'settings/payments',
SETTINGS_ADD_PAYPAL_ME: 'settings/payments/add-paypal-me',
SETTINGS_ADD_LOGIN: 'settings/addlogin/:type',
getSettingsAddLoginRoute: type => `settings/addlogin/${type}`,
NEW_GROUP: 'new/group',
Expand Down
6 changes: 4 additions & 2 deletions src/components/Icon/Expensicons.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ChatBubble from '../../../assets/images/chatbubble.svg';
import Checkmark from '../../../assets/images/checkmark.svg';
import Clipboard from '../../../assets/images/clipboard.svg';
import Close from '../../../assets/images/close.svg';
import CreditCard from '../../../assets/images/creditcard.svg';
import DownArrow from '../../../assets/images/down.svg';
import Download from '../../../assets/images/download.svg';
import Emoji from '../../../assets/images/emoji.svg';
Expand All @@ -33,7 +34,7 @@ import NewWorkspace from '../../../assets/images/new-workspace.svg';
import Offline from '../../../assets/images/offline.svg';
import Paperclip from '../../../assets/images/paperclip.svg';
import Paycheck from '../../../assets/images/paycheck.svg';
import Paypal from '../../../assets/images/paypal.svg';
import PayPal from '../../../assets/images/paypal.svg';
import Pencil from '../../../assets/images/pencil.svg';
import Phone from '../../../assets/images/phone.svg';
import Pin from '../../../assets/images/pin.svg';
Expand Down Expand Up @@ -64,6 +65,7 @@ export {
Checkmark,
Clipboard,
Close,
CreditCard,
DownArrow,
Download,
Emoji,
Expand All @@ -86,7 +88,7 @@ export {
Offline,
Paperclip,
Paycheck,
Paypal,
PayPal,
Pencil,
Phone,
Pin,
Expand Down
18 changes: 11 additions & 7 deletions src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const MenuItem = ({
onPress(e);
}}
style={({hovered, pressed}) => ([
styles.createMenuItem,
styles.popoverMenuItem,
getButtonBackgroundColorStyle(getButtonState(focused || hovered, pressed, success, disabled)),
wrapperStyle,
])}
Expand All @@ -109,7 +109,7 @@ const MenuItem = ({
{icon && (
<View
style={[
styles.createMenuIcon,
styles.popoverMenuIcon,
...iconStyles,
]}
>
Expand All @@ -124,11 +124,16 @@ const MenuItem = ({
</View>
)}
<View style={[styles.justifyContentCenter, styles.menuItemTextContainer]}>
<Text style={[styles.createMenuText, styles.ml3, (disabled ? styles.disabledText : undefined)]}>
<Text style={[
styles.popoverMenuText,
styles.ml3,
(disabled ? styles.disabledText : undefined),
]}
>
{title}
</Text>
{description && (
<Text style={[styles.createMenuDescription, styles.ml3, styles.mt1]}>
<Text style={[styles.popoverMenuDescription, styles.ml3, styles.mt1]}>
{description}
</Text>
)}
Expand All @@ -138,22 +143,21 @@ const MenuItem = ({
{subtitle && (
<View style={[styles.justifyContentCenter, styles.mr1]}>
<Text
style={styles.createMenuDescription}
style={styles.popoverMenuDescription}
>
{subtitle}
</Text>
</View>
)}
{shouldShowRightIcon && (
<View style={styles.createMenuIcon}>
<View style={styles.popoverMenuIcon}>
<Icon
src={iconRight}
fill={getIconFillColor(getButtonState(focused || hovered, pressed, success, disabled))}
/>
</View>
)}
</View>

</>
)}
</Pressable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import MenuItem from '../MenuItem';
import {
propTypes as createMenuPropTypes,
defaultProps as defaultCreateMenuPropTypes,
} from './CreateMenuPropTypes';
} from './PopoverMenuPropTypes';

const propTypes = {
/** Callback fired when the menu is completely closed */
Expand All @@ -23,7 +23,7 @@ const defaultProps = {
onMenuHide: () => {},
};

class BaseCreateMenu extends PureComponent {
class BasePopoverMenu extends PureComponent {
render() {
return (
<Popover
Expand Down Expand Up @@ -61,6 +61,6 @@ class BaseCreateMenu extends PureComponent {
}
}

BaseCreateMenu.propTypes = propTypes;
BaseCreateMenu.defaultProps = defaultProps;
export default withWindowDimensions(BaseCreateMenu);
BasePopoverMenu.propTypes = propTypes;
BasePopoverMenu.defaultProps = defaultProps;
export default withWindowDimensions(BasePopoverMenu);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import BaseCreateMenu from './BaseCreateMenu';
import {propTypes, defaultProps} from './CreateMenuPropTypes';
import BasePopoverMenu from './BasePopoverMenu';
import {propTypes, defaultProps} from './PopoverMenuPropTypes';

/**
* The web implementation of the menu needs to trigger actions before the popup closes
Expand All @@ -12,19 +12,19 @@ import {propTypes, defaultProps} from './CreateMenuPropTypes';
* @param {Object} props
* @returns {React.ReactElement}
*/
const CreateMenu = (props) => {
const PopoverMenu = (props) => {
// Trigger the item's `onSelect` action as soon as clicked
const selectItem = (item) => {
item.onSelected();
props.onItemSelected(item);
};

// eslint-disable-next-line react/jsx-props-no-spreading
return <BaseCreateMenu {...props} onItemSelected={selectItem} />;
return <BasePopoverMenu {...props} onItemSelected={selectItem} />;
};

CreateMenu.propTypes = propTypes;
CreateMenu.defaultProps = defaultProps;
CreateMenu.displayName = 'CreateMenu';
PopoverMenu.propTypes = propTypes;
PopoverMenu.defaultProps = defaultProps;
PopoverMenu.displayName = 'PopoverMenu';

export default CreateMenu;
export default PopoverMenu;
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, {Component} from 'react';
import BaseCreateMenu from './BaseCreateMenu';
import {propTypes, defaultProps} from './CreateMenuPropTypes';
import BasePopoverMenu from './BasePopoverMenu';
import {propTypes, defaultProps} from './PopoverMenuPropTypes';

/**
* The mobile native implementation of the CreateMenu needs to trigger actions after the popup closes
* The mobile native implementation of the PopoverMenu needs to trigger actions after the popup closes
* We need to wait for the modal to close otherwise menu actions that trigger another modal
* would not work
*/
class CreateMenu extends Component {
class PopoverMenu extends Component {
/**
* Set the item's `onSelected` action to fire after the menu popup closes
* @param {{onSelected: function}} item
Expand All @@ -25,7 +25,7 @@ class CreateMenu extends Component {

render() {
return (
<BaseCreateMenu
<BasePopoverMenu
// eslint-disable-next-line react/jsx-props-no-spreading
{...this.props}
onMenuHide={this.onMenuHide}
Expand All @@ -35,7 +35,7 @@ class CreateMenu extends Component {
}
}

CreateMenu.propTypes = propTypes;
CreateMenu.defaultProps = defaultProps;
PopoverMenu.propTypes = propTypes;
PopoverMenu.defaultProps = defaultProps;

export default CreateMenu;
export default PopoverMenu;
7 changes: 6 additions & 1 deletion src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,18 @@ export default {
newPasswordPrompt: 'New password must be different than your old password, have at least 8 characters,\n1 capital letter, 1 lowercase letter, 1 number.',
confirmNewPassword: 'Confirm New Password',
},
paymentsPage: {
addPayPalMePage: {
enterYourUsernameToGetPaidViaPayPal: 'Enter your username to get paid back via PayPal.',
payPalMe: 'PayPal.me/',
yourPayPalUsername: 'Your PayPal username',
addPayPalAccount: 'Add PayPal Account',
growlMessageOnSave: 'Your PayPal username was successfully added',
},
paymentMethodList: {
addPaymentMethod: 'Add Payment Method',
accountLastFour: 'Account ending in',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI – we've ended up shortening this to just "Ending in" to save some space in #47104

cardLastFour: 'Card ending in',
},
preferencesPage: {
mostRecent: 'Most Recent',
mostRecentModeDescription: 'This will display all chats by default, sorted by most recent, with pinned items at the top',
Expand Down
7 changes: 6 additions & 1 deletion src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,17 @@ export default {
newPasswordPrompt: 'La nueva contraseña tiene que ser diferente de la antigua, tener al menos 8 letras,\n1 letra mayúscula, 1 letra minúscula y 1 número.',
confirmNewPassword: 'Confirma la Nueva Contraseña',
},
paymentsPage: {
addPayPalMePage: {
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',
},
paymentMethodList: {
addPaymentMethod: 'Agrega método de pago',
accountLastFour: 'Cuenta con terminación',
cardLastFour: 'Tarjeta con terminacíon',
},
preferencesPage: {
mostRecent: 'Más Recientes',
mostRecentModeDescription: 'Esta opción muestra por defecto todos los chats, ordenados a partir del más reciente, con los chats destacados arriba de todo',
Expand Down
7 changes: 6 additions & 1 deletion src/libs/Navigation/AppNavigator/ModalStackNavigators.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import SettingsPreferencesPage from '../../../pages/settings/PreferencesPage';
import SettingsAboutPage from '../../../pages/settings/AboutPage';
import SettingsAppDownloadLinks from '../../../pages/settings/AppDownloadLinks';
import SettingsPasswordPage from '../../../pages/settings/PasswordPage';
import SettingsPaymentsPage from '../../../pages/settings/PaymentsPage';
import SettingsPaymentsPage from '../../../pages/settings/Payments/PaymentsPage';
import SettingsAddPayPalMePage from '../../../pages/settings/Payments/AddPayPalMePage';
import SettingsAddSecondaryLoginPage from '../../../pages/settings/AddSecondaryLoginPage';
import IOUCurrencySelection from '../../../pages/iou/IOUCurrencySelection';
import ReportParticipantsPage from '../../../pages/ReportParticipantsPage';
Expand Down Expand Up @@ -150,6 +151,10 @@ const SettingsModalStackNavigator = createModalStackNavigator([
Component: SettingsPaymentsPage,
name: 'Settings_Payments',
},
{
Component: SettingsAddPayPalMePage,
name: 'Settings_Add_Paypal_Me',
},
]);

const EnablePaymentsStackNavigator = createModalStackNavigator([{
Expand Down
4 changes: 4 additions & 0 deletions src/libs/Navigation/linkingConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export default {
path: ROUTES.SETTINGS_PAYMENTS,
exact: true,
},
Settings_Add_Paypal_Me: {
path: ROUTES.SETTINGS_ADD_PAYPAL_ME,
exact: true,
},
Settings_Profile: {
path: ROUTES.SETTINGS_PROFILE,
exact: true,
Expand Down
9 changes: 8 additions & 1 deletion src/libs/actions/PaymentMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@ import lodashGet from 'lodash/get';
import Onyx from 'react-native-onyx';
import ONYXKEYS from '../../ONYXKEYS';
import * as API from '../API';
import CONST from '../../CONST';

/**
* Calls the API to get the user's bankAccountList, cardList, wallet, and payPalMe
*/
function getPaymentMethods() {
API.Get({
returnValueList: 'bankAccountList, cardList, userWallet',
returnValueList: 'bankAccountList, cardList, userWallet, nameValuePairs',
name: 'paypalMeAddress',
})
.then((response) => {
Onyx.multiSet({
[ONYXKEYS.USER_WALLET]: lodashGet(response, 'userWallet', null),
[ONYXKEYS.BANK_ACCOUNT_LIST]: lodashGet(response, 'bankAccountList', []),
[ONYXKEYS.CARD_LIST]: lodashGet(response, 'cardList', []),
[ONYXKEYS.NVP_PAYPAL_ME_ADDRESS]:
lodashGet(response, ['nameValuePairs', CONST.NVP.PAYPAL_ME_ADDRESS], ''),
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function getBetas() {
function getUserDetails() {
API.Get({
returnValueList: 'account, loginList, nameValuePairs',
nvpNames: `${CONST.NVP.BLOCKED_FROM_CONCIERGE}, ${CONST.NVP.PAYPAL_ME_ADDRESS}`,
nvpNames: CONST.NVP.BLOCKED_FROM_CONCIERGE,
})
.then((response) => {
// Update the User onyx key
Expand Down
11 changes: 11 additions & 0 deletions src/libs/getClickedElementLocation/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* We don't need to get the position of the element on native platforms because the popover will be bottom mounted
*
* @param {Object} nativeEvent
* @returns {Object}
*/
function getClickedElementLocation(nativeEvent) {
return nativeEvent.currentTarget.getBoundingClientRect();
}

export default getClickedElementLocation;
13 changes: 13 additions & 0 deletions src/libs/getClickedElementLocation/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* We don't need to get the position of the element on native platforms because the popover will be bottom mounted
*
* @returns {Object}
*/
function getClickedElementLocation() {
return {
bottom: 0,
left: 0,
};
}

export default getClickedElementLocation;
4 changes: 2 additions & 2 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
import ReportTypingIndicator from './ReportTypingIndicator';
import AttachmentModal from '../../../components/AttachmentModal';
import compose from '../../../libs/compose';
import CreateMenu from '../../../components/CreateMenu';
import PopoverMenu from '../../../components/PopoverMenu';
import Popover from '../../../components/Popover';
import EmojiPickerMenu from './EmojiPickerMenu';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
Expand Down Expand Up @@ -442,7 +442,7 @@ class ReportActionCompose extends React.Component {
>
<Icon src={Plus} />
</TouchableOpacity>
<CreateMenu
<PopoverMenu
isVisible={this.state.isMenuVisible}
onClose={() => this.setMenuVisibility(false)}
onItemSelected={() => this.setMenuVisibility(false)}
Expand Down
Loading