If credit amount passed to the Koha::Account->add_credit is not negative, Koha throws exception called Koha::Exceptions::Account::AmountNotPositive with error message "Debit amount passed is not positive". This is same error thrown with method add_debit. We should at least change error message as e.g. "Credit amount passed is not negative" and probably create a new exception called Koha::Exceptions::Account::AmountNotNegative to avoid confusion.
On same note, sub add_credit in Koha::REST::V1::Patrons::Account checks id amount passed is positive: > unless ( $amount > 0 ) Shouldn't this too check if amount is negative?