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

Method getLifetimeSubscriptionForUser

app/collections/Products.js:55–70  ·  view source on GitHub ↗
(user)

Source from the content-addressed store, hash-verified

53 }
54
55 getLifetimeSubscriptionForUser (user) {
56 let countrySpecificProduct
57 const country = ((user != null ? user.get('country') : undefined) || '').toLowerCase()
58 if ((country === 'hong-kong') || (country === 'taiwan')) {
59 return null
60 }
61
62 const coupon = __guard__(user != null ? user.get('stripe') : undefined, x => x.couponID)
63 if (coupon) {
64 countrySpecificProduct = this.findWhere({ name: `${coupon}_lifetime_subscription` })
65 }
66 if (!countrySpecificProduct) {
67 countrySpecificProduct = this.findWhere({ name: `${(user != null ? user.get('country') : undefined)}_lifetime_subscription` })
68 }
69 return countrySpecificProduct || this.findWhere({ name: 'lifetime_subscription' })
70 }
71 }
72 Products.initClass()
73 return Products

Callers 3

onLoadedMethod · 0.80
onLoadedMethod · 0.80

Calls 2

__guard__Function · 0.70
getMethod · 0.45

Tested by

no test coverage detected