diff --git a/Gemfile b/Gemfile index 3c657889d..178b0f077 100644 --- a/Gemfile +++ b/Gemfile @@ -99,6 +99,7 @@ gem 'aasm' gem 'sidekiq', '>= 6.0.7' # Recurring jobs for Sidekiq gem 'sidekiq-cron' +gem 'sidekiq-unique-jobs', '~> 6.0.22' gem 'stripe', '5.1.1' diff --git a/Gemfile.lock b/Gemfile.lock index fec4b3363..e873d50d9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -389,6 +389,10 @@ GEM sidekiq-cron (1.1.0) fugit (~> 1.1) sidekiq (>= 4.2.1) + sidekiq-unique-jobs (6.0.22) + concurrent-ruby (~> 1.0, >= 1.0.5) + sidekiq (>= 4.0, < 7.0) + thor (~> 0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -412,7 +416,7 @@ GEM ffi term-ansicolor (1.7.1) tins (~> 1.0) - thor (1.0.1) + thor (0.20.3) thread_safe (0.3.6) tilt (2.0.10) tins (1.24.1) @@ -517,6 +521,7 @@ DEPENDENCIES sha3 sidekiq (>= 6.0.7) sidekiq-cron + sidekiq-unique-jobs (~> 6.0.22) spring spring-watcher-listen (~> 2.0.0) stripe (= 5.1.1) diff --git a/app/assets/javascripts/controllers/admin/invoices.js.erb b/app/assets/javascripts/controllers/admin/invoices.js.erb index f9932c812..ce8c9667a 100644 --- a/app/assets/javascripts/controllers/admin/invoices.js.erb +++ b/app/assets/javascripts/controllers/admin/invoices.js.erb @@ -24,6 +24,9 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I // number of invoices loaded each time we click on 'load more...' const INVOICES_PER_PAGE = 20; + // fake stripe secret key + const STRIPE_SK_HIDDEN = 'sk_test_hidden-hidden-hidden-hid'; + /* PUBLIC SCOPE */ // default active tab @@ -173,7 +176,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I $scope.allSettings = settings; // is the stripe private set? - $scope.stripeSecretKey = stripeSecretKey.isPresent; + $scope.stripeSecretKey = (stripeSecretKey.isPresent ? STRIPE_SK_HIDDEN : ''); // Placeholding date for the invoice creation $scope.today = moment(); @@ -613,8 +616,8 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I Setting.get({ name: 'stripe_public_key' }, function (res) { $scope.allSettings.stripe_public_key = res.setting.value; }) - Setting.isPresent({ name: 'stripe_private_key' }, function (res) { - $scope.stripeSecretKey = res.isPresent; + Setting.isPresent({ name: 'stripe_secret_key' }, function (res) { + $scope.stripeSecretKey = (res.isPresent ? STRIPE_SK_HIDDEN : ''); }) } }) diff --git a/app/assets/javascripts/router.js.erb b/app/assets/javascripts/router.js.erb index 5635bcf90..90cf88eee 100644 --- a/app/assets/javascripts/router.js.erb +++ b/app/assets/javascripts/router.js.erb @@ -841,7 +841,7 @@ angular.module('application.router', ['ui.router']) 'accounting_Event_code', 'accounting_Event_label', 'accounting_Space_code', 'accounting_Space_label', \ 'feature_tour_display', 'online_payment_module', 'stripe_public_key']` }).$promise; }], - stripeSecretKey: ['Setting', function (Setting) { return Setting.isPresent({ name: 'stripe_private_key' }).$promise; }], + stripeSecretKey: ['Setting', function (Setting) { return Setting.isPresent({ name: 'stripe_secret_key' }).$promise; }], invoices: [ 'Invoice', function (Invoice) { return Invoice.list({ query: { number: '', customer: '', date: null, order_by: '-reference', page: 1, size: 20 } diff --git a/app/assets/templates/admin/invoices/payment.html.erb b/app/assets/templates/admin/invoices/payment.html.erb index f4d18dacc..7498bffc4 100644 --- a/app/assets/templates/admin/invoices/payment.html.erb +++ b/app/assets/templates/admin/invoices/payment.html.erb @@ -52,43 +52,45 @@