Files

23 lines
550 B
JavaScript
Raw Permalink Normal View History

2019-12-17 16:31:58 +11:00
import EmberObject from "@ember/object";
import discourseComputed from "discourse-common/utils/decorators";
2019-12-17 16:31:58 +11:00
import { ajax } from "discourse/lib/ajax";
const UserPayment = EmberObject.extend({
@discourseComputed("amount")
2019-12-17 17:43:30 +11:00
amountDollars(amount) {
2019-12-17 16:31:58 +11:00
return parseFloat(amount / 100).toFixed(2);
2020-09-16 09:53:50 -05:00
},
2019-12-17 16:31:58 +11:00
});
UserPayment.reopenClass({
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);
})
);
2020-09-16 09:53:50 -05:00
},
2019-12-17 16:31:58 +11:00
});
export default UserPayment;