(token, options = {})
| 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 |
no test coverage detected