fix(donate): remove call to verification when not signed in
This commit is contained in:
@ -233,7 +233,7 @@ class DonateForm extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { donationAmount, donationDuration } = this.state;
|
const { donationAmount, donationDuration } = this.state;
|
||||||
const { handleProcessing } = this.props;
|
const { handleProcessing, isSignedIn } = this.props;
|
||||||
const {
|
const {
|
||||||
donationState: { processing, success, error }
|
donationState: { processing, success, error }
|
||||||
} = this.state;
|
} = this.state;
|
||||||
@ -268,6 +268,7 @@ class DonateForm extends Component {
|
|||||||
donationDuration={donationDuration}
|
donationDuration={donationDuration}
|
||||||
handleProcessing={handleProcessing}
|
handleProcessing={handleProcessing}
|
||||||
onDonationStateChange={this.onDonationStateChange}
|
onDonationStateChange={this.onDonationStateChange}
|
||||||
|
skipAddDonation={!isSignedIn}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
|
@ -33,7 +33,13 @@ export class PaypalButton extends Component {
|
|||||||
|
|
||||||
handleApproval = data => {
|
handleApproval = data => {
|
||||||
const { amount, duration } = this.state;
|
const { amount, duration } = this.state;
|
||||||
this.props.handleProcessing(duration, amount, 'Paypal payment submission');
|
const { skipAddDonation = false } = this.props;
|
||||||
|
if (!skipAddDonation) {
|
||||||
|
this.props.handleProcessing(
|
||||||
|
duration,
|
||||||
|
amount,
|
||||||
|
'Paypal payment submission'
|
||||||
|
);
|
||||||
this.props.onDonationStateChange(false, true, '');
|
this.props.onDonationStateChange(false, true, '');
|
||||||
verifySubscriptionPaypal(data)
|
verifySubscriptionPaypal(data)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
@ -49,11 +55,17 @@ export class PaypalButton extends Component {
|
|||||||
error.response && error.response.data
|
error.response && error.response.data
|
||||||
? error.response.data
|
? error.response.data
|
||||||
: {
|
: {
|
||||||
error:
|
error: `Something is not right. Please contact team@freecodecamp.org`
|
||||||
'Something is not right. Please contact team@freecodecamp.org'
|
|
||||||
};
|
};
|
||||||
this.props.onDonationStateChange(false, false, data.error);
|
this.props.onDonationStateChange(false, false, data.error);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this.props.onDonationStateChange(
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
data.error ? data.error : ''
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -101,7 +113,8 @@ const propTypes = {
|
|||||||
donationDuration: PropTypes.string,
|
donationDuration: PropTypes.string,
|
||||||
handleProcessing: PropTypes.func,
|
handleProcessing: PropTypes.func,
|
||||||
isDonating: PropTypes.bool,
|
isDonating: PropTypes.bool,
|
||||||
onDonationStateChange: PropTypes.func
|
onDonationStateChange: PropTypes.func,
|
||||||
|
skipAddDonation: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = createSelector(
|
const mapStateToProps = createSelector(
|
||||||
|
Reference in New Issue
Block a user