DEV: Update to new prettier standards

This commit is contained in:
Justin DiRose
2020-09-16 09:53:50 -05:00
parent d60c5b6d54
commit 7e753d45bd
45 changed files with 1741 additions and 141 deletions
@@ -14,6 +14,6 @@ export default Controller.extend({
}
this.set("order", order);
}
}
},
},
});
@@ -7,6 +7,6 @@ export default Controller.extend({
return DiscourseURL.redirectTo(
`/admin/plugins/discourse-subscriptions/plans/${id}`
);
}
}
},
},
});
@@ -15,6 +15,6 @@ export default Controller.extend({
this.transitionToRoute("adminPlugins.discourse-subscriptions.plans");
})
.catch(popupAjaxError);
}
}
},
},
});
@@ -19,7 +19,7 @@ export default Controller.extend({
{ id: "GBP", name: "GBP" },
{ id: "USD", name: "USD" },
{ id: "INR", name: "INR" },
{ id: "BRL", name: "BRL" }
{ id: "BRL", name: "BRL" },
];
},
@@ -29,7 +29,7 @@ export default Controller.extend({
{ id: "day", name: "day" },
{ id: "week", name: "week" },
{ id: "month", name: "month" },
{ id: "year", name: "year" }
{ id: "year", name: "year" },
];
},
@@ -60,14 +60,14 @@ export default Controller.extend({
// TODO: set default group name beforehand
if (this.get("model.plan.metadata.group_name") === undefined) {
this.set("model.plan.metadata", {
group_name: this.get("model.groups.firstObject.name")
group_name: this.get("model.groups.firstObject.name"),
});
}
this.get("model.plan")
.save()
.then(() => this.redirect(this.productId))
.catch(data =>
.catch((data) =>
bootbox.alert(data.jqXHR.responseJSON.errors.join("\n"))
);
},
@@ -76,9 +76,9 @@ export default Controller.extend({
this.get("model.plan")
.update()
.then(() => this.redirect(this.productId))
.catch(data =>
.catch((data) =>
bootbox.alert(data.jqXHR.responseJSON.errors.join("\n"))
);
}
}
},
},
});
@@ -10,7 +10,7 @@ export default Controller.extend({
createProduct() {
this.get("model.product")
.save()
.then(product => {
.then((product) => {
this.transitionToRoute(
"adminPlugins.discourse-subscriptions.products.show",
product.id
@@ -28,6 +28,6 @@ export default Controller.extend({
);
})
.catch(popupAjaxError);
}
}
},
},
});
@@ -23,16 +23,16 @@ export default Controller.extend({
},
createSubscription(plan) {
return this.stripe.createToken(this.get("cardElement")).then(result => {
return this.stripe.createToken(this.get("cardElement")).then((result) => {
if (result.error) {
return result;
} else {
const customer = Customer.create({ source: result.token.id });
return customer.save().then(c => {
return customer.save().then((c) => {
const subscription = Subscription.create({
customer: c.id,
plan: plan.get("id")
plan: plan.get("id"),
});
return subscription.save();
@@ -44,7 +44,7 @@ export default Controller.extend({
handleAuthentication(plan, transaction) {
return this.stripe
.confirmCardPayment(transaction.payment_intent.client_secret)
.then(result => {
.then((result) => {
if (
result.paymentIntent &&
result.paymentIntent.status === "succeeded"
@@ -86,7 +86,7 @@ export default Controller.extend({
let transaction = this.createSubscription(plan);
transaction
.then(result => {
.then((result) => {
if (result.error) {
bootbox.alert(result.error.message || result.error);
} else if (
@@ -96,7 +96,7 @@ export default Controller.extend({
const transactionId = result.id;
const planId = this.selectedPlan;
this.handleAuthentication(plan, result).then(
authenticationResult => {
(authenticationResult) => {
if (authenticationResult && !authenticationResult.error) {
return Transaction.finalize(transactionId, planId).then(
() => {
@@ -110,10 +110,10 @@ export default Controller.extend({
this._advanceSuccessfulTransaction(plan);
}
})
.catch(result => {
.catch((result) => {
bootbox.alert(result.errorThrown);
this.set("loading", false);
});
}
}
},
},
});