2019-09-11 21:09:34 +10:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
|
|
|
|
|
|
export default Ember.Controller.extend({
|
|
|
|
|
actions: {
|
2019-09-13 13:46:32 +10:00
|
|
|
stripePaymentHandler(data) {
|
2019-09-11 22:06:01 +10:00
|
|
|
return ajax("/patrons/patrons", {
|
2019-09-13 13:46:32 +10:00
|
|
|
data,
|
2019-09-11 21:09:34 +10:00
|
|
|
method: "post"
|
2019-09-11 21:52:04 +10:00
|
|
|
}).catch(() => {
|
2019-09-12 07:14:16 +10:00
|
|
|
return { error: "An error occured while submitting the form." };
|
2019-09-11 21:09:34 +10:00
|
|
|
});
|
2019-09-12 07:43:27 +10:00
|
|
|
},
|
|
|
|
|
|
2019-10-30 14:19:43 +11:00
|
|
|
paymentSuccessHandler(/* paymentIntentId */) {
|
|
|
|
|
bootbox.alert(I18n.t("discourse_patrons.transactions.payment.success"));
|
2019-10-25 14:00:59 +11:00
|
|
|
this.transitionToRoute(
|
|
|
|
|
"user.billing",
|
|
|
|
|
Discourse.User.current().username.toLowerCase()
|
|
|
|
|
);
|
2019-09-12 07:14:16 +10:00
|
|
|
}
|
|
|
|
|
}
|
2019-09-11 21:09:34 +10:00
|
|
|
});
|