|
Lines 40-46
my $t = Test::Mojo->new('Koha::REST::V1');
Link Here
|
| 40 |
|
40 |
|
| 41 |
subtest 'get_balance() tests' => sub { |
41 |
subtest 'get_balance() tests' => sub { |
| 42 |
|
42 |
|
| 43 |
plan tests => 12; |
43 |
plan tests => 15; |
| 44 |
|
44 |
|
| 45 |
$schema->storage->txn_begin; |
45 |
$schema->storage->txn_begin; |
| 46 |
|
46 |
|
|
Lines 149-154
subtest 'get_balance() tests' => sub {
Link Here
|
| 149 |
} |
149 |
} |
| 150 |
); |
150 |
); |
| 151 |
|
151 |
|
|
|
152 |
# Accountline without manager_id (happens with fines.pl cron for example) |
| 153 |
my $account_line_3 = Koha::Account::Line->new( |
| 154 |
{ |
| 155 |
borrowernumber => $patron->borrowernumber, |
| 156 |
date => \'NOW()', |
| 157 |
amount => 50, |
| 158 |
description => "A description", |
| 159 |
debit_type_code => "NEW_CARD", # New card |
| 160 |
amountoutstanding => 50, |
| 161 |
manager_id => undef, |
| 162 |
branchcode => $library->id, |
| 163 |
interface => 'test', |
| 164 |
} |
| 165 |
)->store(); |
| 166 |
$account_line_3->discard_changes; |
| 167 |
|
| 168 |
$tx = $t->ua->build_tx( GET => "/api/v1/patrons/$patron_id/account" ); |
| 169 |
$tx->req->cookies( { name => 'CGISESSID', value => $session_id } ); |
| 170 |
$tx->req->env( { REMOTE_ADDR => '127.0.0.1' } ); |
| 171 |
$t->request_ok($tx)->status_is(200)->json_is( |
| 172 |
{ balance => 40.00, |
| 173 |
outstanding_debits => { |
| 174 |
total => 50.00, |
| 175 |
lines => [ |
| 176 |
$account_line_3->to_api |
| 177 |
] |
| 178 |
}, |
| 179 |
outstanding_credits => { |
| 180 |
total => -10, |
| 181 |
lines => [ $credit_line->to_api ] |
| 182 |
} |
| 183 |
} |
| 184 |
); |
| 185 |
|
| 152 |
$schema->storage->txn_rollback; |
186 |
$schema->storage->txn_rollback; |
| 153 |
}; |
187 |
}; |
| 154 |
|
188 |
|
| 155 |
- |
|
|