Branch Coverage

blib/lib/Mojolicious/Plugin/PayPal.pm
Criterion Covered Total %
branch 28 50 56.0


line true false branch
190 1 0 $c->param('return_url') ? :
191 0 1 unless $args->{'token'} ||= $c->param('token')
192 0 1 unless $args->{'payer_id'} ||= $c->param('PayerID')
203 0 1 if $err
212 0 1 unless $res->code
215 0 1 if ($args->{'cancel'})
227 0 1 unless $json->{'id'}
228 0 1 unless $json->{'state'} eq 'approved'
230 0 5 unless $json->{'payer'}{'payer_info'}
240 0 1 unless (eval { do { my $json = $res->json; my $token; die 'No transaction ID in response from PayPal' unless $json->{'id'}; die $json->{'state'} unless $json->{'state'} eq 'approved'; while (my($key, $value) = each %{{} unless $json->{'payer'}{'payer_info'};}) { do { $res->param("payer_$key", $value) }; } ; $res->param('payer_id', $args->{'payer_id'}); $res->param('state', $json->{'state'}); $res->param('transaction_id', $json->{'id'}); $res->code(200); $self->$cb($res); 1 } })
296 1 1 unless $args->{'amount'}
327 0 1 unless $res->code
334 0 1 unless $json->{'id'}
335 0 1 unless $json->{'state'} eq 'created'
352 0 1 unless (eval { do { my $json = $res->json; my $token; die 'No transaction ID in response from PayPal' unless $json->{'id'}; die $json->{'state'} unless $json->{'state'} eq 'created'; foreach my $link (@{$$json{'links'};}) { my $key = "$link->{'rel'}_url"; $key =~ s/_url_url$/_url/; $res->param($key, $link->{'href'}); } ; $token = 'Mojo::URL'->new($res->param('approval_url'))->query->param('token'); $res->param('state', $json->{'state'}); $res->param('transaction_id', $json->{'id'}); $res->headers->location($res->param('approval_url')); $res->code(302); $delay->pass($res); $self->transaction_id_mapper->($self, $token, $json->{'id'}, $delay->begin); 1 } })
360 0 1 if $err
380 1 1 if (ref $config->{'secret'}) { }
1 0 elsif ($app->mode eq 'production') { }
394 2 0 unless ($self->transaction_id_mapper)
405 2 3 unless @_
460 0 0 $err ? :
495 1 1 if $self->{'access_token'}
500 0 2 unless $token
507 0 2 if $tx->res->code == 401
512 2 0 unless $token