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 formpull/43160/head
parent
874f5a3240
commit
0ae8b0c0e8
|
@ -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', () => {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue