| 31 | getByName (name) { return this.findWhere({ name }) } |
| 32 | |
| 33 | getBasicSubscriptionForUser (user) { |
| 34 | let countrySpecificProduct |
| 35 | const coupon = __guard__(user != null ? user.get('stripe') : undefined, x => x.couponID) |
| 36 | if (coupon) { |
| 37 | countrySpecificProduct = this.findWhere({ name: `${coupon}_basic_subscription` }) |
| 38 | } |
| 39 | if (!countrySpecificProduct) { |
| 40 | countrySpecificProduct = this.findWhere({ name: 'corrily_basic_subscription' } || this.findWhere({ name: `corrily_${(user != null ? user.get('country') : undefined)}_basic_subscription` })) |
| 41 | } |
| 42 | if (!countrySpecificProduct) { |
| 43 | countrySpecificProduct = this.findWhere({ name: `${(user != null ? user.get('country') : undefined)}_basic_subscription` }) |
| 44 | } |
| 45 | console.log('product selected', countrySpecificProduct) |
| 46 | return countrySpecificProduct || this.findWhere({ name: 'basic_subscription' }) |
| 47 | } |
| 48 | |
| 49 | getBasicAnnualSubscriptionForUser () { |
| 50 | const corrilyAnnual = this.findWhere({ name: 'corrily_basic_subscription_annual' }) |