line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PagSeguro::API::Base; |
2
|
3
|
|
|
3
|
|
1211
|
use Moo; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
12
|
|
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
1166
|
use XML::LibXML; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# attributes |
7
|
|
|
|
|
|
|
has email => (is => 'rw'); |
8
|
|
|
|
|
|
|
has token => (is => 'rw'); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has environment => (is => 'rw', default => sub { 'production' }); |
11
|
|
|
|
|
|
|
has debug => (is => 'rw', default => sub { 0 }); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub base_uri { |
14
|
|
|
|
|
|
|
my $self = shift; |
15
|
|
|
|
|
|
|
return $self->environment eq 'production'? |
16
|
|
|
|
|
|
|
'https://pagseguro.uol.com.br' : |
17
|
|
|
|
|
|
|
'https://sandbox.pagseguro.uol.com.br'; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub api_uri { |
21
|
|
|
|
|
|
|
my $self = shift; |
22
|
|
|
|
|
|
|
return $self->environment eq 'production'? |
23
|
|
|
|
|
|
|
'https://ws.pagseguro.uol.com.br/v2' : |
24
|
|
|
|
|
|
|
'https://ws.sandbox.pagseguro.uol.com.br/v2'; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub xml { |
28
|
|
|
|
|
|
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $xml = XML::LibXML->new; |
31
|
|
|
|
|
|
|
my $doc = $xml->parse_string( $_[0] ) if $_[0]; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
return $doc; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |