Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Feature: Select Direct Debit or Paypal when user follow payment link …
Browse files Browse the repository at this point in the history
…from email
  • Loading branch information
Shivashankar authored and osahyoun committed Oct 16, 2019
1 parent 670871d commit c009a71
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/javascript/components/Payment/Payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,22 @@ export class Payment extends Component {
this.bindGlobalEvents();
}

// set default payment as DirectDebit / paypal when the
// user follows external link like email
setDefaultPaymentType = () => {
const urlInfo = window.champaign.personalization.urlParams;
if (urlInfo.source == 'fwd') {
if (this.props.showDirectDebit) {
this.selectPaymentType('gocardless');
} else {
this.selectPaymentType('paypal');
}
}
};

bindGlobalEvents() {
ee.on('fundraiser:actions:make_payment', this.makePayment);
ee.on('fundraiser:form:success', this.setDefaultPaymentType);
}

componentDidUpdate() {
Expand Down Expand Up @@ -333,7 +347,6 @@ export class Payment extends Component {
storeInVault,
},
} = this.props;

return (
<div className="Payment section">
<ShowIf condition={!isEmpty(this.state.errors)}>
Expand Down

0 comments on commit c009a71

Please sign in to comment.