fix snake case
This commit is contained in:
parent
68b4d07a94
commit
404bede398
|
@ -25,6 +25,7 @@ module DiscoursePatrons
|
||||||
payment_method_types: ['card'],
|
payment_method_types: ['card'],
|
||||||
payment_method: params[:paymentMethodId],
|
payment_method: params[:paymentMethodId],
|
||||||
description: SiteSetting.discourse_patrons_payment_description,
|
description: SiteSetting.discourse_patrons_payment_description,
|
||||||
|
receipt_email: params[:receiptEmail],
|
||||||
confirm: true,
|
confirm: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,19 @@ export default Ember.Component.extend({
|
||||||
this.set("confirmation", false);
|
this.set("confirmation", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleConfirmStripeCard(paymentMethod) {
|
handleConfirmStripeCard(paymentMethod, receiptEmail) {
|
||||||
|
this.set("receiptEmail", receiptEmail);
|
||||||
this.set("confirmation", paymentMethod);
|
this.set("confirmation", paymentMethod);
|
||||||
},
|
},
|
||||||
|
|
||||||
confirmStripeCard() {
|
confirmStripeCard() {
|
||||||
const paymentMethodId = this.confirmation.id;
|
const data = {
|
||||||
this.stripePaymentHandler(paymentMethodId, this.amount).then(
|
paymentMethodId: this.confirmation.id,
|
||||||
|
amount: this.amount,
|
||||||
|
receiptEmail: this.receiptEmail
|
||||||
|
};
|
||||||
|
|
||||||
|
this.stripePaymentHandler(data).then(
|
||||||
paymentIntent => {
|
paymentIntent => {
|
||||||
if (paymentIntent.error) {
|
if (paymentIntent.error) {
|
||||||
this.set("paymentError", paymentIntent.error);
|
this.set("paymentError", paymentIntent.error);
|
||||||
|
|
|
@ -62,7 +62,10 @@ export default Ember.Component.extend({
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
this.set("cardError", result.error.message);
|
this.set("cardError", result.error.message);
|
||||||
} else {
|
} else {
|
||||||
this.handleConfirmStripeCard(result.paymentMethod);
|
this.handleConfirmStripeCard(
|
||||||
|
result.paymentMethod,
|
||||||
|
this.get("billing.email")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
|
|
|
@ -3,9 +3,9 @@ import { ajax } from "discourse/lib/ajax";
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
actions: {
|
actions: {
|
||||||
stripePaymentHandler(paymentMethodId, amount) {
|
stripePaymentHandler(data) {
|
||||||
return ajax("/patrons/patrons", {
|
return ajax("/patrons/patrons", {
|
||||||
data: { paymentMethodId, amount },
|
data,
|
||||||
method: "post"
|
method: "post"
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
return { error: "An error occured while submitting the form." };
|
return { error: "An error occured while submitting the form." };
|
||||||
|
|
|
@ -10,10 +10,12 @@ export default Discourse.Route.extend({
|
||||||
|
|
||||||
return ajax("/patrons/patrons", {
|
return ajax("/patrons/patrons", {
|
||||||
method: "get"
|
method: "get"
|
||||||
}).then((result) => {
|
})
|
||||||
user.set('email', result.email);
|
.then(result => {
|
||||||
|
user.set("email", result.email);
|
||||||
return user;
|
return user;
|
||||||
}).catch(() => {
|
})
|
||||||
|
.catch(() => {
|
||||||
return user;
|
return user;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="value">
|
<div class="value">
|
||||||
{{input type="email" value=billing.email}}
|
{{input type="email" value=billing.email}}
|
||||||
<div class="desc">{{i18n 'discourse_patrons.payment.email_info'}}</div>
|
<div class="desc">{{i18n 'discourse_patrons.payment.receipt_info'}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="display-row">
|
<div class="display-row">
|
||||||
|
|
|
@ -19,6 +19,7 @@ en:
|
||||||
success: Thank you!
|
success: Thank you!
|
||||||
payment:
|
payment:
|
||||||
optional: Optional
|
optional: Optional
|
||||||
|
receipt_info: A receipt is sent to this email address
|
||||||
your_information: Your information
|
your_information: Your information
|
||||||
payment_information: Payment information
|
payment_information: Payment information
|
||||||
payment_confirmation: Confirm information
|
payment_confirmation: Confirm information
|
||||||
|
@ -26,7 +27,6 @@ en:
|
||||||
billing:
|
billing:
|
||||||
name: Full name
|
name: Full name
|
||||||
email: Email
|
email: Email
|
||||||
email_info: A receipt is sent to this email address
|
|
||||||
phone: Phone Number
|
phone: Phone Number
|
||||||
confirmation:
|
confirmation:
|
||||||
amount: Amount
|
amount: Amount
|
||||||
|
|
|
@ -57,6 +57,12 @@ module DiscoursePatrons
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'has a receipt email' do
|
||||||
|
::Stripe::PaymentIntent.expects(:create).with(has_entry(:receipt_email, 'hello@example.com'))
|
||||||
|
post :create, params: { receiptEmail: 'hello@example.com' }, format: :json
|
||||||
|
expect(response).to have_http_status(200)
|
||||||
|
end
|
||||||
|
|
||||||
it 'has a description' do
|
it 'has a description' do
|
||||||
SiteSetting.stubs(:discourse_patrons_payment_description).returns('hello-world')
|
SiteSetting.stubs(:discourse_patrons_payment_description).returns('hello-world')
|
||||||
::Stripe::PaymentIntent.expects(:create).with(has_entry(:description, 'hello-world'))
|
::Stripe::PaymentIntent.expects(:create).with(has_entry(:description, 'hello-world'))
|
||||||
|
|
Loading…
Reference in New Issue