mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-22 18:02:19 -05:00
* feat: unify post payment actions * feat: handle stripe card error and add donation after auth * feat: add donation saga stripe test * feat: add more coverage to stripe tests * feat: add initial stripe card saga test * feat: finalize initial stripe card saga test * feat: add patreon test saga * feat: test clean up * feat: do not show processing for Patreon * feat: normalize donation settings * feat: turn payment provider/contex to enum * feat: remove donation-settings.js * fix: git ignore generated config * fix: ignore the generate config from everything * fix: remove types.js * fix: update linting to include types.js Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>
16 lines
472 B
JavaScript
16 lines
472 B
JavaScript
import { isEmail, isNumeric } from 'validator';
|
|
import {
|
|
durationKeysConfig,
|
|
donationOneTimeConfig,
|
|
donationSubscriptionConfig
|
|
} from '../../../../config/donation-settings';
|
|
|
|
export function validStripeForm(amount, duration, email) {
|
|
return isEmail('' + email) &&
|
|
isNumeric('' + amount) &&
|
|
durationKeysConfig.includes(duration) &&
|
|
duration === 'one-time'
|
|
? donationOneTimeConfig.includes(amount)
|
|
: donationSubscriptionConfig.plans[duration];
|
|
}
|