| 40 | } |
| 41 | |
| 42 | constructor (options) { |
| 43 | super(options) |
| 44 | this.timestampForPurchase = new Date().getTime() |
| 45 | this.state = 'standby' |
| 46 | this.products = new Products() |
| 47 | this.products.comparator = 'amount' |
| 48 | if (application.isIPadApp) { |
| 49 | this.products = [] |
| 50 | Backbone.Mediator.publish('buy-gems-modal:update-products') |
| 51 | } else { |
| 52 | this.supermodel.loadCollection(this.products, 'products') |
| 53 | $.post('/db/payment/check-stripe-charges', (something, somethingElse, jqxhr) => { |
| 54 | if (jqxhr.status === 201) { |
| 55 | this.state = 'recovered_charge' |
| 56 | return this.render() |
| 57 | } |
| 58 | }) |
| 59 | } |
| 60 | this.trackTimeVisible({ trackViewLifecycle: true }) |
| 61 | } |
| 62 | |
| 63 | onLoaded () { |
| 64 | this.basicProduct = this.products.getBasicSubscriptionForUser(me) |