View | Details | Raw Unified | Return to bug 34277
Collapse All | Expand All

(-)a/Koha/Patron.pm (+30 lines)
Lines 2374-2379 sub account_balance { Link Here
2374
    return $self->account->balance;
2374
    return $self->account->balance;
2375
}
2375
}
2376
2376
2377
=head3 balance_details
2378
2379
    my $balance_details = $patron->balance_details
2380
2381
Return the patron's account balance details.
2382
2383
=cut
2384
2385
sub balance_details {
2386
    my ($self) = @_;
2387
2388
    my $account = $self->account;
2389
2390
    # get outstanding debits and credits
2391
    my $debits  = $account->outstanding_debits;
2392
    my $credits = $account->outstanding_credits;
2393
2394
    return {
2395
        balance            => $account->balance,
2396
        outstanding_debits => {
2397
            total => $debits->total_outstanding,
2398
            lines => $debits->to_api,
2399
        },
2400
        outstanding_credits => {
2401
            total => $credits->total_outstanding,
2402
            lines => $credits->to_api,
2403
        }
2404
    };
2405
}
2406
2377
=head3 notify_library_of_registration
2407
=head3 notify_library_of_registration
2378
2408
2379
$patron->notify_library_of_registration( $email_patron_registrations );
2409
$patron->notify_library_of_registration( $email_patron_registrations );
(-)a/api/v1/swagger/definitions/patron.yaml (+5 lines)
Lines 369-374 properties: Link Here
369
      - number
369
      - number
370
      - "null"
370
      - "null"
371
    description: Balance of the patron's account
371
    description: Balance of the patron's account
372
  balance_details:
373
    type:
374
      - object
375
      - "null"
376
    description: Detail for outstanding debits and credits
372
  library:
377
  library:
373
    type:
378
    type:
374
      - object
379
      - object
(-)a/api/v1/swagger/paths/patrons.yaml (-1 / +1 lines)
Lines 368-373 Link Here
368
            - checkouts+count
368
            - checkouts+count
369
            - overdues+count
369
            - overdues+count
370
            - account_balance
370
            - account_balance
371
            - balance_details
371
            - library
372
            - library
372
        collectionFormat: csv
373
        collectionFormat: csv
373
    responses:
374
    responses:
374
- 

Return to bug 34277