1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-03-21 12:29:03 +01:00

[bug] Unable to access the invoices section if the stripe key was not set or incorrect

This commit is contained in:
Sylvain 2020-07-01 11:48:00 +02:00
parent 58803dbc02
commit 5eae1c74a8
2 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
# Changelog Fab-manager
- Ability to run the upgrade without interactions
- Fix a bug: Unable to access the invoices section if no stripe key was set or incorrect
## v4.5.0 2020 June 30

View File

@ -60,10 +60,12 @@ class API::PaymentsController < API::ApiController
authorize :payment
key = Setting.get('stripe_secret_key')
render json: { status: false } and return unless key
render json: { status: false } and return unless key&.present?
charges = Stripe::Charge.list({ limit: 1 }, { api_key: key })
render json: { status: charges.data.length.positive? }
rescue Stripe::AuthenticationError
render json: { status: false }
end
private