2019-10-09 22:52:55 -04:00
|
|
|
import Group from "discourse/plugins/discourse-patrons/discourse/models/group";
|
|
|
|
import Plan from "discourse/plugins/discourse-patrons/discourse/models/plan";
|
2019-10-17 05:34:26 -04:00
|
|
|
import Subscription from "discourse/plugins/discourse-patrons/discourse/models/subscription";
|
2019-10-09 22:52:55 -04:00
|
|
|
|
|
|
|
export default Discourse.Route.extend({
|
|
|
|
model() {
|
2019-10-24 01:51:58 -04:00
|
|
|
const toCurrency = (cents) => parseFloat(cents/100).toFixed(2);
|
|
|
|
|
|
|
|
const planSelectText = (plan) => {
|
|
|
|
return `$${toCurrency(plan.amount)} ${plan.currency.toUpperCase()} / ${plan.interval}`;
|
|
|
|
};
|
|
|
|
|
|
|
|
const plans = Plan.findAll().then(results => results.map(p => planSelectText(p)));
|
2019-10-17 05:34:26 -04:00
|
|
|
const subscription = Subscription.create();
|
2019-10-16 21:07:06 -04:00
|
|
|
|
2019-10-24 17:18:16 -04:00
|
|
|
return Ember.RSVP.hash({ plans, subscription });
|
2019-10-09 22:52:55 -04:00
|
|
|
}
|
|
|
|
});
|