fix(client): update logic for non-signedin users
This commit is contained in:
@ -35,10 +35,17 @@ export class PaypalButton extends Component {
|
||||
return { ...configurationObj };
|
||||
}
|
||||
|
||||
handleApproval = data => {
|
||||
handleApproval = (data, isSubscription) => {
|
||||
const { amount, duration } = this.state;
|
||||
const { skipAddDonation = false } = this.props;
|
||||
if (!skipAddDonation || duration === 'oneTime') {
|
||||
// Skip the api if user is not signed in or if its a one-time donation
|
||||
if (skipAddDonation || !isSubscription) {
|
||||
this.props.onDonationStateChange(
|
||||
true,
|
||||
false,
|
||||
data.error ? data.error : ''
|
||||
);
|
||||
} else {
|
||||
this.props.handleProcessing(
|
||||
duration,
|
||||
amount,
|
||||
@ -63,12 +70,6 @@ export class PaypalButton extends Component {
|
||||
};
|
||||
this.props.onDonationStateChange(false, false, data.error);
|
||||
});
|
||||
} else {
|
||||
this.props.onDonationStateChange(
|
||||
true,
|
||||
false,
|
||||
data.error ? data.error : ''
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -97,9 +98,8 @@ export class PaypalButton extends Component {
|
||||
});
|
||||
}}
|
||||
isSubscription={isSubscription}
|
||||
on={true}
|
||||
onApprove={data => {
|
||||
this.handleApproval(data);
|
||||
this.handleApproval(data, isSubscription);
|
||||
}}
|
||||
onCancel={() => {
|
||||
this.props.onDonationStateChange(
|
||||
|
Reference in New Issue
Block a user