fix(donate): implement donate page

This commit is contained in:
Mrugesh Mohapatra
2019-12-20 16:14:16 +05:30
committed by mrugesh
parent 5609a1303e
commit e4590fed5c
14 changed files with 195 additions and 228 deletions

View File

@ -170,16 +170,6 @@ export default function donateBoot(app, done) {
};
return Promise.resolve(user)
.then(nonDonatingUser => {
const { isDonating } = nonDonatingUser;
if (isDonating) {
throw {
message: `User already has active donation(s).`,
type: 'AlreadyDonatingError'
};
}
return nonDonatingUser;
})
.then(createCustomer)
.then(customer => {
return duration === 'onetime'
@ -194,10 +184,7 @@ export default function donateBoot(app, done) {
})
.then(createAsyncUserDonation)
.catch(err => {
if (
err.type === 'StripeCardError' ||
err.type === 'AlreadyDonatingError'
) {
if (err.type === 'StripeCardError') {
return res.status(402).send({ error: err.message });
}
return res