File Coverage

blib/lib/WebService/PayPal/PaymentsAdvanced/Role/HasTransactionTime.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 30 30 100.0


line stmt bran cond sub pod time code
1             package WebService::PayPal::PaymentsAdvanced::Role::HasTransactionTime;
2              
3 6     6   3265 use Moo::Role;
  6         17  
  6         41  
4              
5 6     6   1942 use namespace::autoclean;
  6         20  
  6         37  
6              
7             our $VERSION = '0.000026';
8              
9 6     6   558 use feature qw( state );
  6         26  
  6         661  
10              
11 6     6   649 use DateTime::TimeZone;
  6         134098  
  6         270  
12 6     6   2015 use DateTime::Format::MySQL;
  6         601979  
  6         269  
13 6     6   56 use Types::Standard qw( InstanceOf );
  6         15  
  6         66  
14              
15             has transaction_time => (
16             is => 'lazy',
17             isa => InstanceOf ['DateTime'],
18             );
19              
20             sub _build_transaction_time {
21 17     17   11086 my $self = shift;
22              
23 17         69 state $time_zone
24             = DateTime::TimeZone->new( name => 'America/Los_Angeles' );
25             my $dt = DateTime::Format::MySQL->parse_datetime(
26 17         449 $self->params->{TRANSTIME} );
27 17         9046 $dt->set_time_zone($time_zone);
28 17         6349 return $dt;
29             }
30             1;
31              
32             =pod
33              
34             =head1 NAME
35              
36             WebService::PayPal::PaymentsAdvanced::Role::HasTransactionTime - Role which converts TRANSTIME into a DateTime object
37              
38             =head1 VERSION
39              
40             version 0.000026
41              
42             =head2 transaction_time
43              
44             Returns C<TRANSTIME> in the form of a DateTime object
45              
46             =head1 AUTHOR
47              
48             Olaf Alders <olaf@wundercounter.com>
49              
50             =head1 COPYRIGHT AND LICENSE
51              
52             This software is copyright (c) 2020 by MaxMind, Inc.
53              
54             This is free software; you can redistribute it and/or modify it under
55             the same terms as the Perl 5 programming language system itself.
56              
57             =cut
58              
59             __END__
60              
61             # ABSTRACT: Role which converts TRANSTIME into a DateTime object
62