Made endpoints org only

This commit is contained in:
Finn 2017-09-18 17:31:29 +01:00
parent e388d360ac
commit 78964d7297
2 changed files with 17 additions and 16 deletions

View file

@ -144,9 +144,7 @@ sub startup {
$api->post('/stats')->to('api-stats#post_index'); $api->post('/stats')->to('api-stats#post_index');
$api->post('/stats/leaderboard')->to('api-stats#post_leaderboards'); $api->post('/stats/leaderboard')->to('api-stats#post_leaderboards');
$api->post('/outgoing-transactions')->to('api-transactions#post_transaction_list_purchases'); $api->post('/outgoing-transactions')->to('api-transactions#post_transaction_list_purchases');
$api->post('/org/payroll/add')->to('api-organisation#post_payroll_add');
$api->post('/org/supplier/add')->to('api-organisation#post_supplier_add');
$api->post('/org/employee/add')->to('api-organisation#post_employee_add');
my $api_v1 = $api->under('/v1'); my $api_v1 = $api->under('/v1');
@ -154,6 +152,9 @@ sub startup {
$api_v1_org->post('/graphs')->to('api-v1-organisation-graphs#index'); $api_v1_org->post('/graphs')->to('api-v1-organisation-graphs#index');
$api_v1_org->post('/snippets')->to('api-v1-organisation-snippets#index'); $api_v1_org->post('/snippets')->to('api-v1-organisation-snippets#index');
$api_v1_org->post('/payroll/add')->to('api-organisation#post_payroll_add');
$api_v1_org->post('/supplier/add')->to('api-organisation#post_supplier_add');
$api_v1_org->post('/employee/add')->to('api-organisation#post_employee_add');
my $admin_routes = $r->under('/admin')->to('admin#under'); my $admin_routes = $r->under('/admin')->to('admin#under');

View file

@ -23,17 +23,17 @@ my $session_key = $framework->login({
## Payroll Data Submission ## Payroll Data Submission
#No JSON sent #No JSON sent
$t->post_ok('/api/org/payroll/add') $t->post_ok('/api/v1/organisation/payroll/add')
->status_is(400) ->status_is(400)
->json_is('/success', Mojo::JSON->false) ->json_is('/success', Mojo::JSON->false)
->json_like('/message', qr/JSON is missing/i); ->json_like('/message', qr/JSON is missing/i);
#Empty JSON #Empty JSON
$t->post_ok('/api/org/payroll/add' => json => {}) $t->post_ok('/api/v1/organisation/payroll/add' => json => {})
->json_is('/success', Mojo::JSON->false); ->json_is('/success', Mojo::JSON->false);
# no session key # no session key
$t->post_ok('/api/org/payroll/add' => json => { $t->post_ok('/api/v1/organisation/payroll/add' => json => {
entry_period => '2017-12', entry_period => '2017-12',
employee_amount => '10', employee_amount => '10',
local_employee_amount => '10', local_employee_amount => '10',
@ -49,7 +49,7 @@ $t->post_ok('/api/org/payroll/add' => json => {
->json_like('/message', qr/Invalid Session/); ->json_like('/message', qr/Invalid Session/);
# No entry_period # No entry_period
$t->post_ok('/api/org/payroll/add' => json => { $t->post_ok('/api/v1/organisation/payroll/add' => json => {
session_key => $session_key, session_key => $session_key,
employee_amount => '10', employee_amount => '10',
local_employee_amount => '10', local_employee_amount => '10',
@ -65,7 +65,7 @@ $t->post_ok('/api/org/payroll/add' => json => {
->json_like('/message', qr/No entry period/); ->json_like('/message', qr/No entry period/);
# No employee_amount # No employee_amount
$t->post_ok('/api/org/payroll/add' => json => { $t->post_ok('/api/v1/organisation/payroll/add' => json => {
session_key => $session_key, session_key => $session_key,
entry_period => '2017-12', entry_period => '2017-12',
local_employee_amount => '10', local_employee_amount => '10',
@ -81,7 +81,7 @@ $t->post_ok('/api/org/payroll/add' => json => {
->json_like('/message', qr/No employee amount/); ->json_like('/message', qr/No employee amount/);
# No local_employee_amount # No local_employee_amount
$t->post_ok('/api/org/payroll/add' => json => { $t->post_ok('/api/v1/organisation/payroll/add' => json => {
session_key => $session_key, session_key => $session_key,
entry_period => '2017-12', entry_period => '2017-12',
employee_amount => '10', employee_amount => '10',
@ -97,7 +97,7 @@ $t->post_ok('/api/org/payroll/add' => json => {
->json_like('/message', qr/local employee amount/); ->json_like('/message', qr/local employee amount/);
# No gross_payroll # No gross_payroll
$t->post_ok('/api/org/payroll/add' => json => { $t->post_ok('/api/v1/organisation/payroll/add' => json => {
session_key => $session_key, session_key => $session_key,
entry_period => '2017-12', entry_period => '2017-12',
employee_amount => '10', employee_amount => '10',
@ -113,7 +113,7 @@ $t->post_ok('/api/org/payroll/add' => json => {
->json_like('/message', qr/No gross payroll/); ->json_like('/message', qr/No gross payroll/);
# No payroll_income_tax # No payroll_income_tax
$t->post_ok('/api/org/payroll/add' => json => { $t->post_ok('/api/v1/organisation/payroll/add' => json => {
session_key => $session_key, session_key => $session_key,
entry_period => '2017-12', entry_period => '2017-12',
employee_amount => '10', employee_amount => '10',
@ -129,7 +129,7 @@ $t->post_ok('/api/org/payroll/add' => json => {
->json_like('/message', qr/No total income tax/); ->json_like('/message', qr/No total income tax/);
# No payroll_employee_ni # No payroll_employee_ni
$t->post_ok('/api/org/payroll/add' => json => { $t->post_ok('/api/v1/organisation/payroll/add' => json => {
session_key => $session_key, session_key => $session_key,
entry_period => '2017-12', entry_period => '2017-12',
employee_amount => '10', employee_amount => '10',
@ -145,7 +145,7 @@ $t->post_ok('/api/org/payroll/add' => json => {
->json_like('/message', qr/No total employee NI/); ->json_like('/message', qr/No total employee NI/);
# No payroll_employer_ni # No payroll_employer_ni
$t->post_ok('/api/org/payroll/add' => json => { $t->post_ok('/api/v1/organisation/payroll/add' => json => {
session_key => $session_key, session_key => $session_key,
entry_period => '2017-12', entry_period => '2017-12',
employee_amount => '10', employee_amount => '10',
@ -161,7 +161,7 @@ $t->post_ok('/api/org/payroll/add' => json => {
->json_like('/message', qr/total employer NI/); ->json_like('/message', qr/total employer NI/);
# No payroll_total_pension # No payroll_total_pension
$t->post_ok('/api/org/payroll/add' => json => { $t->post_ok('/api/v1/organisation/payroll/add' => json => {
session_key => $session_key, session_key => $session_key,
entry_period => '2017-12', entry_period => '2017-12',
employee_amount => '10', employee_amount => '10',
@ -177,7 +177,7 @@ $t->post_ok('/api/org/payroll/add' => json => {
->json_like('/message', qr/No total total pension/); ->json_like('/message', qr/No total total pension/);
# No payroll_other_benefit # No payroll_other_benefit
$t->post_ok('/api/org/payroll/add' => json => { $t->post_ok('/api/v1/organisation/payroll/add' => json => {
session_key => $session_key, session_key => $session_key,
entry_period => '2017-12', entry_period => '2017-12',
employee_amount => '10', employee_amount => '10',
@ -193,7 +193,7 @@ $t->post_ok('/api/org/payroll/add' => json => {
->json_like('/message', qr/No total other benefits total/); ->json_like('/message', qr/No total other benefits total/);
# Valid payroll submission # Valid payroll submission
$t->post_ok('/api/org/payroll/add' => json => { $t->post_ok('/api/v1/organisation/payroll/add' => json => {
session_key => $session_key, session_key => $session_key,
entry_period => '2017-12', entry_period => '2017-12',
employee_amount => '10', employee_amount => '10',