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
This commit is contained in:
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -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', () => {
|
||||
|
Reference in New Issue
Block a user