From 5e7c9c3be2cee5432abf7a52d3105892fdc313cb Mon Sep 17 00:00:00 2001 From: lukaszreszke Date: Sat, 21 Sep 2024 11:39:07 +0200 Subject: [PATCH] Fix vat rates --- rails_application/app/views/products/new.html.erb | 2 +- rails_application/lib/configuration.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/rails_application/app/views/products/new.html.erb b/rails_application/app/views/products/new.html.erb index 4653aa7c..d1d79e80 100644 --- a/rails_application/app/views/products/new.html.erb +++ b/rails_application/app/views/products/new.html.erb @@ -30,7 +30,7 @@ - <%= form.collection_select :vat_rate, Taxes::Configuration.available_vat_rates, :code, :code, {}, class: "mt-1 focus:ring-blue-500 focus:border-blue-500 block shadow-sm sm:text-sm border-gray-300 rounded-md", data: { turbo_permanent: true } %> + <%= form.collection_select :vat_rate, Configuration.available_vat_rates, :code, :code, {}, class: "mt-1 focus:ring-blue-500 focus:border-blue-500 block shadow-sm sm:text-sm border-gray-300 rounded-md", data: { turbo_permanent: true } %> <% if defined?(errors) %> diff --git a/rails_application/lib/configuration.rb b/rails_application/lib/configuration.rb index a04a68f5..e60f5086 100644 --- a/rails_application/lib/configuration.rb +++ b/rails_application/lib/configuration.rb @@ -1,10 +1,19 @@ require_relative "../../infra/lib/infra" +VatRate = Struct.new(:code, :rate) + class Configuration def call(event_store, command_bus) enable_res_infra_event_linking(event_store) end + def self.available_vat_rates + [ + VatRate.new("23", 23), + VatRate.new("10", 10), + ] + end + private def enable_res_infra_event_linking(event_store)