fix(donate): allow unauthenticated donations for year-end
This commit is contained in:
committed by
mrugesh
parent
fc25c281e4
commit
663f726c4e
@@ -29,7 +29,8 @@ const propTypes = {
|
||||
stripe: PropTypes.shape({
|
||||
createToken: PropTypes.func.isRequired
|
||||
}),
|
||||
theme: PropTypes.string
|
||||
theme: PropTypes.string,
|
||||
yearEndGift: PropTypes.bool
|
||||
};
|
||||
const initialState = {
|
||||
donationState: {
|
||||
@@ -117,6 +118,7 @@ class DonateFormChildViewForHOC extends Component {
|
||||
|
||||
postDonation(token) {
|
||||
const { donationAmount: amount, donationDuration: duration } = this.state;
|
||||
const { yearEndGift } = this.props;
|
||||
this.setState(state => ({
|
||||
...state,
|
||||
donationState: {
|
||||
@@ -134,7 +136,7 @@ class DonateFormChildViewForHOC extends Component {
|
||||
this.props.showCloseBtn();
|
||||
}
|
||||
|
||||
return postChargeStripe({
|
||||
return postChargeStripe(yearEndGift, {
|
||||
token,
|
||||
amount,
|
||||
duration
|
||||
|
@@ -141,6 +141,7 @@ class YearEndDonationForm extends Component {
|
||||
donationAmount={donationAmount}
|
||||
donationDuration={donationDuration}
|
||||
getDonationButtonLabel={this.getDonationButtonLabel}
|
||||
yearEndGift={true}
|
||||
/>
|
||||
</Elements>
|
||||
</StripeProvider>
|
||||
|
@@ -50,8 +50,10 @@ export function getArticleById(shortId) {
|
||||
}
|
||||
|
||||
/** POST **/
|
||||
export function postChargeStripe(body) {
|
||||
return post(`/donate/charge-stripe`, body);
|
||||
export function postChargeStripe(yearEndGift, body) {
|
||||
return yearEndGift
|
||||
? postUnauthenticated('/donate/charge-stripe-year-end', body)
|
||||
: post('/donate/charge-stripe', body);
|
||||
}
|
||||
|
||||
export function postCreateHmacHash(body) {
|
||||
|
Reference in New Issue
Block a user