Add some billing details

This commit is contained in:
Rimian Perkins 2019-09-12 15:13:08 +10:00
parent a87fcae149
commit 9b69c58be4
8 changed files with 63 additions and 6 deletions

View File

@ -4,7 +4,7 @@
Accept payments from visitors to your [Discourse](https://www.discourse.org/) application. Integrates with [Stripe](https://stripe.com).
This is a newer version of https://github.com/rimian/discourse-donations. Many thanks to Chris Beach and Angus McLeod who helped on that project.
This is a newer version of https://github.com/rimian/discourse-donations.
## Installation
@ -28,3 +28,7 @@ Test with these credit card numbers:
## Warranty
This software comes without warranties or conditions of any kind.
## Credits
Many thanks to Chris Beach and Angus McLeod who helped on the previous version of this plugin.

View File

@ -43,7 +43,9 @@ export default Ember.Component.extend({
actions: {
submitStripeCard() {
this.stripe.createPaymentMethod("card", this.card).then(
const paymentOptions = { billing_details: this.get("billing") };
this.stripe.createPaymentMethod("card", this.card, paymentOptions).then(
result => {
if (result.error) {
this.set("cardError", result.error.message);

View File

@ -0,0 +1,9 @@
import DiscourseURL from "discourse/lib/url";
export default Ember.Controller.extend({
actions: {
goBack() {
return DiscourseURL.redirectTo("/patrons");
}
}
});

View File

@ -1 +1,9 @@
export default Discourse.Route.extend({});
export default Discourse.Route.extend({
model() {
return Ember.Object.create({
name: "",
email: "",
phone: ""
});
}
});

View File

@ -44,13 +44,40 @@
{{combo-box valueAttribute="value" content=amounts value=amount}}
</div>
</div>
<div class="display-row">
<div class="field">
{{i18n 'discourse_patrons.billing.name'}}
</div>
<div class="value">
{{input value=billing.name}}
</div>
</div>
<div class="display-row">
<div class="field">
{{i18n 'discourse_patrons.billing.email'}}
</div>
<div class="value">
{{input value=billing.email}}
</div>
</div>
<div class="display-row">
<div class="field">
{{i18n 'discourse_patrons.billing.phone'}}
</div>
<div class="value">
{{input value=billing.phone}}
</div>
</div>
</div>
</div>
<div class="section-column">
<div style>
{{stripe-card
amount=amount
currency=currency
billing=billing
handleConfirmStripeCard=(action "handleConfirmStripeCard")
}}
</div>

View File

@ -7,6 +7,7 @@
<div class="donations-page-payment">
{{donation-form
billing=model
paymentSuccessHandler=(action "paymentSuccessHandler")
stripePaymentHandler=(action "stripePaymentHandler")
}}

View File

@ -5,3 +5,7 @@
<div class="donations-page-description">
{{cook-text siteSettings.discourse_patrons_success_page}}
</div>
{{#d-button action="goBack" class="btn btn-primary"}}
{{i18n 'discourse_patrons.button.success'}}
{{/d-button}}

View File

@ -21,9 +21,11 @@ en:
payment_information: Credit card information
submit: Make payment $
confirm: Confirm payment $
invoice: "invoice"
invoice_prefix: "You gave"
receipt: "Receipt sent to {{email}}."
billing:
name: Full name
email: Email
confirmation:
amount: Amount $
last4: Card number
buttons:
success: Go back