send a description to the payment intent

This commit is contained in:
Rimian Perkins 2019-09-12 19:17:08 +10:00
parent c6555ccc63
commit 32bf78fa9a
5 changed files with 12 additions and 1 deletions

View File

@ -40,7 +40,6 @@ Many thanks to Chris Beach and Angus McLeod who helped on the previous version o
## TODOs
* Add a description/message
* Confirm dialog CSS isn't the best.
* Check against other themes (works ok with light and dark)
* Validate the model properly. Not in the stripe component

View File

@ -19,6 +19,7 @@ module DiscoursePatrons
currency: SiteSetting.discourse_patrons_currency,
payment_method_types: ['card'],
payment_method: params[:paymentMethodId],
description: SiteSetting.discourse_patrons_payment_description,
confirm: true,
)

View File

@ -8,6 +8,7 @@ en:
discourse_patrons_billing_address: "Collect billing address"
discourse_patrons_payment_page: "Text to be added to enter payments page. Markdown is supported."
discourse_patrons_success_page: "Text to be added to success page. Markdown is supported."
discourse_patrons_payment_description: "This is sent to Stripe and shows in the payment information"
errors:
discourse_patrons_amount_must_be_currency: "Currency amounts must be currencies without dollar symbol (eg 1.50)"
js:

View File

@ -13,6 +13,9 @@ plugins:
discourse_patrons_success_page:
client: true
default: ''
discourse_patrons_payment_description:
client: true
default: ''
discourse_patrons_amounts:
client: true
type: list

View File

@ -42,6 +42,13 @@ module DiscoursePatrons
post :create, params: {}, format: :json
expect(response).to have_http_status(200)
end
it 'has a description' do
SiteSetting.stubs(:discourse_patrons_payment_description).returns('hello-world')
::Stripe::PaymentIntent.expects(:create).with(has_entry(:description, 'hello-world'))
post :create, params: {}, format: :json
expect(response).to have_http_status(200)
end
end
end
end