From d3260b93ede722861fe2af0be98d5ab447a15cb2 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Wed, 30 Nov 2016 17:21:59 +0000 Subject: [PATCH] Bug 15165: followup - fix definitions, and passing amount parameter in pay method --- Koha/REST/V1/Accountline.pm | 2 +- api/v1/swagger/paths/accountlines.json | 5 +++++ t/db_dependent/api/v1/accountlines.t | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Koha/REST/V1/Accountline.pm b/Koha/REST/V1/Accountline.pm index 9ee8aa8..57f83dd 100644 --- a/Koha/REST/V1/Accountline.pm +++ b/Koha/REST/V1/Accountline.pm @@ -61,7 +61,7 @@ sub pay { } my $body = $c->req->json; - my $amount = defined $body->{amount}; + my $amount = $body->{amount}; my $note = $body->{note} || ''; if ($amount && !looks_like_number($amount)) { diff --git a/api/v1/swagger/paths/accountlines.json b/api/v1/swagger/paths/accountlines.json index 89ebb23..726ffb7 100644 --- a/api/v1/swagger/paths/accountlines.json +++ b/api/v1/swagger/paths/accountlines.json @@ -3,6 +3,11 @@ "get": { "operationId": "listAccountlines", "tags": ["accountlines"], + "parameters": [ + { + "$ref": "../parameters.json#/borrowernumberQueryParam" + } + ], "produces": [ "application/json" ], diff --git a/t/db_dependent/api/v1/accountlines.t b/t/db_dependent/api/v1/accountlines.t index 4d918dd..a91b160 100644 --- a/t/db_dependent/api/v1/accountlines.t +++ b/t/db_dependent/api/v1/accountlines.t @@ -192,7 +192,6 @@ $t->request_ok($tx) ->status_is(404); my $accountline_to_partiallypay = Koha::Account::Lines->search({'borrowernumber' => $borrowernumber, 'amount' => 80})->unblessed()->[0]; - $tx = $t->ua->build_tx(POST => "/api/v1/accountlines/$accountline_to_partiallypay->{accountlines_id}/payment" => json => {amount => 'foo'}); $tx->req->cookies({name => 'CGISESSID', value => $session->id}); $tx->req->env({REMOTE_ADDR => '127.0.0.1'}); -- 2.1.4