diff --git a/app/controllers/admin/registrars_controller.rb b/app/controllers/admin/registrars_controller.rb index 1e9df288b..17a618273 100644 --- a/app/controllers/admin/registrars_controller.rb +++ b/app/controllers/admin/registrars_controller.rb @@ -73,6 +73,7 @@ module Admin :vat_rate, :accounting_customer_code, :billing_email, + :iban, :language) end diff --git a/app/views/admin/registrars/form/_billing.html.erb b/app/views/admin/registrars/form/_billing.html.erb index e9f9b5c88..fa1583ca8 100644 --- a/app/views/admin/registrars/form/_billing.html.erb +++ b/app/views/admin/registrars/form/_billing.html.erb @@ -67,6 +67,15 @@ <% end %> + +
+
+ <%= f.label :iban %> +
+
+ <%= f.text_field :iban, class: 'form-control' %> +
+
diff --git a/app/views/admin/registrars/show/_billing.html.erb b/app/views/admin/registrars/show/_billing.html.erb index 7ed9826ad..da79b9074 100644 --- a/app/views/admin/registrars/show/_billing.html.erb +++ b/app/views/admin/registrars/show/_billing.html.erb @@ -19,6 +19,9 @@
<%= Registrar.human_attribute_name :reference_no %>
<%= registrar.reference_no %>
+ +
<%= Registrar.human_attribute_name :iban %>
+
<%= registrar.iban %>
\ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 066f569e1..4bb40ed5d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -692,3 +692,4 @@ en: ipv4: IPv4 ipv6: IPv6 reference_no: Reference number + iban: IBAN diff --git a/db/migrate/20190515113153_add_registrars_iban.rb b/db/migrate/20190515113153_add_registrars_iban.rb new file mode 100644 index 000000000..2f1e7b50f --- /dev/null +++ b/db/migrate/20190515113153_add_registrars_iban.rb @@ -0,0 +1,5 @@ +class AddRegistrarsIban < ActiveRecord::Migration + def change + add_column :registrars, :iban, :string + end +end diff --git a/db/structure.sql b/db/structure.sql index bec0a6f55..73841bc84 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2200,7 +2200,8 @@ CREATE TABLE public.registrars ( reference_no character varying NOT NULL, test_registrar boolean DEFAULT false, language character varying NOT NULL, - vat_rate numeric(4,3) + vat_rate numeric(4,3), + iban character varying ); @@ -3987,7 +3988,7 @@ CREATE INDEX index_users_on_registrar_id ON public.users USING btree (registrar_ -- --- Name: index_versions_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_versions_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_versions_on_item_type_and_item_id ON public.versions USING btree (item_type, item_id); @@ -4966,5 +4967,7 @@ INSERT INTO schema_migrations (version) VALUES ('20190510090240'); INSERT INTO schema_migrations (version) VALUES ('20190510102549'); +INSERT INTO schema_migrations (version) VALUES ('20190515113153'); + INSERT INTO schema_migrations (version) VALUES ('20190520093231'); diff --git a/test/fixtures/registrars.yml b/test/fixtures/registrars.yml index 2f5ed74cf..b0ae6d280 100644 --- a/test/fixtures/registrars.yml +++ b/test/fixtures/registrars.yml @@ -11,6 +11,7 @@ bestnames: billing_email: billing@bestnames.test website: https://bestnames.test reference_no: 13 + iban: GB33BUKB20201555555555 goodnames: name: Good Names diff --git a/test/integration/admin_area/registrars_test.rb b/test/integration/admin_area/registrars_test.rb new file mode 100644 index 000000000..009e7c6d6 --- /dev/null +++ b/test/integration/admin_area/registrars_test.rb @@ -0,0 +1,20 @@ +require 'test_helper' + +class AdminAreaRegistrarsIntegrationTest < ActionDispatch::IntegrationTest + include Devise::Test::IntegrationHelpers + + setup do + @registrar = registrars(:bestnames) + sign_in users(:admin) + end + + def test_updates_registrar_optional_attributes + new_iban = 'GB94BARC10201530093459' + assert_not_equal new_iban, @registrar.iban + + patch admin_registrar_path(@registrar), registrar: { iban: new_iban } + @registrar.reload + + assert_equal new_iban, @registrar.iban + end +end \ No newline at end of file