2019-08-29 16:41:04 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2020-03-15 21:45:19 +00:00
|
|
|
import { __, sprintf } from '@wordpress/i18n';
|
2020-03-27 23:24:32 +00:00
|
|
|
import classnames from 'classnames';
|
2020-03-16 11:09:29 +00:00
|
|
|
import { cloneElement, Component } from '@wordpress/element';
|
2019-08-29 16:41:04 +00:00
|
|
|
import { compose } from '@wordpress/compose';
|
2020-12-21 19:05:29 +00:00
|
|
|
import {
|
|
|
|
Button,
|
|
|
|
Card,
|
|
|
|
CardBody,
|
2021-01-21 20:06:58 +00:00
|
|
|
CardMedia,
|
2020-12-21 19:05:29 +00:00
|
|
|
CardFooter,
|
|
|
|
FormToggle,
|
2021-02-05 23:41:26 +00:00
|
|
|
Spinner,
|
2020-12-21 19:05:29 +00:00
|
|
|
} from '@wordpress/components';
|
2020-09-03 21:45:40 +00:00
|
|
|
import { withDispatch, withSelect } from '@wordpress/data';
|
2020-12-21 19:05:29 +00:00
|
|
|
import { H, Plugins } from '@woocommerce/components';
|
2020-02-14 02:23:21 +00:00
|
|
|
import {
|
2020-03-15 21:45:19 +00:00
|
|
|
getHistory,
|
|
|
|
getNewPath,
|
|
|
|
updateQueryString,
|
|
|
|
} from '@woocommerce/navigation';
|
2020-05-28 08:51:40 +00:00
|
|
|
import {
|
|
|
|
ONBOARDING_STORE_NAME,
|
2020-06-10 23:49:27 +00:00
|
|
|
OPTIONS_STORE_NAME,
|
2020-05-28 08:51:40 +00:00
|
|
|
PLUGINS_STORE_NAME,
|
2020-06-10 23:49:27 +00:00
|
|
|
pluginNames,
|
2020-06-22 22:18:35 +00:00
|
|
|
SETTINGS_STORE_NAME,
|
2020-05-28 08:51:40 +00:00
|
|
|
} from '@woocommerce/data';
|
2020-08-20 04:59:52 +00:00
|
|
|
import { recordEvent } from '@woocommerce/tracks';
|
2019-08-29 16:41:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2020-08-27 23:55:48 +00:00
|
|
|
import { createNoticesFromResponse } from '../../../lib/notices';
|
2020-08-13 02:05:22 +00:00
|
|
|
import { getCountryCode } from '../../../dashboard/utils';
|
2020-03-16 11:09:29 +00:00
|
|
|
import { getPaymentMethods } from './methods';
|
2019-08-29 16:41:04 +00:00
|
|
|
|
2021-02-16 21:08:35 +00:00
|
|
|
export const setMethodEnabledOption = async (
|
|
|
|
optionName,
|
|
|
|
value,
|
|
|
|
{ clearTaskStatusCache, updateOptions, options }
|
|
|
|
) => {
|
|
|
|
const methodOptions = options[ optionName ];
|
|
|
|
|
|
|
|
// Don't update the option if it already has the same value.
|
|
|
|
if ( methodOptions.enabled !== value ) {
|
|
|
|
await updateOptions( {
|
|
|
|
[ optionName ]: {
|
|
|
|
...methodOptions,
|
|
|
|
enabled: value,
|
|
|
|
},
|
|
|
|
} );
|
|
|
|
|
|
|
|
clearTaskStatusCache();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-08-29 16:41:04 +00:00
|
|
|
class Payments extends Component {
|
2020-03-16 11:09:29 +00:00
|
|
|
constructor( props ) {
|
2019-08-29 16:41:04 +00:00
|
|
|
super( ...arguments );
|
2020-03-16 11:09:29 +00:00
|
|
|
const { methods } = props;
|
|
|
|
|
|
|
|
const enabledMethods = {};
|
|
|
|
methods.forEach(
|
|
|
|
( method ) => ( enabledMethods[ method.key ] = method.isEnabled )
|
|
|
|
);
|
|
|
|
this.state = {
|
2020-06-12 09:38:02 +00:00
|
|
|
busyMethod: null,
|
2020-03-16 11:09:29 +00:00
|
|
|
enabledMethods,
|
2020-06-12 09:38:02 +00:00
|
|
|
recommendedMethod: this.getRecommendedMethod(),
|
2020-03-16 11:09:29 +00:00
|
|
|
};
|
2019-10-03 16:03:29 +00:00
|
|
|
|
|
|
|
this.markConfigured = this.markConfigured.bind( this );
|
|
|
|
}
|
|
|
|
|
2020-06-12 09:38:02 +00:00
|
|
|
componentDidUpdate() {
|
|
|
|
const { recommendedMethod } = this.state;
|
2020-06-04 09:36:57 +00:00
|
|
|
|
2020-06-12 09:38:02 +00:00
|
|
|
const method = this.getRecommendedMethod();
|
|
|
|
if ( recommendedMethod !== method ) {
|
2020-06-04 09:36:57 +00:00
|
|
|
this.setState( {
|
2020-06-12 09:38:02 +00:00
|
|
|
recommendedMethod: method,
|
2020-06-04 09:36:57 +00:00
|
|
|
} );
|
|
|
|
}
|
2020-03-16 11:09:29 +00:00
|
|
|
}
|
|
|
|
|
2020-06-12 09:38:02 +00:00
|
|
|
getRecommendedMethod() {
|
|
|
|
const { methods } = this.props;
|
|
|
|
return methods.find( ( m ) => m.key === 'wcpay' && m.visible )
|
|
|
|
? 'wcpay'
|
|
|
|
: 'stripe';
|
|
|
|
}
|
|
|
|
|
2021-02-16 21:08:35 +00:00
|
|
|
async markConfigured( methodName, queryParams = {} ) {
|
2020-03-16 11:57:23 +00:00
|
|
|
const { enabledMethods } = this.state;
|
2021-02-16 21:08:35 +00:00
|
|
|
const { methods } = this.props;
|
|
|
|
|
|
|
|
const method = methods.find( ( option ) => option.key === methodName );
|
2020-03-16 11:57:23 +00:00
|
|
|
|
2021-02-25 06:15:57 +00:00
|
|
|
if ( ! method ) {
|
|
|
|
throw `Method ${ methodName } not found in available methods list`;
|
|
|
|
}
|
|
|
|
|
2020-03-16 11:57:23 +00:00
|
|
|
this.setState( {
|
|
|
|
enabledMethods: {
|
|
|
|
...enabledMethods,
|
2021-02-16 21:08:35 +00:00
|
|
|
[ methodName ]: true,
|
2020-03-16 11:57:23 +00:00
|
|
|
},
|
|
|
|
} );
|
|
|
|
|
2021-02-16 21:08:35 +00:00
|
|
|
await setMethodEnabledOption( method.optionName, 'yes', this.props );
|
2019-08-29 16:41:04 +00:00
|
|
|
|
2020-03-15 21:45:19 +00:00
|
|
|
recordEvent( 'tasklist_payment_connect_method', {
|
2021-02-16 21:08:35 +00:00
|
|
|
payment_method: methodName,
|
2019-10-03 16:03:29 +00:00
|
|
|
} );
|
2020-08-11 12:20:48 +00:00
|
|
|
|
2020-11-26 00:27:37 +00:00
|
|
|
getHistory().push(
|
|
|
|
getNewPath( { ...queryParams, task: 'payments' }, '/', {} )
|
|
|
|
);
|
2019-08-29 16:41:04 +00:00
|
|
|
}
|
|
|
|
|
2020-03-15 21:45:19 +00:00
|
|
|
getCurrentMethod() {
|
2020-03-16 11:09:29 +00:00
|
|
|
const { methods, query } = this.props;
|
2019-10-03 16:03:29 +00:00
|
|
|
|
2020-03-15 21:45:19 +00:00
|
|
|
if ( ! query.method ) {
|
|
|
|
return;
|
|
|
|
}
|
2019-10-03 16:03:29 +00:00
|
|
|
|
2021-02-25 06:15:57 +00:00
|
|
|
const currentMethod = methods.find(
|
|
|
|
( method ) => method.key === query.method
|
|
|
|
);
|
|
|
|
|
|
|
|
if ( ! currentMethod ) {
|
|
|
|
throw `Current method ${ query.method } not found in available methods list`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return currentMethod;
|
2019-10-07 20:27:34 +00:00
|
|
|
}
|
|
|
|
|
2020-03-15 21:45:19 +00:00
|
|
|
getInstallStep() {
|
|
|
|
const currentMethod = this.getCurrentMethod();
|
2019-10-03 16:03:29 +00:00
|
|
|
|
2020-03-15 21:45:19 +00:00
|
|
|
if ( ! currentMethod.plugins || ! currentMethod.plugins.length ) {
|
|
|
|
return;
|
|
|
|
}
|
2019-10-03 16:03:29 +00:00
|
|
|
|
2020-03-15 21:45:19 +00:00
|
|
|
const { activePlugins } = this.props;
|
|
|
|
const pluginsToInstall = currentMethod.plugins.filter(
|
|
|
|
( method ) => ! activePlugins.includes( method )
|
|
|
|
);
|
|
|
|
const pluginNamesString = currentMethod.plugins
|
|
|
|
.map( ( pluginSlug ) => pluginNames[ pluginSlug ] )
|
|
|
|
.join( ' ' + __( 'and', 'woocommerce-admin' ) + ' ' );
|
2019-08-29 16:41:04 +00:00
|
|
|
|
2020-03-15 21:45:19 +00:00
|
|
|
return {
|
|
|
|
key: 'install',
|
|
|
|
label: sprintf(
|
|
|
|
__( 'Install %s', 'woocommerce-admin' ),
|
|
|
|
pluginNamesString
|
|
|
|
),
|
|
|
|
content: (
|
|
|
|
<Plugins
|
2020-08-27 23:55:48 +00:00
|
|
|
onComplete={ ( plugins, response ) => {
|
|
|
|
createNoticesFromResponse( response );
|
2020-03-15 21:45:19 +00:00
|
|
|
recordEvent( 'tasklist_payment_install_method', {
|
|
|
|
plugins: currentMethod.plugins,
|
|
|
|
} );
|
|
|
|
} }
|
2020-08-27 23:55:48 +00:00
|
|
|
onError={ ( errors, response ) =>
|
|
|
|
createNoticesFromResponse( response )
|
|
|
|
}
|
2020-03-15 21:45:19 +00:00
|
|
|
autoInstall
|
|
|
|
pluginSlugs={ currentMethod.plugins }
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
isComplete: ! pluginsToInstall.length,
|
|
|
|
};
|
2019-08-29 16:41:04 +00:00
|
|
|
}
|
|
|
|
|
2020-08-24 13:20:57 +00:00
|
|
|
async toggleMethod( key ) {
|
2021-02-16 21:08:35 +00:00
|
|
|
const { methods } = this.props;
|
2020-03-16 11:09:29 +00:00
|
|
|
const { enabledMethods } = this.state;
|
|
|
|
const method = methods.find( ( option ) => option.key === key );
|
|
|
|
|
2021-02-25 06:15:57 +00:00
|
|
|
if ( ! method ) {
|
|
|
|
throw `Method ${ key } not found in available methods list`;
|
|
|
|
}
|
|
|
|
|
2020-03-16 11:09:29 +00:00
|
|
|
enabledMethods[ key ] = ! enabledMethods[ key ];
|
|
|
|
this.setState( { enabledMethods } );
|
|
|
|
|
|
|
|
recordEvent( 'tasklist_payment_toggle', {
|
|
|
|
enabled: ! method.isEnabled,
|
|
|
|
payment_method: key,
|
|
|
|
} );
|
|
|
|
|
2021-02-16 21:08:35 +00:00
|
|
|
await setMethodEnabledOption(
|
|
|
|
method.optionName,
|
|
|
|
method.isEnabled ? 'no' : 'yes',
|
|
|
|
this.props
|
|
|
|
);
|
2020-03-16 11:09:29 +00:00
|
|
|
}
|
|
|
|
|
2020-06-12 09:38:02 +00:00
|
|
|
async handleClick( method ) {
|
|
|
|
const { methods } = this.props;
|
|
|
|
const { key, onClick } = method;
|
|
|
|
|
|
|
|
recordEvent( 'tasklist_payment_setup', {
|
|
|
|
options: methods.map( ( option ) => option.key ),
|
|
|
|
selected: key,
|
|
|
|
} );
|
|
|
|
|
|
|
|
if ( onClick ) {
|
|
|
|
this.setState( { busyMethod: key } );
|
|
|
|
await new Promise( onClick )
|
|
|
|
.then( () => {
|
|
|
|
this.setState( { busyMethod: null } );
|
|
|
|
} )
|
|
|
|
.catch( () => {
|
|
|
|
this.setState( { busyMethod: null } );
|
|
|
|
} );
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
updateQueryString( {
|
|
|
|
method: key,
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
2021-02-05 23:41:26 +00:00
|
|
|
getSetupButtons( method ) {
|
|
|
|
const { busyMethod, enabledMethods, recommendedMethod } = this.state;
|
|
|
|
const { container, isConfigured, key } = method;
|
|
|
|
if ( container && ! isConfigured ) {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Button
|
|
|
|
isPrimary={ key === recommendedMethod }
|
|
|
|
isSecondary={ key !== recommendedMethod }
|
|
|
|
isBusy={ busyMethod === key }
|
|
|
|
disabled={ busyMethod }
|
|
|
|
onClick={ () => this.handleClick( method ) }
|
|
|
|
>
|
|
|
|
{ __( 'Set up', 'woocommerce-admin' ) }
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<FormToggle
|
|
|
|
checked={ enabledMethods[ key ] }
|
|
|
|
onChange={ () => this.toggleMethod( key ) }
|
|
|
|
onClick={ ( e ) => e.stopPropagation() }
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-08-29 16:41:04 +00:00
|
|
|
render() {
|
2020-03-15 21:45:19 +00:00
|
|
|
const currentMethod = this.getCurrentMethod();
|
2021-02-05 23:41:26 +00:00
|
|
|
const { recommendedMethod } = this.state;
|
2020-08-11 12:20:48 +00:00
|
|
|
const { methods, query } = this.props;
|
2020-03-15 21:45:19 +00:00
|
|
|
|
|
|
|
if ( currentMethod ) {
|
|
|
|
return (
|
2020-12-21 19:05:29 +00:00
|
|
|
<Card className="woocommerce-task-payment-method woocommerce-task-card">
|
|
|
|
<CardBody>
|
|
|
|
{ cloneElement( currentMethod.container, {
|
|
|
|
query,
|
|
|
|
installStep: this.getInstallStep(),
|
|
|
|
markConfigured: this.markConfigured,
|
|
|
|
hasCbdIndustry: currentMethod.hasCbdIndustry,
|
|
|
|
} ) }
|
|
|
|
</CardBody>
|
2020-03-15 21:45:19 +00:00
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-08-29 16:41:04 +00:00
|
|
|
return (
|
2020-03-15 21:45:19 +00:00
|
|
|
<div className="woocommerce-task-payments">
|
|
|
|
{ methods.map( ( method ) => {
|
|
|
|
const {
|
|
|
|
before,
|
|
|
|
content,
|
2020-03-16 11:09:29 +00:00
|
|
|
isConfigured,
|
2020-03-15 21:45:19 +00:00
|
|
|
key,
|
|
|
|
title,
|
|
|
|
visible,
|
2021-02-05 23:41:26 +00:00
|
|
|
loading,
|
2020-03-15 21:45:19 +00:00
|
|
|
} = method;
|
|
|
|
|
|
|
|
if ( ! visible ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-03-27 23:24:32 +00:00
|
|
|
const classes = classnames(
|
|
|
|
'woocommerce-task-payment',
|
2020-12-21 19:05:29 +00:00
|
|
|
'woocommerce-task-card',
|
2020-03-27 23:24:32 +00:00
|
|
|
! isConfigured &&
|
|
|
|
'woocommerce-task-payment-not-configured',
|
|
|
|
'woocommerce-task-payment-' + key
|
|
|
|
);
|
|
|
|
|
2020-03-31 12:58:11 +00:00
|
|
|
const isRecommended =
|
2020-06-04 09:36:57 +00:00
|
|
|
key === recommendedMethod && ! isConfigured;
|
2020-03-31 12:58:11 +00:00
|
|
|
const showRecommendedRibbon =
|
2020-06-04 09:36:57 +00:00
|
|
|
isRecommended && key !== 'wcpay';
|
2020-03-31 12:58:11 +00:00
|
|
|
const showRecommendedPill =
|
2020-06-04 09:36:57 +00:00
|
|
|
isRecommended && key === 'wcpay';
|
2020-03-31 12:58:11 +00:00
|
|
|
|
2019-08-29 16:41:04 +00:00
|
|
|
return (
|
2020-03-27 23:24:32 +00:00
|
|
|
<Card key={ key } className={ classes }>
|
2021-02-22 01:05:13 +00:00
|
|
|
{ showRecommendedRibbon && (
|
|
|
|
<div className="woocommerce-task-payment__recommended-ribbon">
|
|
|
|
<span>
|
|
|
|
{ __(
|
|
|
|
'Recommended',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
) }
|
|
|
|
<CardMedia isBorderless>{ before }</CardMedia>
|
2020-12-21 19:05:29 +00:00
|
|
|
<CardBody>
|
2020-03-15 21:45:19 +00:00
|
|
|
<H className="woocommerce-task-payment__title">
|
|
|
|
{ title }
|
2020-03-31 12:58:11 +00:00
|
|
|
{ showRecommendedPill && (
|
|
|
|
<span className="woocommerce-task-payment__recommended-pill">
|
|
|
|
{ __(
|
|
|
|
'Recommended',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</span>
|
|
|
|
) }
|
2020-03-15 21:45:19 +00:00
|
|
|
</H>
|
2020-04-08 23:17:32 +00:00
|
|
|
<div className="woocommerce-task-payment__content">
|
2020-03-15 21:45:19 +00:00
|
|
|
{ content }
|
2020-04-08 23:17:32 +00:00
|
|
|
</div>
|
2020-12-21 19:05:29 +00:00
|
|
|
</CardBody>
|
|
|
|
<CardFooter isBorderless>
|
2021-02-05 23:41:26 +00:00
|
|
|
{ loading ? (
|
|
|
|
<Spinner />
|
2020-03-15 21:45:19 +00:00
|
|
|
) : (
|
2021-02-05 23:41:26 +00:00
|
|
|
this.getSetupButtons( method )
|
2020-03-15 21:45:19 +00:00
|
|
|
) }
|
2020-12-21 19:05:29 +00:00
|
|
|
</CardFooter>
|
2020-03-15 21:45:19 +00:00
|
|
|
</Card>
|
2019-08-29 16:41:04 +00:00
|
|
|
);
|
2020-03-15 21:45:19 +00:00
|
|
|
} ) }
|
|
|
|
</div>
|
2019-08-29 16:41:04 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default compose(
|
2020-06-12 09:38:02 +00:00
|
|
|
withDispatch( ( dispatch ) => {
|
|
|
|
const { createNotice } = dispatch( 'core/notices' );
|
2021-02-05 23:41:26 +00:00
|
|
|
const {
|
|
|
|
installAndActivatePlugins,
|
|
|
|
invalidateResolutionForStoreSelector: invalidatePluginStoreSelector,
|
|
|
|
} = dispatch( PLUGINS_STORE_NAME );
|
2020-06-12 09:38:02 +00:00
|
|
|
const { updateOptions } = dispatch( OPTIONS_STORE_NAME );
|
2020-09-29 15:10:40 +00:00
|
|
|
const {
|
|
|
|
invalidateResolution,
|
|
|
|
invalidateResolutionForStoreSelector,
|
|
|
|
} = dispatch( ONBOARDING_STORE_NAME );
|
|
|
|
invalidateResolution( 'getProfileItems', [] );
|
2020-10-08 21:25:41 +00:00
|
|
|
invalidateResolution( 'getTasksStatus', [] );
|
2020-06-12 09:38:02 +00:00
|
|
|
return {
|
2021-02-05 23:41:26 +00:00
|
|
|
clearTaskStatusCache: () => {
|
|
|
|
invalidateResolutionForStoreSelector( 'getTasksStatus' );
|
|
|
|
invalidatePluginStoreSelector( 'getPaypalOnboardingStatus' );
|
|
|
|
},
|
2020-06-12 09:38:02 +00:00
|
|
|
createNotice,
|
|
|
|
installAndActivatePlugins,
|
|
|
|
updateOptions,
|
|
|
|
};
|
|
|
|
} ),
|
|
|
|
withSelect( ( select, props ) => {
|
|
|
|
const { createNotice, installAndActivatePlugins } = props;
|
2020-05-28 08:51:40 +00:00
|
|
|
const { getProfileItems } = select( ONBOARDING_STORE_NAME );
|
2020-08-11 12:20:48 +00:00
|
|
|
const { getOption } = select( OPTIONS_STORE_NAME );
|
2021-02-05 23:41:26 +00:00
|
|
|
const {
|
|
|
|
getActivePlugins,
|
|
|
|
isJetpackConnected,
|
|
|
|
getPaypalOnboardingStatus,
|
|
|
|
hasFinishedResolution,
|
|
|
|
} = select( PLUGINS_STORE_NAME );
|
2020-06-22 22:18:35 +00:00
|
|
|
const { getSettings } = select( SETTINGS_STORE_NAME );
|
|
|
|
const { general: generalSettings = {} } = getSettings( 'general' );
|
2020-08-24 13:20:57 +00:00
|
|
|
const { getTasksStatus } = select( ONBOARDING_STORE_NAME );
|
2020-06-10 23:49:27 +00:00
|
|
|
|
2020-03-16 11:09:29 +00:00
|
|
|
const activePlugins = getActivePlugins();
|
2020-08-24 13:20:57 +00:00
|
|
|
const onboardingStatus = getTasksStatus();
|
2020-03-16 11:09:29 +00:00
|
|
|
const profileItems = getProfileItems();
|
2020-06-10 23:49:27 +00:00
|
|
|
|
|
|
|
const optionNames = [
|
2020-03-27 23:24:32 +00:00
|
|
|
'woocommerce_woocommerce_payments_settings',
|
2020-03-16 11:09:29 +00:00
|
|
|
'woocommerce_stripe_settings',
|
2021-02-05 23:41:26 +00:00
|
|
|
'woocommerce-ppcp-settings',
|
|
|
|
'woocommerce_ppcp-gateway_settings',
|
2020-03-16 11:09:29 +00:00
|
|
|
'woocommerce_payfast_settings',
|
|
|
|
'woocommerce_square_credit_card_settings',
|
|
|
|
'woocommerce_klarna_payments_settings',
|
|
|
|
'woocommerce_kco_settings',
|
|
|
|
'wc_square_refresh_tokens',
|
2020-03-16 11:57:23 +00:00
|
|
|
'woocommerce_cod_settings',
|
|
|
|
'woocommerce_bacs_settings',
|
|
|
|
'woocommerce_bacs_accounts',
|
2020-08-07 00:09:10 +00:00
|
|
|
'woocommerce_eway_settings',
|
2020-12-01 22:10:57 +00:00
|
|
|
'woocommerce_razorpay_settings',
|
2021-02-05 03:41:55 +00:00
|
|
|
'woocommerce_mollie_payments_settings',
|
2021-02-16 21:08:35 +00:00
|
|
|
'woocommerce_payubiz_settings',
|
2020-06-10 23:49:27 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
const options = optionNames.reduce( ( result, name ) => {
|
|
|
|
result[ name ] = getOption( name );
|
|
|
|
return result;
|
|
|
|
}, {} );
|
2020-02-14 02:23:21 +00:00
|
|
|
const countryCode = getCountryCode(
|
2020-06-22 22:18:35 +00:00
|
|
|
generalSettings.woocommerce_default_country
|
2020-02-14 02:23:21 +00:00
|
|
|
);
|
2021-02-05 23:41:26 +00:00
|
|
|
const paypalOnboardingStatus = getPaypalOnboardingStatus();
|
2019-10-03 16:03:29 +00:00
|
|
|
|
2020-03-16 11:09:29 +00:00
|
|
|
const methods = getPaymentMethods( {
|
|
|
|
activePlugins,
|
|
|
|
countryCode,
|
2020-06-12 09:38:02 +00:00
|
|
|
createNotice,
|
|
|
|
installAndActivatePlugins,
|
2020-04-09 23:10:47 +00:00
|
|
|
isJetpackConnected: isJetpackConnected(),
|
2020-08-24 13:20:57 +00:00
|
|
|
onboardingStatus,
|
2020-02-14 02:23:21 +00:00
|
|
|
options,
|
2020-03-16 11:09:29 +00:00
|
|
|
profileItems,
|
2021-02-05 23:41:26 +00:00
|
|
|
paypalOnboardingStatus,
|
|
|
|
loadingPaypalStatus:
|
|
|
|
! hasFinishedResolution( 'getPaypalOnboardingStatus' ) &&
|
|
|
|
! paypalOnboardingStatus,
|
2020-03-16 11:09:29 +00:00
|
|
|
} );
|
|
|
|
|
2019-08-29 16:41:04 +00:00
|
|
|
return {
|
|
|
|
countryCode,
|
2020-03-16 11:09:29 +00:00
|
|
|
profileItems,
|
|
|
|
activePlugins,
|
2019-10-03 16:03:29 +00:00
|
|
|
options,
|
2020-03-16 11:09:29 +00:00
|
|
|
methods,
|
2019-10-03 16:03:29 +00:00
|
|
|
};
|
2019-08-29 16:41:04 +00:00
|
|
|
} )
|
|
|
|
)( Payments );
|