File Coverage

blib/lib/PagSeguro/API.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             package PagSeguro::API;
2             # ABSTRACT: PagSeguro::API - UOL PagSeguro Payment Gateway API Module
3             our $VERSION = '0.009.1';
4              
5 3     3   46989 use Moo;
  3         32725  
  3         15  
6              
7 3     3   4467 use PagSeguro::API::Payment;
  0            
  0            
8             use PagSeguro::API::Transaction;
9             use PagSeguro::API::Notification;
10              
11             # attributes
12             has email => (is => 'rw');
13             has token => (is => 'rw');
14              
15             has environment => (is => 'rw', default => sub { 'production' });
16             has debug => (is => 'rw', default => sub { 0 });
17              
18             # methods
19             sub payment_request {
20             my $self = shift;
21              
22             return PagSeguro::API::Payment
23             ->new( %{$self->_config} );
24             }
25              
26             sub notification {
27             my $self = shift;
28              
29             return PagSeguro::API::Notification
30             ->new( %{$self->_config} );
31             }
32              
33             sub transaction {
34             my $self = shift;
35              
36             return PagSeguro::API::Transaction
37             ->new( %{$self->_config} );
38             }
39              
40             sub _config {
41             my $self = shift;
42             return {
43             email => $self->email,
44             token => $self->token,
45              
46             debug => $self->debug,
47             environment => $self->environment,
48             };
49             }
50              
51              
52             1;
53             __END__