Files
discourse-subscriptions/assets/javascripts/discourse/models/user-payment.js.es6
T
Justin DiRose 9c46794e80 DEV: Remove deprecations & improve error handling (#12)
- Replace deprecated methods on client
- Fix broken dropdowns due to select kit 2 upgrade
- Graceful error handling when Stripe keys are not configured but plugin enabled
2020-05-28 10:32:57 -05:00

23 lines
544 B
JavaScript

import EmberObject from "@ember/object";
import discourseComputed from "discourse-common/utils/decorators";
import { ajax } from "discourse/lib/ajax";
const UserPayment = EmberObject.extend({
@discourseComputed("amount")
amountDollars(amount) {
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;