Files

27 lines
632 B
JavaScript
Raw Permalink Normal View History

import EmberObject from "@ember/object";
2024-01-16 17:51:44 +01:00
import { ajax } from "discourse/lib/ajax";
import discourseComputed from "discourse/lib/decorators";
2019-10-17 20:34:26 +11:00
2024-11-29 15:42:50 +00:00
export default class Subscription extends EmberObject {
static show(id) {
return ajax(`/s/${id}`, { method: "get" });
}
@discourseComputed("status")
2019-10-31 10:01:41 +11:00
canceled(status) {
2019-10-31 13:31:24 +11:00
return status === "canceled";
2024-11-29 15:42:50 +00:00
}
2019-10-31 10:01:41 +11:00
2019-10-17 20:34:26 +11:00
save() {
const data = {
2020-10-21 13:36:31 -05:00
source: this.source,
2020-09-16 09:53:50 -05:00
plan: this.plan,
promo: this.promo,
cardholder_name: this.cardholderName,
cardholder_address: this.cardholderAddress,
2019-10-17 20:34:26 +11:00
};
2020-10-21 13:36:31 -05:00
return ajax("/s/create", { method: "post", data });
2024-11-29 15:42:50 +00:00
}
}