fix(client): fixup PayPal intergration

This commit is contained in:
Mrugesh Mohapatra
2020-03-17 21:16:08 +05:30
committed by mrugesh
parent 4ee032d664
commit c30f0dbf0d
4 changed files with 37 additions and 7 deletions

View File

@@ -14,8 +14,11 @@ import { stripePublicKey } from '../../../../config/env.json';
import { stripeScriptLoader } from '../../utils/scriptLoaders';
import DonateFormChildViewForHOC from './DonateFormChildViewForHOC';
import DonateCompletion from './DonateCompletion';
import PaypalButton from './PaypalButton';
import { userSelector } from '../../redux';
import { Spacer } from '../../components/helpers';
import './Donation.css';
const propTypes = {
@@ -126,7 +129,18 @@ class MinimalDonateForm extends Component {
return (
<Row>
<Col lg={8} lgOffset={2} sm={10} smOffset={1} xs={12}>
<PaypalButton
handleProcessing={handleProcessing}
onDonationStateChange={this.onDonationStateChange}
/>
</Col>
<Col sm={10} smOffset={1} xs={12}>
<Spacer />
<b>Or donate with a credit card:</b>
<Spacer />
</Col>
<Col lg={8} lgOffset={2} sm={10} smOffset={1} xs={12}>
<StripeProvider stripe={stripe}>
<Elements>
<DonateFormChildViewForHOC

View File

@@ -16,13 +16,13 @@ export class PaypalButton extends Component {
constructor(...props) {
super(...props);
this.state = {
planId: durationPlans.month['500'].planId
planId: durationPlans.year['6000'].planId
};
this.handleApproval = this.handleApproval.bind(this);
}
handleApproval = data => {
this.props.handleProcessing('month', 500, 'Paypal payment submission');
this.props.handleProcessing('year', 6000, 'Paypal payment submission');
this.props.onDonationStateChange(false, true, '');
verifySubscriptionPaypal(data)
.then(response => {