MCPcopy Create free account
hub / github.com/codecombat/codecombat / handleHomeSubscription

Function handleHomeSubscription

app/lib/stripeUtil.js:11–32  ·  view source on GitHub ↗
(product, couponId, { purchasingForId = null } = {})

Source from the content-addressed store, hash-verified

9}
10
11async 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
34async function handleCheckoutSessionHelper (options) {
35 const stripe = await getStripeLib()

Callers 1

Calls 3

getMethod · 0.45

Tested by

no test coverage detected