Skip to content
This repository was archived by the owner on Apr 5, 2020. It is now read-only.

Commit 7dabd60

Browse files
committed
error message displays on donate page when stripe not set up rather than silent error
1 parent 5224b27 commit 7dabd60

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/components/Forms/PaymentForm/PaymentFormContainer.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import s from './PaymentForm.scss';
88
import Paper from 'material-ui/Paper';
99
import NotificationSnackbar from '../../Notifications/Snackbar/Snackbar'
1010

11-
1211
class PaymentFormContainer extends React.Component {
1312
constructor(props) {
1413
super(props)
@@ -18,9 +17,17 @@ class PaymentFormContainer extends React.Component {
1817
}
1918
}
2019
render(){
21-
var content = null;
22-
23-
if (this.state.stripeLoadingError) {
20+
let content = null;
21+
if (!this.props.stripeToken) {
22+
content = (
23+
<div className="payment-content">
24+
<h3 style={{color: redA700}} className="payment-header">Stripe config is invalid</h3>
25+
<p>
26+
You need a valid Stripe secret in config/stripe.js to use this page as intended.
27+
</p>
28+
</div>
29+
);
30+
} else if (this.state.stripeLoadingError) {
2431
content = (
2532
<div className="payment-content">
2633
<h3 style={{color: redA700}} className="payment-header">Error While Loading Payment System</h3>
@@ -29,13 +36,11 @@ class PaymentFormContainer extends React.Component {
2936
</p>
3037
</div>
3138
);
32-
}
33-
else if (this.props.paymentComplete) {
39+
} else if (this.props.paymentComplete) {
3440
content = (
3541
<PaymentThankYou />
3642
);
37-
}
38-
else {
43+
} else {
3944
content = (
4045
<PaymentForm submitDisabled={this.props.submitDisabled} editMode={this.props.editMode} />
4146
)
@@ -53,7 +58,8 @@ class PaymentFormContainer extends React.Component {
5358
const mapStateToProps = (state) => {
5459
return {
5560
paymentComplete: state.forms.paymentForm.completed,
56-
isFormValid: !state.forms.loginForm.error
61+
isFormValid: !state.forms.loginForm.error,
62+
stripeToken: state.paymentReducer.stripeToken,
5763
}
5864
}
5965

0 commit comments

Comments
 (0)