Lines 60-69
subtest 'outstanding_debits() tests' => sub {
Link Here
|
60 |
my $account = $patron->account; |
60 |
my $account = $patron->account; |
61 |
|
61 |
|
62 |
my @generated_lines; |
62 |
my @generated_lines; |
63 |
push @generated_lines, $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); |
63 |
push @generated_lines, $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); |
64 |
push @generated_lines, $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); |
64 |
push @generated_lines, $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); |
65 |
push @generated_lines, $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); |
65 |
push @generated_lines, $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); |
66 |
push @generated_lines, $account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' }); |
66 |
push @generated_lines, $account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' }); |
67 |
|
67 |
|
68 |
my $lines = $account->outstanding_debits(); |
68 |
my $lines = $account->outstanding_debits(); |
69 |
my @lines_arr = $account->outstanding_debits(); |
69 |
my @lines_arr = $account->outstanding_debits(); |
Lines 405-414
subtest 'lines() tests' => sub {
Link Here
|
405 |
$account->add_credit({ amount => 4, interface => 'commandline' }); |
405 |
$account->add_credit({ amount => 4, interface => 'commandline' }); |
406 |
|
406 |
|
407 |
# Add Debits |
407 |
# Add Debits |
408 |
$account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); |
408 |
$account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); |
409 |
$account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); |
409 |
$account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); |
410 |
$account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); |
410 |
$account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); |
411 |
$account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' }); |
411 |
$account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' }); |
412 |
|
412 |
|
413 |
# Paid Off |
413 |
# Paid Off |
414 |
$account->add_credit( { amount => 1, interface => 'commandline' } ) |
414 |
$account->add_credit( { amount => 1, interface => 'commandline' } ) |
Lines 441-450
subtest 'reconcile_balance' => sub {
Link Here
|
441 |
$account->add_credit({ amount => 5, interface => 'commandline' }); |
441 |
$account->add_credit({ amount => 5, interface => 'commandline' }); |
442 |
|
442 |
|
443 |
# Add Debits |
443 |
# Add Debits |
444 |
$account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); |
444 |
$account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); |
445 |
$account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); |
445 |
$account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); |
446 |
$account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); |
446 |
$account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); |
447 |
$account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' }); |
447 |
$account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' }); |
448 |
|
448 |
|
449 |
# Paid Off |
449 |
# Paid Off |
450 |
Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store; |
450 |
Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store; |
Lines 479-488
subtest 'reconcile_balance' => sub {
Link Here
|
479 |
$account->add_credit({ amount => 4, interface => 'commandline' }); |
479 |
$account->add_credit({ amount => 4, interface => 'commandline' }); |
480 |
|
480 |
|
481 |
# Add Debits |
481 |
# Add Debits |
482 |
$account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); |
482 |
$account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); |
483 |
$account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); |
483 |
$account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); |
484 |
$account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); |
484 |
$account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); |
485 |
$account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' }); |
485 |
$account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' }); |
486 |
|
486 |
|
487 |
# Paid Off |
487 |
# Paid Off |
488 |
Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store; |
488 |
Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store; |
Lines 517-527
subtest 'reconcile_balance' => sub {
Link Here
|
517 |
$account->add_credit({ amount => 4, interface => 'commandline' }); |
517 |
$account->add_credit({ amount => 4, interface => 'commandline' }); |
518 |
|
518 |
|
519 |
# Add Debits |
519 |
# Add Debits |
520 |
$account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); |
520 |
$account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); |
521 |
$account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); |
521 |
$account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); |
522 |
$account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); |
522 |
$account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); |
523 |
$account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' }); |
523 |
$account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' }); |
524 |
$account->add_debit({ amount => 5, interface => 'commandline', type => 'overdue' }); |
524 |
$account->add_debit({ amount => 5, interface => 'commandline', type => 'OVERDUE' }); |
525 |
|
525 |
|
526 |
# Paid Off |
526 |
# Paid Off |
527 |
Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store; |
527 |
Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store; |
Lines 554-562
subtest 'reconcile_balance' => sub {
Link Here
|
554 |
$account->add_credit({ amount => 3, interface => 'commandline' }); |
554 |
$account->add_credit({ amount => 3, interface => 'commandline' }); |
555 |
|
555 |
|
556 |
# Add Debits |
556 |
# Add Debits |
557 |
my $debit_1 = $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); |
557 |
my $debit_1 = $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); |
558 |
my $debit_2 = $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); |
558 |
my $debit_2 = $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); |
559 |
my $debit_3 = $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); |
559 |
my $debit_3 = $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); |
560 |
|
560 |
|
561 |
is( $account->balance(), 2, "Account balance is 2" ); |
561 |
is( $account->balance(), 2, "Account balance is 2" ); |
562 |
is( $account->outstanding_debits->total_outstanding, 6, 'Outstanding debits sum 6' ); |
562 |
is( $account->outstanding_debits->total_outstanding, 6, 'Outstanding debits sum 6' ); |