line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::PayPal::NVP::Response; |
2
|
|
|
|
|
|
|
$WebService::PayPal::NVP::Response::VERSION = '0.006'; |
3
|
5
|
|
|
5
|
|
21
|
use Moo; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
28
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
has 'raw' => ( is => 'rw', default => sub { {} } ); |
6
|
|
|
|
|
|
|
has 'success' => ( is => 'rw', default => sub { 0 } ); |
7
|
|
|
|
|
|
|
has 'errors' => ( is => 'rw', default => sub { [] } ); |
8
|
|
|
|
|
|
|
has 'branch' => ( |
9
|
|
|
|
|
|
|
is => 'rw', |
10
|
|
|
|
|
|
|
isa => sub { |
11
|
|
|
|
|
|
|
die "Response branch expects 'live' or 'sandbox' only\n" |
12
|
|
|
|
|
|
|
if $_[0] ne 'live' and $_[0] ne 'sandbox'; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub express_checkout_uri { |
17
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
18
|
0
|
0
|
|
|
|
|
if ( $self->can('token') ) { |
19
|
0
|
0
|
|
|
|
|
my $www = $self->branch eq 'live' ? 'www' : 'www.sandbox'; |
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
|
|
|
|
|
|
|
sub has_arg { |
30
|
0
|
|
|
0
|
0
|
|
my ( $self, $arg ) = @_; |
31
|
0
|
|
|
|
|
|
return $self->can($arg); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub has_errors { |
35
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
36
|
0
|
|
|
|
|
|
return scalar @{ $self->errors } > 0; |
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub args { |
40
|
0
|
|
|
0
|
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
|
5
|
|
|
5
|
|
2303
|
no strict 'refs'; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
557
|
|
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
foreach my $key ( keys %{"WebService::PayPal::NVP::Response::"} ) { |
|
0
|
|
|
|
|
|
|
51
|
0
|
0
|
0
|
|
|
|
if ( $key =~ /^[a-z]/ and not grep { $_ eq $key } @moothods ) { |
|
0
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
push @options, $key; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
return wantarray ? @options : \@options; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
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__ |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# ABSTRACT: PayPal NVP API response object |