2020-03-17 21:16:08 +05:30
|
|
|
const path = require('path');
|
|
|
|
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });
|
2020-03-16 14:32:35 +05:30
|
|
|
|
2019-11-19 20:30:47 +05:30
|
|
|
// Configuration for client side
|
|
|
|
const durationsConfig = {
|
|
|
|
year: 'yearly',
|
2020-03-20 21:29:32 +03:00
|
|
|
month: 'monthly',
|
2019-11-19 20:30:47 +05:30
|
|
|
onetime: 'one-time'
|
|
|
|
};
|
|
|
|
const amountsConfig = {
|
2020-03-19 18:48:58 +05:30
|
|
|
year: [100000, 25000, 6000],
|
2020-03-20 21:29:32 +03:00
|
|
|
month: [25000, 3500, 500],
|
2020-03-20 11:42:57 +05:30
|
|
|
onetime: [100000, 25000, 6000]
|
2019-11-19 20:30:47 +05:30
|
|
|
};
|
2019-11-20 11:47:46 +05:30
|
|
|
const defaultAmount = {
|
2020-03-20 21:29:32 +03:00
|
|
|
year: 25000,
|
2019-12-20 16:14:16 +05:30
|
|
|
month: 3500,
|
2019-11-20 11:47:46 +05:30
|
|
|
onetime: 25000
|
|
|
|
};
|
2019-11-19 20:30:47 +05:30
|
|
|
const defaultStateConfig = {
|
2020-03-20 21:29:32 +03:00
|
|
|
donationAmount: defaultAmount['month'],
|
|
|
|
donationDuration: 'month'
|
2019-11-19 20:30:47 +05:30
|
|
|
};
|
2019-12-20 16:14:16 +05:30
|
|
|
const modalDefaultStateConfig = {
|
2020-03-20 21:29:32 +03:00
|
|
|
donationAmount: 500,
|
|
|
|
donationDuration: 'month'
|
2019-12-20 16:14:16 +05:30
|
|
|
};
|
2019-11-19 20:30:47 +05:30
|
|
|
|
|
|
|
// Configuration for server side
|
|
|
|
const durationKeysConfig = ['year', 'month', 'onetime'];
|
2020-03-20 11:42:57 +05:30
|
|
|
const donationOneTimeConfig = [100000, 25000, 6000];
|
2019-11-19 20:30:47 +05:30
|
|
|
const donationSubscriptionConfig = {
|
|
|
|
duration: {
|
|
|
|
year: 'Yearly',
|
|
|
|
month: 'Monthly'
|
|
|
|
},
|
|
|
|
plans: {
|
2020-03-20 11:42:57 +05:30
|
|
|
year: [100000, 25000, 6000],
|
2020-03-20 21:29:32 +03:00
|
|
|
month: [25000, 3500, 500]
|
2019-11-19 20:30:47 +05:30
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-03-13 12:25:57 +03:00
|
|
|
// Shared paypal configuration
|
2020-03-16 14:32:35 +05:30
|
|
|
const paypalConfigTypes = {
|
|
|
|
live: {
|
2020-03-20 04:33:27 +03:00
|
|
|
month: {
|
|
|
|
'500': {
|
|
|
|
planId: 'P-1L11422374370240ULZKX3PA'
|
2020-03-20 21:29:32 +03:00
|
|
|
},
|
|
|
|
'3500': {
|
|
|
|
planId: 'P-1L11422374370240ULZKX3PA'
|
|
|
|
},
|
|
|
|
'25000': {
|
|
|
|
planId: 'P-1L11422374370240ULZKX3PA'
|
2020-03-20 04:33:27 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
year: {
|
|
|
|
'6000': {
|
|
|
|
planId: 'P-9Y661558DW462253NLZZ2IMQ'
|
|
|
|
},
|
|
|
|
'25000': {
|
|
|
|
planId: 'P-3NN39392MK1889318LZZ2KQY'
|
|
|
|
},
|
|
|
|
'100000': {
|
|
|
|
planId: 'P-7YN43286C4599382LLZZ2JUI'
|
2020-03-13 12:25:57 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-03-16 14:32:35 +05:30
|
|
|
staging: {
|
2020-03-20 04:33:27 +03:00
|
|
|
month: {
|
|
|
|
'500': {
|
|
|
|
planId: 'P-37N14480BW163382FLZYPVMA'
|
2020-03-20 21:29:32 +03:00
|
|
|
},
|
|
|
|
'3500': {
|
|
|
|
planId: 'P-3E678937P5715503NLZZTRVY'
|
|
|
|
},
|
|
|
|
'25000': {
|
|
|
|
planId: 'P-97K80194AU368022JLZ2Q27Y'
|
2020-03-20 04:33:27 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
year: {
|
|
|
|
'6000': {
|
|
|
|
planId: 'P-0UY77185EM3077131LZYP6VY'
|
2020-03-17 21:16:08 +05:30
|
|
|
},
|
2020-03-20 04:33:27 +03:00
|
|
|
'25000': {
|
|
|
|
planId: 'P-7K1585908S634694XLZZTHUQ'
|
|
|
|
},
|
|
|
|
'100000': {
|
|
|
|
planId: 'P-0J5231134H608574XLZZTDLQ'
|
2020-03-13 12:25:57 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-03-17 21:16:08 +05:30
|
|
|
const paypalConfig =
|
|
|
|
process.env.DEPLOYMENT_ENV && process.env.DEPLOYMENT_ENV === 'live'
|
|
|
|
? paypalConfigTypes['live']
|
|
|
|
: paypalConfigTypes['staging'];
|
2020-03-16 14:32:35 +05:30
|
|
|
|
2020-03-20 04:33:27 +03:00
|
|
|
const paypalConfigurator = (donationAmount, donationDuration) => {
|
|
|
|
if (donationDuration === 'onetime') {
|
|
|
|
return { amount: donationAmount, duration: donationDuration };
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
amount: donationAmount,
|
|
|
|
duration: donationDuration,
|
|
|
|
planId: paypalConfig[donationDuration]['' + donationAmount].planId
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-11-19 20:30:47 +05:30
|
|
|
module.exports = {
|
|
|
|
durationsConfig,
|
|
|
|
amountsConfig,
|
2019-11-20 11:47:46 +05:30
|
|
|
defaultAmount,
|
2019-11-19 20:30:47 +05:30
|
|
|
defaultStateConfig,
|
|
|
|
durationKeysConfig,
|
|
|
|
donationOneTimeConfig,
|
2019-12-20 16:14:16 +05:30
|
|
|
donationSubscriptionConfig,
|
2020-03-13 12:25:57 +03:00
|
|
|
modalDefaultStateConfig,
|
2020-03-20 04:33:27 +03:00
|
|
|
paypalConfig,
|
|
|
|
paypalConfigurator
|
2019-11-19 20:30:47 +05:30
|
|
|
};
|