add settings for currency and hide post code
This commit is contained in:
parent
ba2a6a1e9b
commit
5468cac161
|
@ -11,7 +11,7 @@ Accept donations in Discourse! Integrates with [Stripe](https://stripe.com).
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Visit `/admin/plugins` and configure your private and public keys.
|
Visit `/admin/plugins` and configure.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ module DiscourseDonations
|
||||||
|
|
||||||
def create
|
def create
|
||||||
Stripe.api_key = SiteSetting.discourse_donations_secret_key
|
Stripe.api_key = SiteSetting.discourse_donations_secret_key
|
||||||
|
currency = SiteSetting.discourse_donations_currency
|
||||||
|
|
||||||
customer = Stripe::Customer.create(
|
customer = Stripe::Customer.create(
|
||||||
:email => current_user.email,
|
:email => current_user.email,
|
||||||
|
@ -18,8 +19,9 @@ module DiscourseDonations
|
||||||
:customer => customer.id,
|
:customer => customer.id,
|
||||||
:amount => params[:amount],
|
:amount => params[:amount],
|
||||||
:description => 'Consumer Defender',
|
:description => 'Consumer Defender',
|
||||||
:currency => 'aud'
|
:currency => currency
|
||||||
)
|
)
|
||||||
|
|
||||||
render :json => charge
|
render :json => charge
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,16 +7,19 @@ export default Ember.Component.extend({
|
||||||
amount: null,
|
amount: null,
|
||||||
stripe: null,
|
stripe: null,
|
||||||
transactionInProgress: null,
|
transactionInProgress: null,
|
||||||
|
settings: null,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super();
|
this._super();
|
||||||
var public_key = getRegister(this).lookup('site-settings:main').discourse_donations_public_key
|
this.set('settings', getRegister(this).lookup('site-settings:main'));
|
||||||
this.set('stripe', Stripe(public_key));
|
this.set('stripe', Stripe(this.get('settings').discourse_donations_public_key));
|
||||||
},
|
},
|
||||||
|
|
||||||
card: function() {
|
card: function() {
|
||||||
var elements = this.get('stripe').elements();
|
var elements = this.get('stripe').elements();
|
||||||
return elements.create('card', { hidePostalCode: true });
|
return elements.create('card', {
|
||||||
|
hidePostalCode: this.get('settings').discourse_donations_hide_zip_code
|
||||||
|
});
|
||||||
}.property('stripe'),
|
}.property('stripe'),
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
|
|
@ -5,3 +5,5 @@ en:
|
||||||
amount: Betrag
|
amount: Betrag
|
||||||
card: Kreditkarte oder Bankkarte
|
card: Kreditkarte oder Bankkarte
|
||||||
submit: Spende bezahlen
|
submit: Spende bezahlen
|
||||||
|
currency: Currency
|
||||||
|
hide_zip_code: Hide Zip Code
|
||||||
|
|
|
@ -3,3 +3,5 @@ en:
|
||||||
discourse_donations_enabled: Enable the discourse donations plugin.
|
discourse_donations_enabled: Enable the discourse donations plugin.
|
||||||
discourse_donations_secret_key: Stripe Secret Key
|
discourse_donations_secret_key: Stripe Secret Key
|
||||||
discourse_donations_public_key: Stripe Public Key
|
discourse_donations_public_key: Stripe Public Key
|
||||||
|
discourse_donations_currency: Curency Code
|
||||||
|
discourse_donations_hide_zip_code: Hide Zip Code
|
||||||
|
|
|
@ -6,3 +6,9 @@ plugins:
|
||||||
client: false
|
client: false
|
||||||
discourse_donations_public_key:
|
discourse_donations_public_key:
|
||||||
client: true
|
client: true
|
||||||
|
discourse_donations_currency:
|
||||||
|
client: true
|
||||||
|
default: 'USD'
|
||||||
|
discourse_donations_hide_zip_code:
|
||||||
|
default: true
|
||||||
|
client: true
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# name: discourse-donations
|
# name: discourse-donations
|
||||||
# about: Integrating Discourse with Stripe for donations
|
# about: Integrating Discourse with Stripe for donations
|
||||||
# version: 1.8.2
|
# version: 1.9.0
|
||||||
# url: https://github.com/choiceaustralia/discourse-donations
|
# url: https://github.com/choiceaustralia/discourse-donations
|
||||||
# authors: Rimian Perkins
|
# authors: Rimian Perkins
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue