diff --git a/app/models/directo.rb b/app/models/directo.rb
index 62cf43804..e0301e3dc 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 ad478443d..5dcf9ba78 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_prc, presence: true
before_create :set_invoice_number, :check_vat
diff --git a/app/models/registrar.rb b/app/models/registrar.rb
index 6a10983d2..3c8300eb5 100644
--- a/app/models/registrar.rb
+++ b/app/models/registrar.rb
@@ -76,7 +76,6 @@ class Registrar < ActiveRecord::Base
# rubocop:disable Metrics/AbcSize
def issue_prepayment_invoice(amount, description = nil)
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 a9257ffa3..65a686a97 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,
@@ -4679,3 +4678,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180306183549');
INSERT INTO schema_migrations (version) VALUES ('20180308123240');
+INSERT INTO schema_migrations (version) VALUES ('20180310142630');
+
diff --git a/doc/models_complete.svg b/doc/models_complete.svg
index 296d20c67..1cbefea90 100644
--- a/doc/models_complete.svg
+++ b/doc/models_complete.svg
@@ -1614,7 +1614,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 7eeed32b9..3bd0c5f08 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 49d15310f..95b603f85 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 7a1c85dd1..cc9f829d0 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