Branch Coverage

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


line true false branch
21 1 0 $c->param('return_url') ? :
22 0 1 unless $args->{'token'} ||= $c->param('token')
24 0 1 unless $args->{'payer_id'} ||= $c->param('PayerID')
36 0 1 if $err
45 0 1 unless $res->code
48 0 1 if ($args->{'cancel'})
60 0 1 unless $json->{'id'}
61 0 1 unless $json->{'state'} eq 'approved'
63 0 5 unless $json->{'payer'}{'payer_info'}
73 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 } })
89 1 1 unless $args->{'amount'}
116 0 1 unless $res->code
123 0 1 unless $json->{'id'}
124 0 1 unless $json->{'state'} eq 'created'
141 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 } })
149 0 1 if $err
161 1 1 if (ref $config->{'secret'}) { }
1 0 elsif ($app->mode eq 'production') { }
175 2 0 unless ($self->transaction_id_mapper)
188 2 3 unless @_
254 0 0 $err ? :
293 1 1 if $self->{'access_token'}
298 0 2 unless $token
305 0 2 if $tx->res->code == 401
310 2 0 unless $token