More stripe integration #6649
2 changed files with 12 additions and 2 deletions
|
@ -2,12 +2,15 @@ import { connect } from 'react-redux';
|
||||||
import { withRouter } from 'react-router';
|
import { withRouter } from 'react-router';
|
||||||
import StripeAccountConnection from './view';
|
import StripeAccountConnection from './view';
|
||||||
import { selectUser } from 'redux/selectors/user';
|
import { selectUser } from 'redux/selectors/user';
|
||||||
|
import { doToast } from 'redux/actions/notifications';
|
||||||
|
|
||||||
// function that receives state parameter and returns object of functions that accept state
|
// function that receives state parameter and returns object of functions that accept state
|
||||||
const select = (state) => ({
|
const select = (state) => ({
|
||||||
user: selectUser(state),
|
user: selectUser(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
// const perform = (dispatch) => ({});
|
const perform = (dispatch) => ({
|
||||||
|
doToast: (options) => dispatch(doToast(options)),
|
||||||
|
});
|
||||||
|
|
||||||
export default withRouter(connect(select)(StripeAccountConnection));
|
export default withRouter(connect(select, perform)(StripeAccountConnection));
|
||||||
|
|
|
@ -31,6 +31,7 @@ if (isDev) {
|
||||||
type Props = {
|
type Props = {
|
||||||
source: string,
|
source: string,
|
||||||
user: User,
|
user: User,
|
||||||
|
doOpenModal: (string, {}) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -68,6 +69,8 @@ class StripeAccountConnection extends React.Component<Props, State> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { user } = this.props;
|
const { user } = this.props;
|
||||||
|
|
||||||
|
let doToast = this.props.doToast;
|
||||||
|
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
this.experimentalUiEnabled = user && user.experimental_ui;
|
this.experimentalUiEnabled = user && user.experimental_ui;
|
||||||
|
|
||||||
|
@ -165,9 +168,13 @@ class StripeAccountConnection extends React.Component<Props, State> {
|
||||||
// get stripe link and set it on the frontend
|
// get stripe link and set it on the frontend
|
||||||
getAndSetAccountLink(true);
|
getAndSetAccountLink(true);
|
||||||
} else {
|
} else {
|
||||||
|
// probably an error from stripe
|
||||||
|
var displayString = 'There was an error getting your account setup, please let support know';
|
||||||
|
doToast({ message: displayString, isError: true });
|
||||||
// not an error from Beamer, throw it
|
// not an error from Beamer, throw it
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue