20 lines
509 B
JavaScript
20 lines
509 B
JavaScript
import DiscourseURL from "discourse/lib/url";
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
export default Ember.Controller.extend({
|
|
actions: {
|
|
stripePaymentHandler(paymentMethodId, amount) {
|
|
return ajax("/patrons/patrons", {
|
|
data: { paymentMethodId, amount },
|
|
method: "post"
|
|
}).catch(() => {
|
|
return { error: "An error occured while submitting the form." };
|
|
});
|
|
},
|
|
|
|
paymentSuccessHandler() {
|
|
DiscourseURL.redirectTo("patrons/thanks");
|
|
}
|
|
}
|
|
});
|