line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::PayPal::PaymentsAdvanced::Mocker::Helper; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
54
|
use Moo; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
75
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
2973
|
use namespace::autoclean; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
57
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000026'; |
8
|
|
|
|
|
|
|
|
9
|
7
|
|
|
7
|
|
2088
|
use Data::GUID; |
|
7
|
|
|
|
|
45231
|
|
|
7
|
|
|
|
|
63
|
|
10
|
7
|
|
|
7
|
|
5304
|
use DateTime; |
|
7
|
|
|
|
|
1822819
|
|
|
7
|
|
|
|
|
262
|
|
11
|
7
|
|
|
7
|
|
2493
|
use DateTime::Format::MySQL; |
|
7
|
|
|
|
|
295189
|
|
|
7
|
|
|
|
|
205
|
|
12
|
7
|
|
|
7
|
|
119
|
use DateTime::TimeZone; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
167
|
|
13
|
7
|
|
|
7
|
|
126
|
use Types::Standard qw( InstanceOf ); |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
106
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has _time_zone => ( |
16
|
|
|
|
|
|
|
is => 'lazy', |
17
|
|
|
|
|
|
|
isa => InstanceOf ['DateTime::TimeZone'], |
18
|
|
|
|
|
|
|
default => |
19
|
|
|
|
|
|
|
sub { DateTime::TimeZone->new( name => 'America/Los_Angeles' ) }, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub baid { |
23
|
4
|
|
|
4
|
1
|
92
|
my $self = shift; |
24
|
4
|
|
|
|
|
21
|
return 'B-' . $self->unique_id(17); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub correlationid { |
28
|
26
|
|
|
26
|
1
|
326
|
return lc shift->unique_id(13); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub pnref { |
32
|
27
|
|
|
27
|
1
|
532
|
return shift->unique_id(12); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub ppref { |
36
|
26
|
|
|
26
|
1
|
249
|
return shift->unique_id(17); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub secure_token { |
40
|
17
|
|
|
17
|
1
|
309
|
return shift->unique_id(25); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub token { |
44
|
2
|
|
|
2
|
1
|
26
|
return 'EC-' . shift->unique_id(17); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub transtime { |
48
|
28
|
|
|
28
|
1
|
2625
|
return DateTime::Format::MySQL->format_datetime( shift->datetime_now ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub unique_id { |
52
|
102
|
|
|
102
|
1
|
196
|
my $self = shift; |
53
|
102
|
|
50
|
|
|
272
|
my $length = shift || die 'length param required'; |
54
|
|
|
|
|
|
|
|
55
|
102
|
|
|
|
|
402
|
my $id = Data::GUID->new->as_string; |
56
|
102
|
|
|
|
|
4731
|
$id =~ s{-}{}g; |
57
|
102
|
|
|
|
|
581
|
return substr( $id, 0, $length ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub datetime_now { |
61
|
28
|
|
|
28
|
1
|
598
|
return DateTime->now( time_zone => shift->_time_zone ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=pod |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
WebService::PayPal::PaymentsAdvanced::Mocker::Helper - Helper methods used when mocking PayPal web services |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 VERSION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
version 0.000026 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SYNOPSIS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
use WebService::PayPal::PaymentsAdvanced::Mocker::Helper; |
79
|
|
|
|
|
|
|
my $helper = WebService::PayPal::PaymentsAdvanced::Mocker::Helper->new; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
print $helper->transtime; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 baid |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns a new, unique BAID |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 correlationid |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Returns a new, unique CORRELATIONID |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 pnref |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Returns a new, unique PNREF |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 ppref |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Returns a new, unique PPREF |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 secure_token |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns a new, unique SECURETOKEN |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 token |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Returns a new, unique SECURETOKENID |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 transtime |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Returns a TRANSTIME based on the current time |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 unique_id( $length ) |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
A generic method for creating unique ids. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 datetime_now |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Returns a new DateTime object with the current time, using the same time zone |
118
|
|
|
|
|
|
|
which the PayPal services use. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 DESCRIPTION |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Helper methods used when mocking PayPal web |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 AUTHOR |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Olaf Alders <olaf@wundercounter.com> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This software is copyright (c) 2020 by MaxMind, Inc. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
133
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
__END__ |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# ABSTRACT: Helper methods used when mocking PayPal web services |
140
|
|
|
|
|
|
|
|