Merge pull request #2433 from internetee/remove-feature-toggle

remove eis-billing feature toggle
This commit is contained in:
Timo Võhmar 2022-09-13 14:58:10 +03:00 committed by GitHub
commit f77883b266
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 459 additions and 583 deletions

View file

@ -58,39 +58,37 @@ class AdminAreaBankStatementTest < ApplicationSystemTestCase
end
def test_can_bind_statement_transactions
if Feature.billing_system_integrated?
invoice_n = Invoice.order(number: :desc).last.number
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator")
.to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {})
registrar = registrars(:bestnames)
invoice_n = Invoice.order(number: :desc).last.number
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator")
.to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {})
registrar = registrars(:bestnames)
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_generator")
.to_return(status: 200, body: "{\"everypay_link\":\"http://link.test\"}", headers: {})
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_generator")
.to_return(status: 200, body: "{\"everypay_link\":\"http://link.test\"}", headers: {})
stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response")
.to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {})
stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response")
.to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {})
stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice")
.to_return(status: 200, body: "", headers: {})
stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice")
.to_return(status: 200, body: "", headers: {})
registrar.issue_prepayment_invoice(500)
invoice = registrar.invoices.last
registrar.issue_prepayment_invoice(500)
invoice = registrar.invoices.last
create_bank_statement
click_link_or_button 'Add'
assert_text 'Create bank transaction'
create_bank_statement
click_link_or_button 'Add'
assert_text 'Create bank transaction'
fill_in 'Description', with: "Invoice with id #{invoice.number}"
fill_in 'Reference number', with: invoice.reference_no
fill_in 'Sum', with: invoice.total
fill_in 'Paid at', with: Time.zone.today.to_s
click_link_or_button 'Save'
fill_in 'Description', with: "Invoice with id #{invoice.number}"
fill_in 'Reference number', with: invoice.reference_no
fill_in 'Sum', with: invoice.total
fill_in 'Paid at', with: Time.zone.today.to_s
click_link_or_button 'Save'
click_link_or_button 'Back to bank statement'
click_link_or_button 'Bind invoices'
click_link_or_button 'Back to bank statement'
click_link_or_button 'Bind invoices'
assert_text 'Invoices were fully binded'
end
assert_text 'Invoices were fully binded'
end
def create_bank_statement

View file

@ -14,30 +14,28 @@ class AdminRegistrarsSystemTest < ApplicationSystemTestCase
end
def test_creates_new_registrar
if Feature.billing_system_integrated?
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/reference_number_generator").
to_return(status: 200, body: "{\"reference_number\":\"12332\"}", headers: {})
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/reference_number_generator").
to_return(status: 200, body: "{\"reference_number\":\"12332\"}", headers: {})
assert_nil Registrar.find_by(name: 'Acme Ltd')
assert_nil Registrar.find_by(name: 'Acme Ltd')
visit admin_registrars_path
click_on 'New registrar'
visit admin_registrars_path
click_on 'New registrar'
fill_in 'Name', with: 'Acme Ltd'
fill_in 'Reg no', with: '1234'
fill_in 'Contact e-mail', with: 'any@acme.test'
fill_in 'Street', with: 'any'
fill_in 'City', with: 'any'
fill_in 'State / Province', with: 'any'
fill_in 'Zip', with: 'any'
select 'United States', from: 'Country'
fill_in 'Accounting customer code', with: 'test'
fill_in 'Code', with: 'test'
click_on 'Create registrar'
fill_in 'Name', with: 'Acme Ltd'
fill_in 'Reg no', with: '1234'
fill_in 'Contact e-mail', with: 'any@acme.test'
fill_in 'Street', with: 'any'
fill_in 'City', with: 'any'
fill_in 'State / Province', with: 'any'
fill_in 'Zip', with: 'any'
select 'United States', from: 'Country'
fill_in 'Accounting customer code', with: 'test'
fill_in 'Code', with: 'test'
click_on 'Create registrar'
assert_text 'Registrar has been successfully created'
assert_text 'Acme Ltd'
end
assert_text 'Registrar has been successfully created'
assert_text 'Acme Ltd'
end
def test_updates_registrar

View file

@ -15,32 +15,30 @@ class BalanceTopUpTest < ApplicationSystemTestCase
end
def test_creates_new_invoice
if Feature.billing_system_integrated?
invoice_n = Invoice.order(number: :desc).last.number
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator").
to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {})
invoice_n = Invoice.order(number: :desc).last.number
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator").
to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {})
stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response")
.to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {})
stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response")
.to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {})
stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice")
.to_return(status: 200, body: "", headers: {})
stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice")
.to_return(status: 200, body: "", headers: {})
Setting.registry_vat_prc = 0.1
Setting.registry_vat_prc = 0.1
visit registrar_invoices_url
click_link_or_button 'Add deposit'
fill_in 'Amount', with: '25.5'
visit registrar_invoices_url
click_link_or_button 'Add deposit'
fill_in 'Amount', with: '25.5'
assert_difference 'Invoice.count' do
click_link_or_button 'Add'
end
invoice = Invoice.last
assert_equal BigDecimal(10), invoice.vat_rate
assert_equal BigDecimal('28.05'), invoice.total
assert_text 'Please pay the following invoice'
assert_difference 'Invoice.count' do
click_link_or_button 'Add'
end
invoice = Invoice.last
assert_equal BigDecimal(10), invoice.vat_rate
assert_equal BigDecimal('28.05'), invoice.total
assert_text 'Please pay the following invoice'
end
end

View file

@ -17,59 +17,55 @@ class NewInvoiceTest < ApplicationSystemTestCase
end
def test_create_new_invoice_with_positive_amount
if Feature.billing_system_integrated?
invoice_n = Invoice.order(number: :desc).last.number
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator").
to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {})
invoice_n = Invoice.order(number: :desc).last.number
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator").
to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {})
stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response").
to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {})
stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response").
to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {})
stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice").
to_return(status: 200, body: "", headers: {})
stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice").
to_return(status: 200, body: "", headers: {})
visit registrar_invoices_path
click_link_or_button 'Add deposit'
fill_in 'Amount', with: '200.00'
fill_in 'Description', with: 'My first invoice'
visit registrar_invoices_path
click_link_or_button 'Add deposit'
fill_in 'Amount', with: '200.00'
fill_in 'Description', with: 'My first invoice'
assert_difference 'Invoice.count', 1 do
click_link_or_button 'Add'
end
assert_text 'Please pay the following invoice'
assert_text "Invoice no. #{invoice_n + 3}"
assert_text 'Subtotal 200,00 €'
assert_text 'Pay invoice'
assert_difference 'Invoice.count', 1 do
click_link_or_button 'Add'
end
assert_text 'Please pay the following invoice'
assert_text "Invoice no. #{invoice_n + 3}"
assert_text 'Subtotal 200,00 €'
assert_text 'Pay invoice'
end
def test_create_new_invoice_with_comma_in_number
if Feature.billing_system_integrated?
invoice_n = Invoice.order(number: :desc).last.number
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator").
to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {})
invoice_n = Invoice.order(number: :desc).last.number
stub_request(:post, "https://eis_billing_system:3000/api/v1/invoice_generator/invoice_number_generator").
to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}", headers: {})
stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response").
to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {})
stub_request(:put, "https://registry:3000/eis_billing/e_invoice_response").
to_return(status: 200, body: "{\"invoice_number\":\"#{invoice_n + 3}\"}, {\"date\":\"#{Time.zone.now-10.minutes}\"}", headers: {})
stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice").
to_return(status: 200, body: "", headers: {})
stub_request(:post, "https://eis_billing_system:3000/api/v1/e_invoice/e_invoice").
to_return(status: 200, body: "", headers: {})
visit registrar_invoices_path
click_link_or_button 'Add deposit'
fill_in 'Amount', with: '200,00'
fill_in 'Description', with: 'My first invoice'
visit registrar_invoices_path
click_link_or_button 'Add deposit'
fill_in 'Amount', with: '200,00'
fill_in 'Description', with: 'My first invoice'
assert_difference 'Invoice.count', 1 do
click_link_or_button 'Add'
end
assert_text 'Please pay the following invoice'
assert_text "Invoice no. #{invoice_n + 3}"
assert_text 'Subtotal 200,00 €'
assert_text 'Pay invoice'
assert_difference 'Invoice.count', 1 do
click_link_or_button 'Add'
end
assert_text 'Please pay the following invoice'
assert_text "Invoice no. #{invoice_n + 3}"
assert_text 'Subtotal 200,00 €'
assert_text 'Pay invoice'
end
def test_create_new_invoice_fails_when_amount_is_0