yarn prettier
This commit is contained in:
@@ -13,30 +13,31 @@ export default Ember.Component.extend({
|
||||
|
||||
this.setProperties({
|
||||
confirmation: false,
|
||||
currency: settings.discourse_donations_currency,
|
||||
currency: settings.discourse_donations_currency
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
closeModal() {
|
||||
this.set('paymentError', false);
|
||||
this.set('confirmation', false);
|
||||
this.set("paymentError", false);
|
||||
this.set("confirmation", false);
|
||||
},
|
||||
|
||||
handleConfirmStripeCard(paymentMethod) {
|
||||
this.set('confirmation', paymentMethod);
|
||||
this.set("confirmation", paymentMethod);
|
||||
},
|
||||
|
||||
confirmStripeCard() {
|
||||
const paymentMethodId = this.confirmation.id;
|
||||
this.stripePaymentHandler(paymentMethodId, this.amount).then((paymentIntent) => {
|
||||
if (paymentIntent.error) {
|
||||
this.set('paymentError', paymentIntent.error);
|
||||
this.stripePaymentHandler(paymentMethodId, this.amount).then(
|
||||
paymentIntent => {
|
||||
if (paymentIntent.error) {
|
||||
this.set("paymentError", paymentIntent.error);
|
||||
} else {
|
||||
// console.log('ok done');
|
||||
}
|
||||
}
|
||||
else {
|
||||
// console.log('ok done');
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
export default Ember.Component.extend({
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
@@ -9,14 +8,14 @@ export default Ember.Component.extend({
|
||||
cardError: false,
|
||||
color: jQuery("body").css("color"),
|
||||
backgroundColor: jQuery("body").css("background-color"),
|
||||
stripe: Stripe(settings.discourse_patrons_public_key),
|
||||
stripe: Stripe(settings.discourse_patrons_public_key)
|
||||
});
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
const color = this.get('color');
|
||||
const color = this.get("color");
|
||||
|
||||
const style = {
|
||||
base: {
|
||||
@@ -29,32 +28,33 @@ export default Ember.Component.extend({
|
||||
const elements = this.stripe.elements();
|
||||
const card = elements.create("card", { style, hidePostalCode: true });
|
||||
|
||||
card.mount('#card-element');
|
||||
card.mount("#card-element");
|
||||
|
||||
this.set("card", card);
|
||||
|
||||
card.on("change", (result) => {
|
||||
this.set('cardError', false);
|
||||
card.on("change", result => {
|
||||
this.set("cardError", false);
|
||||
|
||||
if(result.error) {
|
||||
this.set('cardError', result.error.message);
|
||||
if (result.error) {
|
||||
this.set("cardError", result.error.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
submitStripeCard() {
|
||||
this.stripe.createPaymentMethod('card', this.card).then((result) => {
|
||||
|
||||
if (result.error) {
|
||||
this.set('cardError', result.error.message);
|
||||
this.stripe.createPaymentMethod("card", this.card).then(
|
||||
result => {
|
||||
if (result.error) {
|
||||
this.set("cardError", result.error.message);
|
||||
} else {
|
||||
this.handleConfirmStripeCard(result.paymentMethod);
|
||||
}
|
||||
},
|
||||
() => {
|
||||
this.set("cardError", "Unknown error.");
|
||||
}
|
||||
else {
|
||||
this.handleConfirmStripeCard(result.paymentMethod);
|
||||
}
|
||||
}, () => {
|
||||
this.set('cardError', 'Unknown error.');
|
||||
});
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -7,8 +7,8 @@ export default Ember.Controller.extend({
|
||||
data: { paymentMethodId, amount },
|
||||
method: "post"
|
||||
}).catch(() => {
|
||||
return { error: 'An error occured while submitting the form.' };
|
||||
return { error: "An error occured while submitting the form." };
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
|
||||
});
|
||||
export default Ember.Controller.extend({});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
export default function () {
|
||||
this.route('patrons', function() {
|
||||
export default function() {
|
||||
this.route("patrons", function() {
|
||||
this.route("show", { path: ":pid" });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
|
||||
export default Discourse.Route.extend({
|
||||
});
|
||||
export default Discourse.Route.extend({});
|
||||
|
||||
Reference in New Issue
Block a user