|
Lines 183-190
subtest "Koha::Account::pay tests" => sub {
Link Here
|
| 183 |
|
183 |
|
| 184 |
my $account = Koha::Account->new({ patron_id => $borrower->id }); |
184 |
my $account = Koha::Account->new({ patron_id => $borrower->id }); |
| 185 |
|
185 |
|
| 186 |
my $line1 = $account->add_debit({ type => 'account', amount => 100, interface => 'commandline' }); |
186 |
my $line1 = $account->add_debit({ type => 'ACCOUNT', amount => 100, interface => 'commandline' }); |
| 187 |
my $line2 = $account->add_debit({ type => 'account', amount => 200, interface => 'commandline' }); |
187 |
my $line2 = $account->add_debit({ type => 'ACCOUNT', amount => 200, interface => 'commandline' }); |
| 188 |
|
188 |
|
| 189 |
$sth = $dbh->prepare("SELECT count(*) FROM accountlines"); |
189 |
$sth = $dbh->prepare("SELECT count(*) FROM accountlines"); |
| 190 |
$sth->execute; |
190 |
$sth->execute; |
|
Lines 283-289
subtest "Koha::Account::pay tests" => sub {
Link Here
|
| 283 |
$note = $sth->fetchrow_array; |
283 |
$note = $sth->fetchrow_array; |
| 284 |
is($note,'$200.00 payment note', '$200.00 payment note is registered'); |
284 |
is($note,'$200.00 payment note', '$200.00 payment note is registered'); |
| 285 |
|
285 |
|
| 286 |
my $line3 = $account->add_debit({ type => 'account', amount => 42, interface => 'commandline' }); |
286 |
my $line3 = $account->add_debit({ type => 'ACCOUNT', amount => 42, interface => 'commandline' }); |
| 287 |
my $payment_id = $account->pay( { lines => [$line3], amount => 42 } ); |
287 |
my $payment_id = $account->pay( { lines => [$line3], amount => 42 } ); |
| 288 |
my $payment = Koha::Account::Lines->find( $payment_id ); |
288 |
my $payment = Koha::Account::Lines->find( $payment_id ); |
| 289 |
is( $payment->amount(), '-42.000000', "Payment paid the specified fine" ); |
289 |
is( $payment->amount(), '-42.000000', "Payment paid the specified fine" ); |
|
Lines 311-320
subtest "Koha::Account::pay particular line tests" => sub {
Link Here
|
| 311 |
|
311 |
|
| 312 |
my $account = Koha::Account->new({ patron_id => $borrower->id }); |
312 |
my $account = Koha::Account->new({ patron_id => $borrower->id }); |
| 313 |
|
313 |
|
| 314 |
my $line1 = $account->add_debit({ type => 'account', amount => 1, interface => 'commandline' }); |
314 |
my $line1 = $account->add_debit({ type => 'ACCOUNT', amount => 1, interface => 'commandline' }); |
| 315 |
my $line2 = $account->add_debit({ type => 'account', amount => 2, interface => 'commandline' }); |
315 |
my $line2 = $account->add_debit({ type => 'ACCOUNT', amount => 2, interface => 'commandline' }); |
| 316 |
my $line3 = $account->add_debit({ type => 'account', amount => 3, interface => 'commandline' }); |
316 |
my $line3 = $account->add_debit({ type => 'ACCOUNT', amount => 3, interface => 'commandline' }); |
| 317 |
my $line4 = $account->add_debit({ type => 'account', amount => 4, interface => 'commandline' }); |
317 |
my $line4 = $account->add_debit({ type => 'ACCOUNT', amount => 4, interface => 'commandline' }); |
| 318 |
|
318 |
|
| 319 |
is( $account->balance(), 10, "Account balance is 10" ); |
319 |
is( $account->balance(), 10, "Account balance is 10" ); |
| 320 |
|
320 |
|
|
Lines 356-362
subtest "Koha::Account::pay writeoff tests" => sub {
Link Here
|
| 356 |
|
356 |
|
| 357 |
my $account = Koha::Account->new({ patron_id => $borrower->id }); |
357 |
my $account = Koha::Account->new({ patron_id => $borrower->id }); |
| 358 |
|
358 |
|
| 359 |
my $line = $account->add_debit({ type => 'account', amount => 42, interface => 'commandline' }); |
359 |
my $line = $account->add_debit({ type => 'ACCOUNT', amount => 42, interface => 'commandline' }); |
| 360 |
|
360 |
|
| 361 |
is( $account->balance(), 42, "Account balance is 42" ); |
361 |
is( $account->balance(), 42, "Account balance is 42" ); |
| 362 |
|
362 |
|