diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c76ca89d..6cfb56143 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog Fab-manager -## Next release +## v4.7.0 2021 February 23 - Payment schedules on subscriptions - Refactored theme builder to use scss files - Updated stripe gem to 5.29.0 @@ -18,6 +18,7 @@ - Fix a security issue: updated carrierwave to 2.1.1 to fix [CVE-2021-21305](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-21305) - [TODO DEPLOY] `rails fablab:maintenance:rebuild_stylesheet` - [TODO DEPLOY] `rails fablab:stripe:set_product_id` +- [TODO DEPLOY] `rails fablab:stripe:sync_coupons` - [TODO DEPLOY] `rails fablab:setup:add_schedule_reference` - [TODO DEPLOY] `rails db:seed` - [TODO DEPLOY] add the `INTL_LOCALE` environment variable (see [doc/environment.md](doc/environment.md#INTL_LOCALE) for configuration details) diff --git a/lib/tasks/fablab/stripe.rake b/lib/tasks/fablab/stripe.rake index 2c605eafe..2396f7c1e 100644 --- a/lib/tasks/fablab/stripe.rake +++ b/lib/tasks/fablab/stripe.rake @@ -43,6 +43,16 @@ namespace :fablab do SyncMembersOnStripeWorker.new.perform puts 'Done' end + desc 'sync coupons to the stripe database' + task sync_coupons: :environment do + puts 'We create all non-existing coupons on stripe. This may take a while, please wait...' + Coupon.all.each do |c| + Stripe::Coupon.retrieve(c.code, api_key: Setting.get('stripe_secret_key')) + rescue Stripe::InvalidRequestError + StripeService.create_stripe_coupon(c.id) + end + puts 'Done' + end desc 'set stp_product_id to all plans/machines/trainings/spaces' task set_product_id: :environment do diff --git a/package.json b/package.json index ea1381eb4..d571de1ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fab-manager", - "version": "4.6.6", + "version": "4.7.0", "description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.", "keywords": [ "fablab",