File Coverage

blib/lib/WWW/PayPal.pm
Criterion Covered Total %
statement 29 30 96.6
branch 1 2 50.0
condition n/a
subroutine 13 14 92.8
pod n/a
total 43 46 93.4


line stmt bran cond sub pod time code
1             package WWW::PayPal;
2              
3             # ABSTRACT: Perl client for the PayPal REST API
4              
5 2     2   606372 use Moo;
  2         20887  
  2         13  
6 2     2   3979 use Carp qw(croak);
  2         5  
  2         123  
7 2     2   1322 use WWW::PayPal::API::Orders;
  2         8  
  2         144  
8 2     2   1276 use WWW::PayPal::API::Payments;
  2         11  
  2         101  
9 2     2   1400 use WWW::PayPal::API::Products;
  2         12  
  2         106  
10 2     2   1450 use WWW::PayPal::API::Plans;
  2         11  
  2         95  
11 2     2   14290 use WWW::PayPal::API::Subscriptions;
  2         12  
  2         100  
12 2     2   19 use namespace::clean;
  2         4  
  2         11  
13              
14             our $VERSION = '0.001';
15              
16              
17             has client_id => (
18             is => 'ro',
19             default => sub { $ENV{PAYPAL_CLIENT_ID} },
20             );
21              
22              
23             has secret => (
24             is => 'ro',
25             default => sub { $ENV{PAYPAL_SECRET} },
26             );
27              
28              
29             has sandbox => (
30             is => 'ro',
31             default => sub { $ENV{PAYPAL_SANDBOX} ? 1 : 0 },
32             );
33              
34              
35             has base_url => (
36             is => 'lazy',
37             builder => sub {
38 1 50   1   78 $_[0]->sandbox
39             ? 'https://api-m.sandbox.paypal.com'
40             : 'https://api-m.paypal.com';
41             },
42             );
43              
44              
45             with 'WWW::PayPal::Role::HTTP';
46              
47             has orders => (
48             is => 'lazy',
49 1     1   23 builder => sub { WWW::PayPal::API::Orders->new(client => $_[0]) },
50             );
51              
52              
53             has payments => (
54             is => 'lazy',
55 0     0   0 builder => sub { WWW::PayPal::API::Payments->new(client => $_[0]) },
56             );
57              
58              
59             has products => (
60             is => 'lazy',
61 1     1   26 builder => sub { WWW::PayPal::API::Products->new(client => $_[0]) },
62             );
63              
64              
65             has plans => (
66             is => 'lazy',
67 1     1   2463 builder => sub { WWW::PayPal::API::Plans->new(client => $_[0]) },
68             );
69              
70              
71             has subscriptions => (
72             is => 'lazy',
73 1     1   28 builder => sub { WWW::PayPal::API::Subscriptions->new(client => $_[0]) },
74             );
75              
76              
77              
78             1;
79              
80             __END__