add the amount as a combo-box
This commit is contained in:
parent
08e0e47d3e
commit
551b578b21
|
@ -2,6 +2,8 @@ import { ajax } from 'discourse/lib/ajax';
|
|||
|
||||
export default Ember.Component.extend({
|
||||
result: null,
|
||||
paymentAmounts: [5, 10],
|
||||
amount: null,
|
||||
stripe: Stripe('pk_test_b8RmhzlL8QPizJRqOrKF3JEV'),
|
||||
|
||||
card: function() {
|
||||
|
@ -28,9 +30,11 @@ export default Ember.Component.extend({
|
|||
else {
|
||||
var params = {
|
||||
stripeToken: result.token.id,
|
||||
amount: 1235
|
||||
amount: self.get('amount') * 100
|
||||
};
|
||||
|
||||
console.log(params);
|
||||
|
||||
ajax('/charges', { data: params, method: 'post' }).then(data => {
|
||||
self.set('result', (data.status == 'succeeded' ? true : null));
|
||||
}).catch((data) => {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<form id="payment-form" class="form-horizontal">
|
||||
|
||||
<div class="control-group" style="width: 550px;">
|
||||
<label class="control-label" for="card-element">{{i18n 'discourse_payments.amount'}}</label>
|
||||
<div class="controls controls-dropdown">
|
||||
{{combo-box valueAttribute="value" content=paymentAmounts value=amount}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" style="width: 550px;">
|
||||
<label class="control-label" for="card-element">{{i18n 'discourse_payments.card'}}</label>
|
||||
<div id="card-element" class="controls"></div>
|
||||
|
@ -8,12 +15,9 @@
|
|||
<div class="control-group save-button">
|
||||
<div class="controls">
|
||||
<button {{action "submitStripeCard"}} class="btn btn-primary">{{i18n 'discourse_payments.submit'}}</button>
|
||||
{{#if result}}
|
||||
<span>{{i18n 'discourse_payments.success'}}</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#if result}}
|
||||
<div class="control-group">
|
||||
<span>{{i18n 'discourse_payments.success'}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
</form>
|
||||
|
|
|
@ -2,6 +2,7 @@ en:
|
|||
js:
|
||||
discourse_payments:
|
||||
title: Donate
|
||||
amount: Amount
|
||||
card: Credit or debit card
|
||||
success: Payment Successful
|
||||
success: Payment Successful!
|
||||
submit: Make Payment
|
||||
|
|
Loading…
Reference in New Issue