diff --git a/README.md b/README.md index b3913b8..443caa9 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,17 @@ 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. + +## Known issues + +* CSS is mucked up in Safari and probably Firefox too. +* The phone number isn't sent to Stripe + +## TODOs + +* Add a description/message +* Format the currency +* Check against other themes +* Add billing info to confirm dialog +* Validate the model properly. Not in the stripe component +* Show the transaction on the thank you page. diff --git a/assets/javascripts/discourse/components/stripe-card.js.es6 b/assets/javascripts/discourse/components/stripe-card.js.es6 index 5b7a3ad..59e8b8d 100644 --- a/assets/javascripts/discourse/components/stripe-card.js.es6 +++ b/assets/javascripts/discourse/components/stripe-card.js.es6 @@ -41,9 +41,21 @@ export default Ember.Component.extend({ }); }, + validateBilling() { + const billing = this.get('billing'); + const deleteEmpty = (key) => { + if(Ember.isEmpty(billing.get(key))) { + billing.set(key, undefined); + } + } + ['name', 'phone', 'email'].forEach((key) => deleteEmpty(key)); + }, + actions: { submitStripeCard() { - const paymentOptions = { billing_details: this.get("billing") }; + this.validateBilling(); + + const paymentOptions = { billing_details: this.get('billing') }; this.stripe.createPaymentMethod("card", this.card, paymentOptions).then( result => { diff --git a/assets/javascripts/discourse/templates/components/donation-form.hbs b/assets/javascripts/discourse/templates/components/donation-form.hbs index ab5e592..a34e185 100644 --- a/assets/javascripts/discourse/templates/components/donation-form.hbs +++ b/assets/javascripts/discourse/templates/components/donation-form.hbs @@ -34,13 +34,14 @@