2019-12-17 16:31:58 +11:00
|
|
|
import EmberObject from "@ember/object";
|
2020-05-28 10:32:57 -05:00
|
|
|
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({
|
2020-05-28 10:32:57 -05:00
|
|
|
@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);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
UserPayment.reopenClass({
|
|
|
|
|
findAll() {
|
|
|
|
|
return ajax("/s/user/payments", { method: "get" }).then(result =>
|
|
|
|
|
result.map(payment => {
|
|
|
|
|
return UserPayment.create(payment);
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default UserPayment;
|