diff --git a/README.md b/README.md index cf85a08..c49fb93 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/controllers/patrons_controller.rb b/app/controllers/patrons_controller.rb index 07a5216..548778c 100644 --- a/app/controllers/patrons_controller.rb +++ b/app/controllers/patrons_controller.rb @@ -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, ) diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 7659994..5d5324e 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -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: diff --git a/config/settings.yml b/config/settings.yml index 7ed54bd..b74281a 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -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 diff --git a/spec/controllers/discourse_patrons/patrons_controller_spec.rb b/spec/controllers/discourse_patrons/patrons_controller_spec.rb index 878111f..f55154c 100644 --- a/spec/controllers/discourse_patrons/patrons_controller_spec.rb +++ b/spec/controllers/discourse_patrons/patrons_controller_spec.rb @@ -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