Lines 111-120
Controller function that handles retrieval of Checkout availability
Link Here
|
111 |
sub get_availability { |
111 |
sub get_availability { |
112 |
my $c = shift->openapi->valid_input or return; |
112 |
my $c = shift->openapi->valid_input or return; |
113 |
|
113 |
|
114 |
my $patron = Koha::Patrons->find( $c->validation->param('patron_id') ); |
114 |
my $patron = Koha::Patrons->find( $c->param('patron_id') ); |
115 |
my $inprocess = 0; # What does this do? |
115 |
my $inprocess = 0; # What does this do? |
116 |
my $ignore_reserves = 0; # Don't ignore reserves |
116 |
my $ignore_reserves = 0; # Don't ignore reserves |
117 |
my $item = Koha::Items->find( $c->validation->param('item_id') ); |
117 |
my $item = Koha::Items->find( $c->param('item_id') ); |
118 |
my $params = { |
118 |
my $params = { |
119 |
item => $item |
119 |
item => $item |
120 |
}; |
120 |
}; |
Lines 123-131
sub get_availability {
Link Here
|
123 |
C4::Circulation::CanBookBeIssued( $patron, undef, undef, $inprocess, $ignore_reserves, |
123 |
C4::Circulation::CanBookBeIssued( $patron, undef, undef, $inprocess, $ignore_reserves, |
124 |
$params ); |
124 |
$params ); |
125 |
|
125 |
|
126 |
my $confirm_keys = join( /:/, sort keys %{$confirmation} ); |
126 |
my $confirm_keys = join( ":", sort keys %{$confirmation} ); |
127 |
my $tokenizer = Koha::Token->new; |
127 |
my $token = Koha::Token->new->generate_jwt({ id => $confirm_keys }); |
128 |
my $token = $tokenizer->generate_jwt({ id => $confirm_keys }); |
|
|
129 |
|
128 |
|
130 |
my $response = { |
129 |
my $response = { |
131 |
blockers => $impossible, |
130 |
blockers => $impossible, |
Lines 146-152
Add a new checkout
Link Here
|
146 |
sub add { |
145 |
sub add { |
147 |
my $c = shift->openapi->valid_input or return; |
146 |
my $c = shift->openapi->valid_input or return; |
148 |
|
147 |
|
149 |
my $body = $c->validation->param('body'); |
148 |
my $body = $c->req->json; |
150 |
my $item_id = $body->{item_id}; |
149 |
my $item_id = $body->{item_id}; |
151 |
my $patron_id = $body->{patron_id}; |
150 |
my $patron_id = $body->{patron_id}; |
152 |
my $onsite = $body->{onsite_checkout}; |
151 |
my $onsite = $body->{onsite_checkout}; |
Lines 205-214
sub add {
Link Here
|
205 |
|
204 |
|
206 |
# Check for existance of confirmation token |
205 |
# Check for existance of confirmation token |
207 |
# and if exists check validity |
206 |
# and if exists check validity |
208 |
if ( my $token = $c->validation->param('confirmation') ) { |
207 |
if ( my $token = $c->param('confirmation') ) { |
209 |
my $confirm_keys = join( /:/, sort keys %{$confirmation} ); |
208 |
my $confirm_keys = join( ":", sort keys %{$confirmation} ); |
210 |
my $tokenizer = Koha::Token->new; |
209 |
$confirmed = Koha::Token->new->check_jwt( |
211 |
$confirmed = $tokenizer->check_jwt( |
|
|
212 |
{ id => $confirm_keys, token => $token } ); |
210 |
{ id => $confirm_keys, token => $token } ); |
213 |
} |
211 |
} |
214 |
|
212 |
|
215 |
- |
|
|