|
Lines 50-68
sub get {
Link Here
|
| 50 |
|
50 |
|
| 51 |
$balance->{balance} = $account->balance; |
51 |
$balance->{balance} = $account->balance; |
| 52 |
|
52 |
|
| 53 |
# get outstanding debits |
53 |
# get outstanding debits and credits |
| 54 |
my ( $debits_total, $debits ) = $account->outstanding_debits; |
54 |
my $debits = $account->outstanding_debits; |
| 55 |
my ( $credits_total, $credits ) = $account->outstanding_credits; |
55 |
my $credits = $account->outstanding_credits; |
| 56 |
|
56 |
|
| 57 |
my @debit_lines = map { _to_api( $_->TO_JSON ) } @{ $debits->as_list }; |
57 |
my @debit_lines = map { _to_api( $_->TO_JSON ) } @{ $debits->as_list }; |
| 58 |
$balance->{outstanding_debits} = { |
58 |
$balance->{outstanding_debits} = { |
| 59 |
total => $debits_total, |
59 |
total => $debits->total_outstanding, |
| 60 |
lines => \@debit_lines |
60 |
lines => \@debit_lines |
| 61 |
}; |
61 |
}; |
| 62 |
|
62 |
|
| 63 |
my @credit_lines = map { _to_api( $_->TO_JSON ) } @{ $credits->as_list }; |
63 |
my @credit_lines = map { _to_api( $_->TO_JSON ) } @{ $credits->as_list }; |
| 64 |
$balance->{outstanding_credits} = { |
64 |
$balance->{outstanding_credits} = { |
| 65 |
total => $credits_total, |
65 |
total => $credits->total_outstanding, |
| 66 |
lines => \@credit_lines |
66 |
lines => \@credit_lines |
| 67 |
}; |
67 |
}; |
| 68 |
|
68 |
|
| 69 |
- |
|
|