mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 06:26:15 +02:00
added directo handler for interaction with billing system
This commit is contained in:
parent
d9696014ff
commit
0259dd7fec
8 changed files with 286 additions and 1 deletions
40
test/integration/eis_billing/directo_response_test.rb
Normal file
40
test/integration/eis_billing/directo_response_test.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DirectoResponseTest < ApplicationIntegrationTest
|
||||
setup do
|
||||
sign_in users(:api_bestnames)
|
||||
|
||||
@invoice = invoices(:one)
|
||||
@response_xml = '<?xml version="1.0" encoding="UTF-8"?><results><Result Type="0" Desc="OK" docid="1" doctype="ARVE" submit="Invoices"/></results>'
|
||||
end
|
||||
|
||||
def test_should_created_directo_instance
|
||||
directo_response_from_billing = {
|
||||
response: 'this is response',
|
||||
xml_data: @response_xml,
|
||||
month: true
|
||||
}
|
||||
|
||||
assert_difference 'Directo.count', 1 do
|
||||
put eis_billing_directo_response_path, params: JSON.parse(directo_response_from_billing.to_json),
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
end
|
||||
|
||||
def test_should_update_related_invoice
|
||||
directo_response_from_billing = {
|
||||
response: 'this is response',
|
||||
xml_data: @response_xml
|
||||
}
|
||||
|
||||
refute @invoice.in_directo
|
||||
|
||||
assert_difference 'Directo.count', 1 do
|
||||
put eis_billing_directo_response_path, params: JSON.parse(directo_response_from_billing.to_json),
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
|
||||
@invoice.reload
|
||||
assert @invoice.in_directo
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue