| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PayProp::API::Public::Client::Authorization::Base; |
|
2
|
|
|
|
|
|
|
|
|
3
|
29
|
|
|
29
|
|
386164
|
use strict; |
|
|
29
|
|
|
|
|
110
|
|
|
|
29
|
|
|
|
|
1179
|
|
|
4
|
29
|
|
|
29
|
|
157
|
use warnings; |
|
|
29
|
|
|
|
|
59
|
|
|
|
29
|
|
|
|
|
1702
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
29
|
|
|
29
|
|
181
|
use Mouse; |
|
|
29
|
|
|
|
|
60
|
|
|
|
29
|
|
|
|
|
288
|
|
|
7
|
|
|
|
|
|
|
with qw/ PayProp::API::Public::Client::Role::Attribute::Token /; |
|
8
|
|
|
|
|
|
|
with qw/ PayProp::API::Public::Client::Role::Attribute::Storage /; |
|
9
|
|
|
|
|
|
|
|
|
10
|
29
|
|
|
29
|
|
19868
|
use Mojo::Promise; |
|
|
29
|
|
|
|
|
1204279
|
|
|
|
29
|
|
|
|
|
341
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has is_token_from_storage => ( is => 'rw', isa => 'Bool' ); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub token_request_p { |
|
16
|
42
|
|
|
42
|
1
|
160
|
my ( $self ) = @_; |
|
17
|
|
|
|
|
|
|
|
|
18
|
42
|
|
|
|
|
1248
|
$self->is_token_from_storage( 0 ); |
|
19
|
|
|
|
|
|
|
|
|
20
|
42
|
50
|
|
|
|
1166
|
return $self->_token_request_p unless $self->has_storage; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return $self |
|
23
|
|
|
|
|
|
|
->storage |
|
24
|
|
|
|
|
|
|
->get_p( $self->storage_key ) |
|
25
|
|
|
|
|
|
|
->then( sub { |
|
26
|
0
|
|
|
0
|
|
0
|
my ( $token ) = @_; |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
0
|
if ( $token ) { |
|
29
|
0
|
|
|
|
|
0
|
$self->is_token_from_storage( 1 ); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
return { |
|
32
|
0
|
|
|
|
|
0
|
token => $token, |
|
33
|
|
|
|
|
|
|
token_type => $self->token_type, |
|
34
|
|
|
|
|
|
|
}; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
return $self |
|
38
|
|
|
|
|
|
|
->_token_request_p |
|
39
|
|
|
|
|
|
|
->then( sub { |
|
40
|
0
|
|
|
|
|
0
|
my ( $token_info ) = @_; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
return $self |
|
43
|
|
|
|
|
|
|
->storage |
|
44
|
|
|
|
|
|
|
->set_p( $self->storage_key, $token_info->{token} ) |
|
45
|
0
|
|
|
|
|
0
|
->then( sub { $token_info } ) |
|
46
|
0
|
|
|
|
|
0
|
; |
|
47
|
|
|
|
|
|
|
} ) |
|
48
|
0
|
|
|
|
|
0
|
; |
|
49
|
|
|
|
|
|
|
} ) |
|
50
|
0
|
|
|
|
|
0
|
; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub remove_token_from_storage_p { |
|
54
|
0
|
|
|
0
|
0
|
0
|
my ( $self ) = @_; |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
0
|
$self->is_token_from_storage( 0 ); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
return Mojo::Promise |
|
59
|
|
|
|
|
|
|
->new( sub { |
|
60
|
0
|
|
|
0
|
|
0
|
my ( $resolve ) = @_; |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
0
|
return $resolve->( |
|
63
|
|
|
|
|
|
|
! $self->has_storage |
|
64
|
|
|
|
|
|
|
? 1 |
|
65
|
|
|
|
|
|
|
: $self->storage->delete_p( $self->storage_key ) |
|
66
|
|
|
|
|
|
|
); |
|
67
|
|
|
|
|
|
|
} ) |
|
68
|
0
|
|
|
|
|
0
|
; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
1
|
|
|
1
|
|
1568
|
sub _token_request_p { die '_token_request_p not implemented' } |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |