(product, couponId, { purchasingForId = null } = {})
| 9 | } |
| 10 | |
| 11 | async function handleHomeSubscription (product, couponId, { purchasingForId = null } = {}) { |
| 12 | const productId = product.get('_id') |
| 13 | const paymentGroupResp = await getPaymentGroupFromProduct(productId, couponId) |
| 14 | const paymentGroup = paymentGroupResp.data |
| 15 | const homeSubDetails = { |
| 16 | productId, |
| 17 | purchasingForId |
| 18 | } |
| 19 | const options = { |
| 20 | stripePriceId: paymentGroup.priceInfo.id, |
| 21 | paymentGroupId: paymentGroup._id, |
| 22 | numberOfLicenses: 1, |
| 23 | email: me.get('email'), |
| 24 | userId: me.get('_id'), |
| 25 | totalAmount: paymentGroup.priceInfo.unit_amount, |
| 26 | homeSubDetails |
| 27 | } |
| 28 | if (product.get('name').includes('corrily')) { |
| 29 | options.corrilyPriceKey = product.get('planID') |
| 30 | } |
| 31 | return handleCheckoutSessionHelper(options) |
| 32 | } |
| 33 | |
| 34 | async function handleCheckoutSessionHelper (options) { |
| 35 | const stripe = await getStripeLib() |
no test coverage detected