diff --git a/app/models/directo.rb b/app/models/directo.rb
index 4a5f00dd9..f3a506ff3 100644
--- a/app/models/directo.rb
+++ b/app/models/directo.rb
@@ -3,7 +3,7 @@ class Directo < ActiveRecord::Base
belongs_to :item, polymorphic: true
def self.send_receipts
- new_trans = Invoice.where(invoice_type: "DEB", in_directo: false).where(cancelled_at: nil)
+ new_trans = Invoice.where(in_directo: false).where(cancelled_at: nil)
total = new_trans.count
counter = 0
Rails.logger.info("[DIRECTO] Will try to send #{total} invoices")
diff --git a/app/models/invoice.rb b/app/models/invoice.rb
index 90fa380e1..dfdafee6d 100644
--- a/app/models/invoice.rb
+++ b/app/models/invoice.rb
@@ -27,7 +27,7 @@ class Invoice < ActiveRecord::Base
attr_accessor :billing_email
validates :billing_email, email_format: { message: :invalid }, allow_blank: true
- validates :invoice_type, :due_date, :currency, :seller_name,
+ validates :due_date, :currency, :seller_name,
:seller_iban, :buyer_name, :invoice_items, :vat_rate, presence: true
validates :vat_rate, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 99 }, allow_nil: true
diff --git a/app/models/registrar.rb b/app/models/registrar.rb
index 1f1bfaea9..0c7559ce8 100644
--- a/app/models/registrar.rb
+++ b/app/models/registrar.rb
@@ -67,7 +67,6 @@ class Registrar < ActiveRecord::Base
end
invoices.create(
- invoice_type: 'DEB',
due_date: (Time.zone.now.to_date + Setting.days_to_keep_invoices_active.days).end_of_day,
payment_term: 'prepayment',
description: description,
diff --git a/db/migrate/20180310142630_remove_invoices_invoice_type.rb b/db/migrate/20180310142630_remove_invoices_invoice_type.rb
new file mode 100644
index 000000000..f8cddadf9
--- /dev/null
+++ b/db/migrate/20180310142630_remove_invoices_invoice_type.rb
@@ -0,0 +1,5 @@
+class RemoveInvoicesInvoiceType < ActiveRecord::Migration
+ def change
+ remove_column :invoices, :invoice_type, :string
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index 659b79804..70cb7e5b2 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -998,7 +998,6 @@ CREATE TABLE invoices (
id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
- invoice_type character varying NOT NULL,
due_date timestamp without time zone NOT NULL,
payment_term character varying,
currency character varying NOT NULL,
@@ -3244,7 +3243,7 @@ ALTER TABLE ONLY settings
--
--- Name: unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+-- Name: unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY registrars
@@ -3260,7 +3259,7 @@ ALTER TABLE ONLY contacts
--
--- Name: unique_name; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+-- Name: unique_name; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY registrars
@@ -3268,7 +3267,7 @@ ALTER TABLE ONLY registrars
--
--- Name: unique_reference_no; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+-- Name: unique_reference_no; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY registrars
@@ -3276,7 +3275,7 @@ ALTER TABLE ONLY registrars
--
--- Name: unique_reg_no; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+-- Name: unique_reg_no; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY registrars
@@ -4713,3 +4712,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180309053921');
INSERT INTO schema_migrations (version) VALUES ('20180309054510');
+INSERT INTO schema_migrations (version) VALUES ('20180310142630');
+
diff --git a/doc/models_complete.svg b/doc/models_complete.svg
index 0bbe63207..b3194a90a 100644
--- a/doc/models_complete.svg
+++ b/doc/models_complete.svg
@@ -1613,7 +1613,6 @@
id :integer
created_at :datetime
updated_at :datetime
-invoice_type :string
due_date :datetime
payment_term :string
currency :string
diff --git a/spec/factories/invoice.rb b/spec/factories/invoice.rb
index 0ea81d5e4..42ac54812 100644
--- a/spec/factories/invoice.rb
+++ b/spec/factories/invoice.rb
@@ -3,7 +3,6 @@ FactoryBot.define do
buyer_name 'Registrar 1'
currency { 'EUR' }
due_date { Time.zone.now.to_date + 1.day }
- invoice_type 'DEB'
seller_iban { '123' }
seller_name { 'EIS' }
seller_city { 'Tallinn' }
diff --git a/spec/models/invoice_spec.rb b/spec/models/invoice_spec.rb
index eb8866d07..d6cdc2725 100644
--- a/spec/models/invoice_spec.rb
+++ b/spec/models/invoice_spec.rb
@@ -13,7 +13,6 @@ describe Invoice do
"Currency is missing",
"Due date is missing",
"Invoice items is missing",
- "Invoice type is missing",
"Seller iban is missing",
"Seller name is missing",
"Vat prc is missing"
diff --git a/test/fixtures/invoices.yml b/test/fixtures/invoices.yml
index bdd8ea033..6fbfa282b 100644
--- a/test/fixtures/invoices.yml
+++ b/test/fixtures/invoices.yml
@@ -1,7 +1,6 @@
DEFAULTS: &DEFAULTS
created_at: <%= Date.parse '2010-07-05' %>
due_date: <%= Date.parse '2010-07-06' %>
- invoice_type: DEB
currency: EUR
seller_name: John Doe
seller_iban: 1234
diff --git a/test/integration/registrar/billing/balance_top_up_test.rb b/test/integration/registrar/billing/balance_top_up_test.rb
new file mode 100644
index 000000000..c4dd1cf5d
--- /dev/null
+++ b/test/integration/registrar/billing/balance_top_up_test.rb
@@ -0,0 +1,16 @@
+require 'test_helper'
+
+class BalanceTopUpTest < ActionDispatch::IntegrationTest
+ def setup
+ login_as users(:api_bestnames)
+ end
+
+ def test_registrar_balance_top_up
+ visit registrar_invoices_url
+ click_link_or_button 'Add deposit'
+ fill_in 'Amount', with: 100
+ click_link_or_button 'Add'
+
+ assert_text 'Please pay the following invoice'
+ end
+end