chore: clean-up unsed things in stripe integration (#43156)

* chore: clean-up unsed things in stripe integration

* fix: use logged in users email over email given to payment form
pull/43160/head
Tom 2021-08-09 13:27:14 -05:00 committed by GitHub
parent 874f5a3240
commit 0ae8b0c0e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 11 deletions

View File

@ -14,9 +14,7 @@ export default function getCsurf() {
const { path } = req;
if (
// eslint-disable-next-line max-len
/^\/hooks\/update-paypal$|^\/hooks\/update-stripe$|^\/donate\/charge-stripe$/.test(
path
)
/^\/hooks\/update-paypal$|^\/donate\/charge-stripe$/.test(path)
) {
next();
} else {

View File

@ -23,8 +23,7 @@ const signinRE = /^\/signin/;
const statusRE = /^\/status\/ping$/;
const unsubscribedRE = /^\/unsubscribed\//;
const unsubscribeRE = /^\/u\/|^\/unsubscribe\/|^\/ue\//;
const updateHooksRE = /^\/hooks\/update-paypal$|^\/hooks\/update-stripe$/;
const createStripeSession = /^\/donate\/create-stripe-session/;
const updateHooksRE = /^\/hooks\/update-paypal$/;
// note: this would be replaced by webhooks later
const donateRE = /^\/donate\/charge-stripe$/;
@ -41,8 +40,7 @@ const _pathsAllowedREs = [
unsubscribedRE,
unsubscribeRE,
updateHooksRE,
donateRE,
createStripeSession
donateRE
];
export function isAllowedPath(path, pathsAllowedREs = _pathsAllowedREs) {

View File

@ -45,7 +45,7 @@ describe('request-authorization', () => {
const statusRE = /^\/status\/ping$/;
const unsubscribedRE = /^\/unsubscribed\//;
const unsubscribeRE = /^\/u\/|^\/unsubscribe\/|^\/ue\//;
const updateHooksRE = /^\/hooks\/update-paypal$|^\/hooks\/update-stripe$/;
const updateHooksRE = /^\/hooks\/update-paypal$/;
const allowedPathsList = [
authRE,
@ -77,11 +77,9 @@ describe('request-authorization', () => {
allowedPathsList
);
const resultC = isAllowedPath('/hooks/update-paypal', allowedPathsList);
const resultD = isAllowedPath('/hooks/update-stripe', allowedPathsList);
expect(resultA).toBe(true);
expect(resultB).toBe(true);
expect(resultC).toBe(true);
expect(resultD).toBe(true);
});
it('returns false for a non-white-listed path', () => {

View File

@ -191,9 +191,10 @@ class DonateForm extends Component<DonateFormProps, DonateFormState> {
payerEmail: string | undefined,
payerName: string | undefined
) {
const { email } = this.props;
const { donationAmount: amount, donationDuration: duration } = this.state;
payerEmail = email ? email : payerEmail;
window.scrollTo(0, 0);
// change the donation modal button label to close
// or display the close button for the cert donation section
if (this.props.handleProcessing) {