]> git.koha-community.org Git - koha.git/commit
Bug 21043: Handle exceptions and switch to debit response
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 1 Mar 2023 15:26:30 +0000 (15:26 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 5 May 2023 15:13:52 +0000 (12:13 -0300)
commita702f57adf2913541fec8905fdba839aa58eb720
tree48e91e12a096fb86f4e792d36945e6d4a12aa5a6
parentab10759c5061ccbd957b667ddf345a4bc174769c
Bug 21043: Handle exceptions and switch to debit response

We were cheating a bit here and expecting a 'debit' to be sent in but a
'line' to be returned.

We should really be sending a debit and returning a debit.. so I've
update the paths schema as such and we're now coercing the
Koha::Account::Line object that's returned by Koha::Account->add_debit
into a Koha::Account::Debit object. Longer term it would be nice to
convert returns from the various Koha::Account methods to their correct
Koha::Account:: objects as apposed to them all being the base ::Line

I've also added some code to catch exceptions that can be thrown by
Koha::Account->add_debit and added the appropriate 400 errors into the
path specs again.

Finally.. I added more unit tests to prove the above

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/REST/V1/Patrons/Account.pm
api/v1/swagger/paths/patrons_account.yaml
t/db_dependent/api/v1/patrons_accounts.t