From e8811df51a5b52feb701af72165199b7b18c7296 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 10 Nov 2021 14:04:07 +0100 Subject: [PATCH 1/3] New translations app.admin.en.yml (Norwegian) --- config/locales/app.admin.no.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/config/locales/app.admin.no.yml b/config/locales/app.admin.no.yml index 858780308..38ea3eefe 100644 --- a/config/locales/app.admin.no.yml +++ b/config/locales/app.admin.no.yml @@ -507,8 +507,8 @@ this_will_never_be_added_when_a_refund_notice_is_present: "Dette vil aldri bli lagt til når det foreligger en refusjonsvarsel." eg_XVL_will_add_VL_to_the_invoices_settled_by_card: '(eks. X[/VL] vil legge til "/VL" i fakturaene som gjøres opp elektronisk)' add_a_notice_regarding_refunds_only_if_the_invoice_is_concerned: "Legg til et varsel om det elektroniske salget om en faktura er klar." - this_will_never_be_added_when_an_online_sales_notice_is_present: "This will never be added when an online sales notice is present." - eg_RA_will_add_A_to_the_refund_invoices: '(eg. R[/A] will add "/A" to the refund invoices)' + this_will_never_be_added_when_an_online_sales_notice_is_present: "Dette vil aldri bli lagt til når en nettbasert salgsvarsel er tilstede." + eg_RA_will_add_A_to_the_refund_invoices: '(eks. R[/A] vil legge "/A" til refusjonsfakturaene)' add_a_notice_regarding_payment_schedule: "Legg til en melding om betalingsplaner, kun for berørte dokumenter." this_will_never_be_added_with_other_notices: "Dette vil aldri bli lagt til når det foreligger andre notater." eg_SE_to_schedules: '(eg. S[/E] will add "/E" to the payment schedules)' @@ -866,7 +866,7 @@ expires_at: "Utløper:" price_: "Pris:" offer_free_days: "Tilby gratis dager" - renew_subscription: "Renew the subscription" + renew_subscription: "Forny abonnementet" user_has_no_current_subscription: "Brukeren har ikke noe gjeldende medlemskap." subscribe_to_a_plan: "Abonner på et medlemskap" trainings: "Opplæringer/kurs" @@ -901,13 +901,13 @@ cannot_extend_own_subscription: "Du kan ikke utvide ditt eget medlemskap. Be en annen leder eller en administrator om å utvide abonnementet." #extend a subscription for free free_extend_modal: - extend_subscription: "Extend the subscription" - offer_free_days_infos: "You are about to extend the user's subscription by offering him free additional days." - credits_will_remain_unchanged: "The balance of free credits (training / machines / spaces) of the user will remain unchanged." - current_expiration: "Current subscription will expire at:" + extend_subscription: "Forleng abonnementet" + offer_free_days_infos: "Du er i ferd med å forlenge brukerens abonnement ved å tilby ham gratis ekstra dager." + credits_will_remain_unchanged: "Brukernes gjenværende kreditter (opplæring / maskiner/lokaler) vil ikke bli endret." + current_expiration: "Gjeldende abonnement vil utløpe på:" DATE_TIME: "{DATE} {TIME}" - new_expiration_date: "New expiration date:" - number_of_free_days: "Number of free days:" + new_expiration_date: "Ny utløpsdato:" + number_of_free_days: "Antall gratis dager:" extend: "Extend" extend_success: "The subscription was successfully extended for free" #renew a subscription From 0f57e1081f3704caa05e60a5193f6e408c294d28 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 10 Nov 2021 17:06:21 +0100 Subject: [PATCH 2/3] [bug] unable to create a plan --- CHANGELOG.md | 3 ++ Procfile | 2 +- app/models/plan.rb | 2 +- test/integration/plans/create_plan_test.rb | 47 ++++++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 test/integration/plans/create_plan_test.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index f293f98dc..dfc0c116e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog Fab-manager +- Added an automated test on the plan creation endpoint +- Fix a bug: unable to create a plan + ## v5.1.11 2021 October 22 - Refactored subscription new/renew/free extend interfaces and API diff --git a/Procfile b/Procfile index e68a73938..bbda6f44f 100644 --- a/Procfile +++ b/Procfile @@ -1,4 +1,4 @@ -web: bundle exec rails server puma -p $PORT +#web: bundle exec rails server puma -p $PORT worker: bundle exec sidekiq -C ./config/sidekiq.yml wp-client: bin/webpack-dev-server wp-server: SERVER_BUNDLE_ONLY=yes bin/webpack --watch diff --git a/app/models/plan.rb b/app/models/plan.rb index 18cae24c8..562192ac6 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -132,6 +132,6 @@ class Plan < ApplicationRecord end def update_gateway_product - PaymentGatewayService.new.create_or_update_product(Plan.base_name, id) + PaymentGatewayService.new.create_or_update_product(Plan.name, id) end end diff --git a/test/integration/plans/create_plan_test.rb b/test/integration/plans/create_plan_test.rb new file mode 100644 index 000000000..19bacff99 --- /dev/null +++ b/test/integration/plans/create_plan_test.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +require 'test_helper' + +class CreatePlanTest < ActionDispatch::IntegrationTest + setup do + admin = User.with_role(:admin).first + login_as(admin, scope: :user) + end + + test 'create a plan' do + plans_count = Plan.count + + post '/api/plans', + params: { + plan: { + base_name: 'Abonnement test', + type: 'Plan', + group_id: 1, + plan_category_id: nil, + interval: 'week', + interval_count: 2, + amount: 10, + ui_weight: 0, + is_rolling: true, + monthly_payment: false, + description: 'lorem ipsum dolor sit amet', + partner_id: '', + plan_file_attributes: { + id: nil, + _destroy: nil, + attachment: nil + } + } + }.to_json, + headers: default_headers + + # Check response format & status + assert_equal 201, response.status, response.body + assert_equal Mime[:json], response.content_type + + # Check the created plan + plan = json_response(response.body) + assert_equal Plan.last.id, plan[:id] + assert_equal plans_count + 1, Plan.count + end +end From d426870b1cc7720c43fa81d67d14745670499c63 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 10 Nov 2021 17:08:29 +0100 Subject: [PATCH 3/3] Version 5.1.12 --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfc0c116e..d9a464ef1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog Fab-manager +## v5.1.12 2021 November 10 + - Added an automated test on the plan creation endpoint - Fix a bug: unable to create a plan diff --git a/package.json b/package.json index c967a2f55..af6a3b3a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fab-manager", - "version": "5.1.11", + "version": "5.1.12", "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",