mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Merge branch 'master' into registry-790
This commit is contained in:
commit
c37f162529
82 changed files with 1674 additions and 2976 deletions
124
test/integration/api/domain_contacts_test.rb
Normal file
124
test/integration/api/domain_contacts_test.rb
Normal file
|
@ -0,0 +1,124 @@
|
|||
require 'test_helper'
|
||||
|
||||
class APIDomainContactsTest < ActionDispatch::IntegrationTest
|
||||
def test_replace_all_tech_contacts_of_the_current_registrar
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_nil domains(:shop).tech_contacts.find_by(code: 'william-001')
|
||||
assert domains(:shop).tech_contacts.find_by(code: 'john-001')
|
||||
assert domains(:airport).tech_contacts.find_by(code: 'john-001')
|
||||
end
|
||||
|
||||
def test_skip_discarded_domains
|
||||
domains(:airport).update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert domains(:airport).tech_contacts.find_by(code: 'william-001')
|
||||
end
|
||||
|
||||
def test_return_affected_domains_in_alphabetical_order
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response :ok
|
||||
assert_equal ({ affected_domains: %w[airport.test shop.test],
|
||||
skipped_domains: [] }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
def test_return_skipped_domains_in_alphabetical_order
|
||||
domains(:shop).update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
domains(:airport).update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response :ok
|
||||
assert_equal %w[airport.test shop.test], JSON.parse(response.body,
|
||||
symbolize_names: true)[:skipped_domains]
|
||||
end
|
||||
|
||||
def test_keep_other_tech_contacts_intact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert domains(:shop).tech_contacts.find_by(code: 'acme-ltd-001')
|
||||
end
|
||||
|
||||
def test_keep_admin_contacts_intact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert domains(:airport).admin_contacts.find_by(code: 'william-001')
|
||||
end
|
||||
|
||||
def test_restrict_contacts_to_the_current_registrar
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'jack-001',
|
||||
new_contact_id: 'william-002' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
param: 'current_contact_id',
|
||||
message: 'No such contact: jack-001' } }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
def test_non_existent_current_contact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'non-existent',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
param: 'current_contact_id',
|
||||
message: 'No such contact: non-existent' } }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
def test_non_existent_new_contact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'non-existent' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
param: 'new_contact_id',
|
||||
message: 'No such contact: non-existent' } }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
def test_disallow_invalid_new_contact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'invalid' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
param: 'new_contact_id',
|
||||
message: 'New contact must be valid' } }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
def test_disallow_self_replacement
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'william-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
message: 'New contact ID must be different from current contact ID' } }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def http_auth_key
|
||||
ActionController::HttpAuthentication::Basic.encode_credentials('test_bestnames', 'testtest')
|
||||
end
|
||||
end
|
|
@ -53,7 +53,7 @@ class APIDomainTransfersTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_duplicates_registrant_admin_and_tech_contacts
|
||||
assert_difference -> { @new_registrar.contacts.size }, 2 do
|
||||
assert_difference -> { @new_registrar.contacts.size }, 3 do
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ class EppDomainTransferRequestTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_duplicates_registrant_admin_and_tech_contacts
|
||||
assert_difference -> { @new_registrar.contacts.size }, 2 do
|
||||
assert_difference -> { @new_registrar.contacts.size }, 3 do
|
||||
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,6 +6,7 @@ class BalanceTopUpTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_creates_new_invoice
|
||||
original_vat_prc = Setting.registry_vat_prc
|
||||
Setting.registry_vat_prc = 0.1
|
||||
|
||||
visit registrar_invoices_url
|
||||
|
@ -21,5 +22,7 @@ class BalanceTopUpTest < ActionDispatch::IntegrationTest
|
|||
assert_equal BigDecimal(10), invoice.vat_rate
|
||||
assert_equal BigDecimal('28.05'), invoice.total
|
||||
assert_text 'Please pay the following invoice'
|
||||
|
||||
Setting.registry_vat_prc = original_vat_prc
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrarDomainTransfersTest < ActionDispatch::IntegrationTest
|
||||
class RegistrarAreaBulkTransferTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
WebMock.reset!
|
||||
login_as users(:api_goodnames)
|
||||
end
|
||||
|
||||
def test_batch_transfer_succeeds
|
||||
def test_transfer_multiple_domains_in_bulk
|
||||
request_body = { data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } }
|
||||
headers = { 'Content-type' => 'application/json' }
|
||||
request_stub = stub_request(:post, /domain_transfers/).with(body: request_body,
|
||||
|
@ -17,28 +16,26 @@ class RegistrarDomainTransfersTest < ActionDispatch::IntegrationTest
|
|||
}] }.to_json, status: 200)
|
||||
|
||||
visit registrar_domains_url
|
||||
click_link 'Transfer'
|
||||
|
||||
click_on 'Batch'
|
||||
click_link 'Bulk change'
|
||||
click_link 'Bulk transfer'
|
||||
attach_file 'Batch file', Rails.root.join('test', 'fixtures', 'files', 'valid_domains_for_transfer.csv').to_s
|
||||
click_button 'Transfer batch'
|
||||
click_button 'Transfer'
|
||||
|
||||
assert_requested request_stub
|
||||
assert_current_path registrar_domains_path
|
||||
assert_text '1 domains have been successfully transferred'
|
||||
end
|
||||
|
||||
def test_batch_transfer_fails_gracefully
|
||||
def test_fail_gracefully
|
||||
body = { errors: [{ title: 'epic fail' }] }.to_json
|
||||
headers = { 'Content-type' => 'application/json' }
|
||||
stub_request(:post, /domain_transfers/).to_return(status: 400, body: body, headers: headers)
|
||||
|
||||
visit registrar_domains_url
|
||||
click_link 'Transfer'
|
||||
|
||||
click_on 'Batch'
|
||||
click_link 'Bulk change'
|
||||
click_link 'Bulk transfer'
|
||||
attach_file 'Batch file', Rails.root.join('test', 'fixtures', 'files', 'valid_domains_for_transfer.csv').to_s
|
||||
click_button 'Transfer batch'
|
||||
click_button 'Transfer'
|
||||
|
||||
assert_text 'epic fail'
|
||||
end
|
|
@ -1,8 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrarNameserverReplacementTest < ActionDispatch::IntegrationTest
|
||||
class RegistrarAreaNameserverBulkChangeTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
WebMock.reset!
|
||||
login_as users(:api_goodnames)
|
||||
end
|
||||
|
||||
|
@ -21,7 +20,8 @@ class RegistrarNameserverReplacementTest < ActionDispatch::IntegrationTest
|
|||
}] }.to_json, status: 200)
|
||||
|
||||
visit registrar_domains_url
|
||||
click_link 'Replace nameserver'
|
||||
click_link 'Bulk change'
|
||||
click_link 'Nameserver'
|
||||
|
||||
fill_in 'Old hostname', with: 'ns1.bestnames.test'
|
||||
fill_in 'New hostname', with: 'new-ns.bestnames.test'
|
||||
|
@ -40,7 +40,8 @@ class RegistrarNameserverReplacementTest < ActionDispatch::IntegrationTest
|
|||
headers: { 'Content-type' => 'application/json' })
|
||||
|
||||
visit registrar_domains_url
|
||||
click_link 'Replace nameserver'
|
||||
click_link 'Bulk change'
|
||||
click_link 'Nameserver'
|
||||
|
||||
fill_in 'Old hostname', with: 'old hostname'
|
||||
fill_in 'New hostname', with: 'new hostname'
|
47
test/integration/registrar/bulk_change/tech_contact_test.rb
Normal file
47
test/integration/registrar/bulk_change/tech_contact_test.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrarAreaTechContactBulkChangeTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
login_as users(:api_bestnames)
|
||||
end
|
||||
|
||||
def test_replace_domain_contacts_of_current_registrar
|
||||
request_stub = stub_request(:patch, /domains\/contacts/)
|
||||
.with(body: { current_contact_id: 'william-001', new_contact_id: 'john-001' },
|
||||
basic_auth: ['test_bestnames', 'testtest'])
|
||||
.to_return(body: { affected_domains: %w[foo.test bar.test],
|
||||
skipped_domains: %w[baz.test qux.test] }.to_json,
|
||||
status: 200)
|
||||
|
||||
visit registrar_domains_url
|
||||
click_link 'Bulk change'
|
||||
|
||||
fill_in 'Current contact ID', with: 'william-001'
|
||||
fill_in 'New contact ID', with: 'john-001'
|
||||
click_on 'Replace technical contacts'
|
||||
|
||||
assert_requested request_stub
|
||||
assert_current_path registrar_domains_path
|
||||
assert_text 'Technical contacts have been successfully replaced'
|
||||
assert_text 'Affected domains: foo.test, bar.test'
|
||||
assert_text 'Skipped domains: baz.test, qux.test'
|
||||
end
|
||||
|
||||
def test_fails_gracefully
|
||||
stub_request(:patch, /domains\/contacts/)
|
||||
.to_return(status: 400,
|
||||
body: { error: { message: 'epic fail' } }.to_json,
|
||||
headers: { 'Content-type' => 'application/json' })
|
||||
|
||||
visit registrar_domains_url
|
||||
click_link 'Bulk change'
|
||||
|
||||
fill_in 'Current contact ID', with: 'william-001'
|
||||
fill_in 'New contact ID', with: 'john-001'
|
||||
click_on 'Replace technical contacts'
|
||||
|
||||
assert_text 'epic fail'
|
||||
assert_field 'Current contact ID', with: 'william-001'
|
||||
assert_field 'New contact ID', with: 'john-001'
|
||||
end
|
||||
end
|
|
@ -9,7 +9,7 @@ class RegistrarDomainsTest < ActionDispatch::IntegrationTest
|
|||
Domain,Transfer code,Registrant name,Registrant code,Date of expiry
|
||||
library.test,45118f5,Acme Ltd,acme-ltd-001,2010-07-05
|
||||
shop.test,65078d5,John,john-001,2010-07-05
|
||||
invalid.test,1438d6,any,any,2010-07-05
|
||||
invalid.test,1438d6,any,invalid,2010-07-05
|
||||
airport.test,55438j5,John,john-001,2010-07-05
|
||||
CSV
|
||||
|
||||
|
|
28
test/integration/registrar/invoices/list_test.rb
Normal file
28
test/integration/registrar/invoices/list_test.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ListInvoicesTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
super
|
||||
|
||||
@user = users(:api_bestnames)
|
||||
@registrar_invoices = @user.registrar.invoices
|
||||
login_as @user
|
||||
end
|
||||
|
||||
def test_show_balance
|
||||
visit registrar_invoices_path
|
||||
assert_text "Your current account balance is 100,00 EUR"
|
||||
end
|
||||
|
||||
def test_show_multiple_invoices
|
||||
@invoices = invoices
|
||||
@registrar_invoices = []
|
||||
@invoices.each do |invoice|
|
||||
@registrar_invoices << invoice
|
||||
end
|
||||
|
||||
visit registrar_invoices_path
|
||||
assert_text "Unpaid", count: 5
|
||||
assert_text "Invoice no.", count: 7
|
||||
end
|
||||
end
|
|
@ -0,0 +1,40 @@
|
|||
require 'test_helper'
|
||||
|
||||
class NewInvoicePaymentTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
super
|
||||
|
||||
@user = users(:api_bestnames)
|
||||
login_as @user
|
||||
end
|
||||
|
||||
def create_invoice_and_visit_its_page
|
||||
visit registrar_invoices_path
|
||||
click_link_or_button 'Add deposit'
|
||||
fill_in 'Amount', with: '200.00'
|
||||
fill_in 'Description', with: 'My first invoice'
|
||||
click_link_or_button 'Add'
|
||||
end
|
||||
|
||||
def test_create_new_SEB_payment
|
||||
create_invoice_and_visit_its_page
|
||||
click_link_or_button 'Seb'
|
||||
form = page.find('form')
|
||||
assert_equal('https://www.seb.ee/cgi-bin/dv.sh/ipank.r', form['action'])
|
||||
assert_equal('post', form['method'])
|
||||
assert_equal('240.00', form.find_by_id('VK_AMOUNT', visible: false).value)
|
||||
end
|
||||
|
||||
def test_create_new_Every_Pay_payment
|
||||
create_invoice_and_visit_its_page
|
||||
click_link_or_button 'Every pay'
|
||||
expected_hmac_fields = 'account_id,amount,api_username,callback_url,' +
|
||||
'customer_url,hmac_fields,nonce,order_reference,timestamp,transaction_type'
|
||||
|
||||
form = page.find('form')
|
||||
assert_equal('https://igw-demo.every-pay.com/transactions/', form['action'])
|
||||
assert_equal('post', form['method'])
|
||||
assert_equal(expected_hmac_fields, form.find_by_id('hmac_fields', visible: false).value)
|
||||
assert_equal('240.00', form.find_by_id('amount', visible: false).value)
|
||||
end
|
||||
end
|
48
test/integration/registrar/invoices/new_test.rb
Normal file
48
test/integration/registrar/invoices/new_test.rb
Normal file
|
@ -0,0 +1,48 @@
|
|||
require 'test_helper'
|
||||
|
||||
class NewInvoiceTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
super
|
||||
|
||||
@user = users(:api_bestnames)
|
||||
login_as @user
|
||||
end
|
||||
|
||||
def test_show_balance
|
||||
visit registrar_invoices_path
|
||||
assert_text "Your current account balance is 100,00 EUR"
|
||||
end
|
||||
|
||||
def test_create_new_invoice_with_positive_amount
|
||||
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. 131050'
|
||||
assert_text 'Subtotal 200,00 €'
|
||||
assert_text 'Pay invoice'
|
||||
end
|
||||
|
||||
# This test case should fail once issue #651 gets fixed
|
||||
def test_create_new_invoice_with_amount_0_goes_through
|
||||
visit registrar_invoices_path
|
||||
click_link_or_button 'Add deposit'
|
||||
fill_in 'Amount', with: '0.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. 131050'
|
||||
assert_text 'Subtotal 0,00 €'
|
||||
assert_text 'Pay invoice'
|
||||
end
|
||||
end
|
49
test/integration/registrar/invoices/payment_callback_test.rb
Normal file
49
test/integration/registrar/invoices/payment_callback_test.rb
Normal file
|
@ -0,0 +1,49 @@
|
|||
require 'test_helper'
|
||||
|
||||
class PaymentCallbackTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
super
|
||||
|
||||
@user = users(:api_bestnames)
|
||||
login_as @user
|
||||
end
|
||||
|
||||
def create_invoice_with_items
|
||||
@invoice = invoices(:for_payments_test)
|
||||
invoice_item = invoice_items(:one)
|
||||
|
||||
@invoice.invoice_items << invoice_item
|
||||
@invoice.invoice_items << invoice_item
|
||||
@user.registrar.invoices << @invoice
|
||||
end
|
||||
|
||||
def every_pay_request_params
|
||||
{
|
||||
nonce: "392f2d7748bc8cb0d14f263ebb7b8932",
|
||||
timestamp: "1524136727",
|
||||
api_username: "ca8d6336dd750ddb",
|
||||
transaction_result: "completed",
|
||||
payment_reference: "fd5d27b59a1eb597393cd5ff77386d6cab81ae05067e18d530b10f3802e30b56",
|
||||
payment_state: "settled",
|
||||
amount: "12.00",
|
||||
order_reference: "e468a2d59a731ccc546f2165c3b1a6",
|
||||
account_id: "EUR3D1",
|
||||
cc_type: "master_card",
|
||||
cc_last_four_digits: "0487",
|
||||
cc_month: "10",
|
||||
cc_year: "2018",
|
||||
cc_holder_name: "John Doe",
|
||||
hmac_fields: "account_id,amount,api_username,cc_holder_name,cc_last_four_digits,cc_month,cc_type,cc_year,hmac_fields,nonce,order_reference,payment_reference,payment_state,timestamp,transaction_result",
|
||||
hmac: "efac1c732835668cd86023a7abc140506c692f0d",
|
||||
invoice_id: "12900000",
|
||||
payment_method: "every_pay"
|
||||
}
|
||||
end
|
||||
|
||||
def test_every_pay_callback_returns_status_200
|
||||
create_invoice_with_items
|
||||
request_params = every_pay_request_params.merge(invoice_id: @invoice.id)
|
||||
post "/registrar/pay/callback/every_pay", request_params
|
||||
assert_equal(200, response.status)
|
||||
end
|
||||
end
|
100
test/integration/registrar/invoices/payment_return_test.rb
Normal file
100
test/integration/registrar/invoices/payment_return_test.rb
Normal file
|
@ -0,0 +1,100 @@
|
|||
require 'test_helper'
|
||||
|
||||
class PaymentReturnTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
super
|
||||
|
||||
@user = users(:api_bestnames)
|
||||
login_as @user
|
||||
end
|
||||
|
||||
def create_invoice_with_items
|
||||
@invoice = invoices(:for_payments_test)
|
||||
invoice_item = invoice_items(:one)
|
||||
|
||||
@invoice.invoice_items << invoice_item
|
||||
@invoice.invoice_items << invoice_item
|
||||
@user.registrar.invoices << @invoice
|
||||
end
|
||||
|
||||
def every_pay_request_params
|
||||
{
|
||||
nonce: "392f2d7748bc8cb0d14f263ebb7b8932",
|
||||
timestamp: "1524136727",
|
||||
api_username: "ca8d6336dd750ddb",
|
||||
transaction_result: "completed",
|
||||
payment_reference: "fd5d27b59a1eb597393cd5ff77386d6cab81ae05067e18d530b10f3802e30b56",
|
||||
payment_state: "settled",
|
||||
amount: "12.00",
|
||||
order_reference: "e468a2d59a731ccc546f2165c3b1a6",
|
||||
account_id: "EUR3D1",
|
||||
cc_type: "master_card",
|
||||
cc_last_four_digits: "0487",
|
||||
cc_month: "10",
|
||||
cc_year: "2018",
|
||||
cc_holder_name: "John Doe",
|
||||
hmac_fields: "account_id,amount,api_username,cc_holder_name,cc_last_four_digits,cc_month,cc_type,cc_year,hmac_fields,nonce,order_reference,payment_reference,payment_state,timestamp,transaction_result",
|
||||
hmac: "efac1c732835668cd86023a7abc140506c692f0d",
|
||||
invoice_id: "12900000",
|
||||
payment_method: "every_pay"
|
||||
}
|
||||
end
|
||||
|
||||
def bank_link_request_params
|
||||
{
|
||||
"VK_SERVICE": "1111",
|
||||
"VK_VERSION": "008",
|
||||
"VK_SND_ID": "testvpos",
|
||||
"VK_REC_ID": "seb",
|
||||
"VK_STAMP": 1,
|
||||
"VK_T_NO": "1",
|
||||
"VK_AMOUNT": "12.00",
|
||||
"VK_CURR": "EUR",
|
||||
"VK_REC_ACC": "1234",
|
||||
"VK_REC_NAME": "Eesti Internet",
|
||||
"VK_SND_ACC": "1234",
|
||||
"VK_SND_NAME": "John Doe",
|
||||
"VK_REF": "",
|
||||
"VK_MSG": "Order nr 1",
|
||||
"VK_T_DATETIME": "2018-04-01T00:30:00+0300",
|
||||
"VK_MAC": "CZZvcptkxfuOxRR88JmT4N+Lw6Hs4xiQfhBWzVYldAcRTQbcB/lPf9MbJzBE4e1/HuslQgkdCFt5g1xW2lJwrVDBQTtP6DAHfvxU3kkw7dbk0IcwhI4whUl68/QCwlXEQTAVDv1AFnGVxXZ40vbm/aLKafBYgrirB5SUe8+g9FE=",
|
||||
"VK_ENCODING": "UTF-8",
|
||||
"VK_LANG": "ENG",
|
||||
payment_method: "seb"
|
||||
}
|
||||
end
|
||||
|
||||
def test_every_pay_return_creates_activity_redirects_to_invoice_path
|
||||
create_invoice_with_items
|
||||
request_params = every_pay_request_params.merge(invoice_id: @invoice.id)
|
||||
|
||||
post "/registrar/pay/return/every_pay", request_params
|
||||
assert_equal(302, response.status)
|
||||
assert_redirected_to(registrar_invoice_path(@invoice))
|
||||
end
|
||||
|
||||
def test_Every_Pay_return_raises_RecordNotFound
|
||||
create_invoice_with_items
|
||||
request_params = every_pay_request_params.merge(invoice_id: "178907")
|
||||
assert_raises(ActiveRecord::RecordNotFound) do
|
||||
post "/registrar/pay/return/every_pay", request_params
|
||||
end
|
||||
end
|
||||
|
||||
def test_bank_link_return_redirects_to_invoice_paths
|
||||
create_invoice_with_items
|
||||
request_params = bank_link_request_params.merge(invoice_id: @invoice.id)
|
||||
|
||||
post "/registrar/pay/return/seb", request_params
|
||||
assert_equal(302, response.status)
|
||||
assert_redirected_to(registrar_invoice_path(@invoice))
|
||||
end
|
||||
|
||||
def test_bank_link_return
|
||||
create_invoice_with_items
|
||||
request_params = bank_link_request_params.merge(invoice_id: "178907")
|
||||
assert_raises(ActiveRecord::RecordNotFound) do
|
||||
post "/registrar/pay/return/seb", request_params
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue