| 1 | package WebService::PayPal::NVP::Response; | ||||||||||||||||||||||||||||
| 2 | 5 | $WebService::PayPal::NVP::Response::VERSION = '0.006'; | |||||||||||||||||||||||||||
| 3 | 5 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 0 | ▶ | has 'raw' => ( is => 'rw', default => sub { {} } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 6 | 0 | ▶ | has 'success' => ( is => 'rw', default => sub { 0 } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 7 | 0 | ▶ | has 'errors' => ( is => 'rw', default => sub { [] } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 8 | has 'branch' => ( | ||||||||||||||||||||||||||||
| 9 | is => 'rw', | ||||||||||||||||||||||||||||
| 10 | 0 | ▶ | isa => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 11 | 0 | ▶ | die "Response branch expects 'live' or 'sandbox' only\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_[0] ne "live" and $_[0] ne "sandbox"
MC/DC0%0/2
$_[0] ne "live" and $_[0] ne "sandbox"
$_[0] ne "live"
$_[0] ne "sandbox"
Truth table0%0/3
A and B
A= $_[0] ne "live"B= $_[0] ne "sandbox"
| |||||||||||||||||||||||||||||
| 12 | if $_[0] ne 'live' and $_[0] ne 'sandbox'; | ||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||
| 14 | 5 | ); | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 0 | ▶ | sub express_checkout_uri { | ||||||||||||||||||||||||||
|
Subroutine
express_checkout_uri: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 17 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 18 | 0 | ▶ | if ( $self->can('token') ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | my $www = $self->branch eq 'live' ? 'www' : 'www.sandbox'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | return | ||||||||||||||||||||||||||||
| 21 | 0 | "https://${www}.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" | |||||||||||||||||||||||||||
| 22 | . $self->token | ||||||||||||||||||||||||||||
| 23 | . "&useraction=commit"; | ||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | return; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | sub has_arg { | ||||||||||||||||||||||||||
|
Subroutine
has_arg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | 0 | my ( $self, $arg ) = @_; | |||||||||||||||||||||||||||
| 31 | 0 | return $self->can($arg); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub has_errors { | ||||||||||||||||||||||||||
|
Subroutine
has_errors: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 35 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 36 | 0 | return scalar @{ $self->errors } > 0; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub args { | ||||||||||||||||||||||||||
|
Subroutine
args: not called CC=5 SCAR=30.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 41 | 0 | my @moothods = qw/ | |||||||||||||||||||||||||||
| 42 | around before can after | ||||||||||||||||||||||||||||
| 43 | import with new has | ||||||||||||||||||||||||||||
| 44 | options errors extends | ||||||||||||||||||||||||||||
| 45 | args has_arg has_errors | ||||||||||||||||||||||||||||
| 46 | /; | ||||||||||||||||||||||||||||
| 47 | 0 | my @options; | |||||||||||||||||||||||||||
| 48 | listmethods: { | ||||||||||||||||||||||||||||
| 49 | 0 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 50 | 0 | foreach my $key ( keys %{"WebService::PayPal::NVP::Response::"} ) { | |||||||||||||||||||||||||||
| 51 | 0 | ▶ | if ( $key =~ /^[a-z]/ and not grep { $_ eq $key } @moothods ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$key =~ /^[a-z]/ and not grep({$_ eq $key;} @moothods)
MC/DC0%0/2
$key =~ /^[a-z]/ and not grep({$_ eq $key;} @moothods)
$key =~ /^[a-z]/
not grep({$_ eq $key;} @moothods)
Truth table0%0/3
A and not(B)
A= $key =~ /^[a-z]/B= not grep({$_ eq $key;} @moothods)
| |||||||||||||||||||||||||||||
| 52 | 0 | push @options, $key; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | return wantarray ? @options : \@options; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 5 | 1; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | =pod | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =head1 NAME | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | WebService::PayPal::NVP::Response - PayPal NVP API response object | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =head1 VERSION | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | version 0.006 | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =head2 raw | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | raw response (HASHREF) | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =head2 success | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | Returns true on success, false on failure. | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | =head2 branch | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | Returns either 'live' or 'sandbox'. | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =head2 errors | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | Returns an C<ArrayRef> of errors. The ArrayRef is empty when there are no | ||||||||||||||||||||||||||||
| 89 | errors. | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =head2 has_errors | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | Returns true if C<errors()> is non-empty. | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | Brad Haywood <brad@perlpowered.com> | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | This software is copyright (c) 2013-2017 by Brad Haywood. | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 104 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | =cut | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | __END__ | ||||||||||||||||||||||||||||