2019-09-11 17:58:08 -04:00
|
|
|
import DiscourseURL from "discourse/lib/url";
|
2019-09-11 07:09:34 -04:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
|
|
|
|
export default Ember.Controller.extend({
|
|
|
|
actions: {
|
2019-09-12 23:46:32 -04:00
|
|
|
stripePaymentHandler(data) {
|
2019-09-11 08:06:01 -04:00
|
|
|
return ajax("/patrons/patrons", {
|
2019-09-12 23:46:32 -04:00
|
|
|
data,
|
2019-09-11 07:09:34 -04:00
|
|
|
method: "post"
|
2019-09-11 07:52:04 -04:00
|
|
|
}).catch(() => {
|
2019-09-11 17:14:16 -04:00
|
|
|
return { error: "An error occured while submitting the form." };
|
2019-09-11 07:09:34 -04:00
|
|
|
});
|
2019-09-11 17:43:27 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
paymentSuccessHandler() {
|
|
|
|
DiscourseURL.redirectTo("patrons/thanks");
|
2019-09-11 17:14:16 -04:00
|
|
|
}
|
|
|
|
}
|
2019-09-11 07:09:34 -04:00
|
|
|
});
|