Include amount on form and increase logging

This commit is contained in:
Chris Beach 2017-10-16 12:58:50 +01:00
parent 18196c0a0a
commit 238f4c4eb4
2 changed files with 8 additions and 2 deletions

View File

@ -36,8 +36,8 @@ module DiscourseDonations
err = e.json_body[:error]
output['messages'] << "There was an error (#{err[:type]})."
#output['messages'] << "Error code: #{err[:code]}" if err[:code]
#output['messages'] << "Decline code: #{err[:decline_code]}" if err[:decline_code]
output['messages'] << "Error code: #{err[:code]}" if err[:code]
output['messages'] << "Decline code: #{err[:decline_code]}" if err[:decline_code]
output['messages'] << "Message: #{err[:message]}" if err[:message]
render(:json => output) and return

View File

@ -33,6 +33,9 @@ function insertCheckout(state, tagInfo, content, siteSettings) {
let token = state.push('stripe-checkout-form-open', 'form', 1);
token.attrs = [['method', 'POST'], ['action', '/charges']];
token = state.push('stripe-checkout-form-amount', 'input', 0);
token.attrs = [['type', 'hidden'], ['name', 'amount'], ['value', tagInfo.attrs['amount']]];
token = state.push('stripe-checkout-script-open', 'script', 0);
token.attrs = [
['src', 'https://checkout.stripe.com/checkout.js'],
@ -67,6 +70,9 @@ export function setup(helper) {
'div[class]',
'form[method]',
'form[action]',
'input[type]',
'input[name]',
'input[value]',
'script[class]',
'script[src]',
'script[data-key]',