MCPcopy Index your code
hub / github.com/codecombat/codecombat / subscribe

Method subscribe

app/models/User.js:1244–1258  ·  view source on GitHub ↗
(token, options = {})

Source from the content-addressed store, hash-verified

1242 }
1243
1244 subscribe (token, options = {}) {
1245 let left
1246 const stripe = _.clone((left = this.get('stripe')) != null ? left : {})
1247 stripe.planID = options.planID || 'basic'
1248 stripe.token = token.id
1249 if (options.couponID) { stripe.couponID = options.couponID }
1250 this.set({ stripe })
1251 return this.patch({ headers: { 'X-Change-Plan': 'true' } }).then(() => {
1252 if (!utils.isValidEmail(this.get('email'))) {
1253 this.set({ email: token.email })
1254 this.patch()
1255 }
1256 return Promise.resolve()
1257 })
1258 }
1259
1260 unsubscribe () {
1261 let left

Callers 6

CocoModel.spec.jsFile · 0.45
auth.jsFile · 0.45
initializeMethod · 0.45
game.jsFile · 0.45
resetWSInfosMethod · 0.45

Calls 4

getMethod · 0.95
patchMethod · 0.80
cloneMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected