Lines 49-75
sub get {
Link Here
|
49 |
} |
49 |
} |
50 |
|
50 |
|
51 |
my $account = $patron->account; |
51 |
my $account = $patron->account; |
52 |
my $balance; |
|
|
53 |
|
54 |
$balance->{balance} = $account->balance; |
55 |
|
52 |
|
56 |
# get outstanding debits and credits |
53 |
# get outstanding debits and credits |
57 |
my $debits = $account->outstanding_debits; |
54 |
my $debits = $account->outstanding_debits; |
58 |
my $credits = $account->outstanding_credits; |
55 |
my $credits = $account->outstanding_credits; |
59 |
|
56 |
|
60 |
my @debit_lines = map { _to_api( $_->TO_JSON ) } @{ $debits->as_list }; |
57 |
return $c->render( |
61 |
$balance->{outstanding_debits} = { |
58 |
status => 200, |
62 |
total => $debits->total_outstanding, |
59 |
openapi => { |
63 |
lines => \@debit_lines |
60 |
balance => $account->balance, |
64 |
}; |
61 |
outstanding_debits => { |
65 |
|
62 |
total => $debits->total_outstanding, |
66 |
my @credit_lines = map { _to_api( $_->TO_JSON ) } @{ $credits->as_list }; |
63 |
lines => $debits->to_api |
67 |
$balance->{outstanding_credits} = { |
64 |
}, |
68 |
total => $credits->total_outstanding, |
65 |
outstanding_credits => { |
69 |
lines => \@credit_lines |
66 |
total => $credits->total_outstanding, |
70 |
}; |
67 |
lines => $credits->to_api |
71 |
|
68 |
} |
72 |
return $c->render( status => 200, openapi => $balance ); |
69 |
} |
|
|
70 |
); |
73 |
} |
71 |
} |
74 |
|
72 |
|
75 |
=head3 add_credit |
73 |
=head3 add_credit |
76 |
- |
|
|