2019-11-19 20:30:47 +05:30
|
|
|
// Configuration for client side
|
|
|
|
const durationsConfig = {
|
2020-04-14 03:16:04 +05:30
|
|
|
month: 'monthly',
|
|
|
|
onetime: 'one-time'
|
2019-11-19 20:30:47 +05:30
|
|
|
};
|
|
|
|
const amountsConfig = {
|
2020-11-06 14:30:14 +03:00
|
|
|
month: [1000, 2000, 3000, 4000, 5000],
|
|
|
|
onetime: [2500, 5000, 7500, 10000, 15000]
|
2019-11-19 20:30:47 +05:30
|
|
|
};
|
2019-11-20 11:47:46 +05:30
|
|
|
const defaultAmount = {
|
2020-11-25 06:00:12 +03:00
|
|
|
month: 500
|
2019-11-20 11:47:46 +05:30
|
|
|
};
|
2020-10-14 13:23:26 +03:00
|
|
|
const defaultDonation = {
|
2020-03-20 21:29:32 +03:00
|
|
|
donationAmount: defaultAmount['month'],
|
|
|
|
donationDuration: 'month'
|
2019-11-19 20:30:47 +05:30
|
|
|
};
|
2020-10-14 13:23:26 +03:00
|
|
|
const modalDefaultDonation = {
|
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
|
|
|
|
2020-04-14 05:45:49 +05:30
|
|
|
const onetimeSKUConfig = {
|
|
|
|
live: [
|
2020-11-06 14:30:14 +03:00
|
|
|
{ amount: '15000', id: 'sku_IElisJHup0nojP' },
|
|
|
|
{ amount: '10000', id: 'sku_IEliodY88lglPk' },
|
|
|
|
{ amount: '7500', id: 'sku_IEli9AXW8DwNtT' },
|
|
|
|
{ amount: '5000', id: 'sku_IElhJxkNh9UgDp' },
|
|
|
|
{ amount: '2500', id: 'sku_IElhQtqLgKZC8y' }
|
2020-04-14 05:45:49 +05:30
|
|
|
],
|
|
|
|
staging: [
|
2020-11-06 14:30:14 +03:00
|
|
|
{ amount: '15000', id: 'sku_IEPNpHACYJmUwz' },
|
|
|
|
{ amount: '10000', id: 'sku_IEPMY1OXxnY4WU' },
|
|
|
|
{ amount: '7500', id: 'sku_IEPLOotEqlMOWC' },
|
|
|
|
{ amount: '5000', id: 'sku_IEPKAxxAxfMnUI' },
|
|
|
|
{ amount: '2500', id: 'sku_IEPIgLRzViwq5z' }
|
2020-04-14 05:45:49 +05:30
|
|
|
]
|
|
|
|
};
|
|
|
|
|
2019-11-19 20:30:47 +05:30
|
|
|
// Configuration for server side
|
2020-11-06 14:30:14 +03:00
|
|
|
const durationKeysConfig = ['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: {
|
|
|
|
month: 'Monthly'
|
|
|
|
},
|
|
|
|
plans: {
|
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-11-06 14:30:14 +03:00
|
|
|
// keep the 5 dollars for the modal
|
2020-03-16 14:32:35 +05:30
|
|
|
const paypalConfigTypes = {
|
|
|
|
live: {
|
2020-03-20 04:33:27 +03:00
|
|
|
month: {
|
2020-11-06 14:30:14 +03:00
|
|
|
'500': { planId: 'P-1L11422374370240ULZKX3PA' },
|
|
|
|
'1000': { planId: 'P-61K21421WY874920PL6E36YI' },
|
|
|
|
'2000': { planId: 'P-31999436LF709112VL6E374A' },
|
|
|
|
'3000': { planId: 'P-1KY930839N8045117L6E4BKY' },
|
|
|
|
'4000': { planId: 'P-0JW4843250567551AL6E4CAI' },
|
|
|
|
'5000': { planId: 'P-0WR49877YD949401BL6E4CTA' }
|
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: {
|
2020-11-06 14:30:14 +03:00
|
|
|
'500': { planId: 'P-37N14480BW163382FLZYPVMA' },
|
|
|
|
'1000': { planId: 'P-28B62039J8092810UL6E3FXA' },
|
|
|
|
'2000': { planId: 'P-7HR706961M9170433L6HI5VI' },
|
|
|
|
'3000': { planId: 'P-35V33574BU596924JL6HI6XY' },
|
|
|
|
'4000': { planId: 'P-45M45060289267734L6HJSXA' },
|
|
|
|
'5000': { planId: 'P-0MD70861FY4172444L6HJTUQ' }
|
2020-03-13 12:25:57 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-03-23 19:33:37 +05:30
|
|
|
const paypalConfigurator = (donationAmount, donationDuration, paypalConfig) => {
|
2020-03-20 04:33:27 +03:00
|
|
|
if (donationDuration === 'onetime') {
|
|
|
|
return { amount: donationAmount, duration: donationDuration };
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
amount: donationAmount,
|
|
|
|
duration: donationDuration,
|
|
|
|
planId: paypalConfig[donationDuration]['' + donationAmount].planId
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-08-19 22:50:34 +03:00
|
|
|
//
|
|
|
|
const donationUrls = {
|
|
|
|
successUrl: 'https://www.freecodecamp.org/news/thank-you-for-donating/',
|
|
|
|
cancelUrl: 'https://freecodecamp.org/donate'
|
|
|
|
};
|
|
|
|
|
2019-11-19 20:30:47 +05:30
|
|
|
module.exports = {
|
|
|
|
durationsConfig,
|
|
|
|
amountsConfig,
|
2019-11-20 11:47:46 +05:30
|
|
|
defaultAmount,
|
2020-10-14 13:23:26 +03:00
|
|
|
defaultDonation,
|
2019-11-19 20:30:47 +05:30
|
|
|
durationKeysConfig,
|
|
|
|
donationOneTimeConfig,
|
2019-12-20 16:14:16 +05:30
|
|
|
donationSubscriptionConfig,
|
2020-10-14 13:23:26 +03:00
|
|
|
modalDefaultDonation,
|
2020-04-14 05:45:49 +05:30
|
|
|
onetimeSKUConfig,
|
2020-03-23 19:33:37 +05:30
|
|
|
paypalConfigTypes,
|
2020-08-19 22:50:34 +03:00
|
|
|
paypalConfigurator,
|
|
|
|
donationUrls
|
2019-11-19 20:30:47 +05:30
|
|
|
};
|