| 1 | package WebService::PayPal::PaymentsAdvanced::Role::HasTransactionTime; | ||||||||||
| 2 | |||||||||||
| 3 | 6 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 6 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 6 | our $VERSION = '0.000028'; | |||||||||
| 8 | |||||||||||
| 9 | 6 | ▶ | use feature qw( state ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 6 | ▶ | use DateTime::TimeZone (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 6 | ▶ | use DateTime::Format::MySQL (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 6 | ▶ | use Types::Standard qw( InstanceOf Maybe ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 6 | has transaction_time => ( | |||||||||
| 16 | is => 'lazy', | ||||||||||
| 17 | isa => Maybe [ InstanceOf ['DateTime'] ], | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | 18 | ▶ | sub _build_transaction_time { | ||||||||
|
Subroutine
_build_transaction_time: called CC=2 SCAR=6.9
| |||||||||||
| 21 | 18 | my $self = shift; | |||||||||
| 22 | |||||||||||
| 23 | 18 | state $time_zone | |||||||||
| 24 | = DateTime::TimeZone->new( name => 'America/Los_Angeles' ); | ||||||||||
| 25 | |||||||||||
| 26 | 18 | ▶ | return undef unless my $transtime = $self->params->{TRANSTIME}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | 17 | my $dt = DateTime::Format::MySQL->parse_datetime($transtime); | |||||||||
| 29 | 17 | $dt->set_time_zone($time_zone); | |||||||||
| 30 | 17 | return $dt; | |||||||||
| 31 | } | ||||||||||
| 32 | 6 | 1; | |||||||||
| 33 | |||||||||||
| 34 | =pod | ||||||||||
| 35 | |||||||||||
| 36 | =encoding UTF-8 | ||||||||||
| 37 | |||||||||||
| 38 | =head1 NAME | ||||||||||
| 39 | |||||||||||
| 40 | WebService::PayPal::PaymentsAdvanced::Role::HasTransactionTime - Role which converts TRANSTIME into a DateTime object | ||||||||||
| 41 | |||||||||||
| 42 | =head1 VERSION | ||||||||||
| 43 | |||||||||||
| 44 | version 0.000028 | ||||||||||
| 45 | |||||||||||
| 46 | =head2 transaction_time | ||||||||||
| 47 | |||||||||||
| 48 | Returns C<TRANSTIME> in the form of a DateTime object | ||||||||||
| 49 | |||||||||||
| 50 | =head1 SUPPORT | ||||||||||
| 51 | |||||||||||
| 52 | Bugs may be submitted through L<https://github.com/maxmind/webservice-paypal-paymentsadvanced/issues>. | ||||||||||
| 53 | |||||||||||
| 54 | =head1 AUTHOR | ||||||||||
| 55 | |||||||||||
| 56 | Olaf Alders <olaf@wundercounter.com> | ||||||||||
| 57 | |||||||||||
| 58 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 59 | |||||||||||
| 60 | This software is copyright (c) 2022 by MaxMind, Inc. | ||||||||||
| 61 | |||||||||||
| 62 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 63 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 64 | |||||||||||
| 65 | =cut | ||||||||||
| 66 | |||||||||||
| 67 | __END__ | ||||||||||