Files
discourse-subscriptions/assets/javascripts/discourse/models/user-payment.js
T

19 lines
508 B
JavaScript
Raw Normal View History

2019-12-17 16:31:58 +11:00
import EmberObject from "@ember/object";
import { ajax } from "discourse/lib/ajax";
2024-01-16 17:51:44 +01:00
import discourseComputed from "discourse-common/utils/decorators";
2019-12-17 16:31:58 +11:00
2024-11-29 15:42:50 +00:00
export default class UserPayment extends EmberObject {
static findAll() {
2020-09-16 09:53:50 -05:00
return ajax("/s/user/payments", { method: "get" }).then((result) =>
result.map((payment) => {
2019-12-17 16:31:58 +11:00
return UserPayment.create(payment);
})
);
2024-11-29 15:42:50 +00:00
}
2019-12-17 16:31:58 +11:00
2024-11-29 15:42:50 +00:00
@discourseComputed("amount")
amountDollars(amount) {
return parseFloat(amount / 100).toFixed(2);
}
}