mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-02-27 14:29:39 +00:00
23 lines
737 B
JavaScript
23 lines
737 B
JavaScript
import Group from "discourse/plugins/discourse-patrons/discourse/models/group";
|
|
import Plan from "discourse/plugins/discourse-patrons/discourse/models/plan";
|
|
import Subscription from "discourse/plugins/discourse-patrons/discourse/models/subscription";
|
|
|
|
export default Discourse.Route.extend({
|
|
model() {
|
|
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))
|
|
);
|
|
const subscription = Subscription.create();
|
|
|
|
return Ember.RSVP.hash({ plans, subscription });
|
|
}
|
|
});
|