2020-03-27 23:24:32 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
2020-05-20 18:25:28 +00:00
|
|
|
import { Component } from '@wordpress/element';
|
2020-03-27 23:24:32 +00:00
|
|
|
import { withDispatch } from '@wordpress/data';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WooCommerce dependencies
|
|
|
|
*/
|
|
|
|
import { getQuery } from '@woocommerce/navigation';
|
|
|
|
|
|
|
|
class WCPay extends Component {
|
|
|
|
componentDidMount() {
|
|
|
|
const { createNotice, markConfigured } = this.props;
|
|
|
|
const query = getQuery();
|
|
|
|
// Handle redirect back from WCPay on-boarding
|
2020-05-20 18:25:28 +00:00
|
|
|
if ( query[ 'wcpay-connection-success' ] ) {
|
|
|
|
createNotice(
|
|
|
|
'success',
|
|
|
|
__(
|
|
|
|
'WooCommerce Payments connected successfully.',
|
|
|
|
'woocommerce-admin'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
markConfigured( 'wcpay' );
|
2020-03-27 23:24:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2020-06-12 09:38:02 +00:00
|
|
|
return null;
|
2020-03-27 23:24:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-20 18:25:28 +00:00
|
|
|
export default withDispatch( ( dispatch ) => {
|
|
|
|
const { createNotice } = dispatch( 'core/notices' );
|
|
|
|
return {
|
|
|
|
createNotice,
|
|
|
|
};
|
|
|
|
} )( WCPay );
|