line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Stripe API - ~/lib/Net/API/Stripe/Event/Data.pm |
3
|
|
|
|
|
|
|
## Version v0.100.0 |
4
|
|
|
|
|
|
|
## Copyright(c) 2019 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2019/11/02 |
7
|
|
|
|
|
|
|
## Modified 2020/05/15 |
8
|
|
|
|
|
|
|
## |
9
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
10
|
|
|
|
|
|
|
## Object of the resources relevant to the event, e.g. balance, or invoice |
11
|
|
|
|
|
|
|
## This must be processed by callbacks to set the right object |
12
|
|
|
|
|
|
|
package Net::API::Stripe::Event::Data; |
13
|
|
|
|
|
|
|
BEGIN |
14
|
|
|
|
|
|
|
{ |
15
|
2
|
|
|
2
|
|
21213217
|
use strict; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
64
|
|
16
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
56
|
|
17
|
2
|
|
|
2
|
|
10
|
use parent qw( Net::API::Stripe::Generic ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
18
|
2
|
|
|
2
|
|
138
|
use vars qw( $VERSION ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
112
|
|
19
|
2
|
|
|
2
|
|
42
|
our( $VERSION ) = 'v0.100.0'; |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
39
|
|
23
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
372
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub object |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
1
|
|
my $self = shift( @_ ); |
28
|
0
|
0
|
|
|
|
|
if( @_ ) |
29
|
|
|
|
|
|
|
{ |
30
|
0
|
|
|
|
|
|
my $ref = shift( @_ ); |
31
|
|
|
|
|
|
|
## This is not a type, there is an object property that contains a hash |
32
|
0
|
|
0
|
0
|
|
|
my $type = $ref->{object} || return( $self->error( "No object type could be found for field $self->{_field} in hash: ", sub{ $self->dumper( $ref ) } ) ); |
|
0
|
|
|
|
|
|
|
33
|
0
|
|
0
|
|
|
|
my $class = $self->_object_type_to_class( $type ) || |
34
|
|
|
|
|
|
|
return( $self->error( "No class found for object type $type" ) ); |
35
|
0
|
|
|
|
|
|
return( $self->_set_get_object( 'object', $class, $ref ) ); |
36
|
|
|
|
|
|
|
} |
37
|
0
|
|
|
|
|
|
return( $self->{object} ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
0
|
1
|
|
sub previous_attributes { return( shift->_set_get_hash( 'previous_attributes', @_ ) ); } |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=encoding utf8 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Net::API::Stripe::Event::Data - A Stripe Event Data Object |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $event_data = $stripe->event->data({ |
55
|
|
|
|
|
|
|
# The type of object is variable. In this example we use an invoice object |
56
|
|
|
|
|
|
|
object => $invoice_object, |
57
|
|
|
|
|
|
|
}); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 VERSION |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
v0.100.0 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DESCRIPTION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This is a Stripe Event Data Object. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This is instantiated by the method B<data> in module L<Net::API::Stripe::Event> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 new( %ARG ) |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Creates a new L<Net::API::Stripe::Event::Data> object. |
74
|
|
|
|
|
|
|
It may also take an hash like arguments, that also are method of the same name. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 METHODS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 object hash |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Object containing the API resource relevant to the event. For example, an invoice.created event will have a full invoice object as the value of the object key. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 previous_attributes hash |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Object containing the names of the attributes that have changed, and their previous values (sent along only with *.updated events). |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 API SAMPLE |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
{ |
89
|
|
|
|
|
|
|
"id": "evt_fake123456789", |
90
|
|
|
|
|
|
|
"object": "event", |
91
|
|
|
|
|
|
|
"api_version": "2017-02-14", |
92
|
|
|
|
|
|
|
"created": 1528914645, |
93
|
|
|
|
|
|
|
"data": { |
94
|
|
|
|
|
|
|
"object": { |
95
|
|
|
|
|
|
|
"object": "balance", |
96
|
|
|
|
|
|
|
"available": [ |
97
|
|
|
|
|
|
|
{ |
98
|
|
|
|
|
|
|
"currency": "jpy", |
99
|
|
|
|
|
|
|
"amount": 1025751, |
100
|
|
|
|
|
|
|
"source_types": { |
101
|
|
|
|
|
|
|
"card": 1025751 |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
], |
105
|
|
|
|
|
|
|
"connect_reserved": [ |
106
|
|
|
|
|
|
|
{ |
107
|
|
|
|
|
|
|
"currency": "jpy", |
108
|
|
|
|
|
|
|
"amount": 0 |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
], |
111
|
|
|
|
|
|
|
"livemode": false, |
112
|
|
|
|
|
|
|
"pending": [ |
113
|
|
|
|
|
|
|
{ |
114
|
|
|
|
|
|
|
"currency": "jpy", |
115
|
|
|
|
|
|
|
"amount": 0, |
116
|
|
|
|
|
|
|
"source_types": { |
117
|
|
|
|
|
|
|
"card": 0 |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
] |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
}, |
123
|
|
|
|
|
|
|
"livemode": false, |
124
|
|
|
|
|
|
|
"pending_webhooks": 0, |
125
|
|
|
|
|
|
|
"request": { |
126
|
|
|
|
|
|
|
"id": null, |
127
|
|
|
|
|
|
|
"idempotency_key": null |
128
|
|
|
|
|
|
|
}, |
129
|
|
|
|
|
|
|
"type": "balance.available" |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 HISTORY |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 v0.1 |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Initial version |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 AUTHOR |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SEE ALSO |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Stripe API documentation: |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
L<https://stripe.com/docs/api/events/object> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Copyright (c) 2019-2020 DEGUEST Pte. Ltd. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
You can use, copy, modify and redistribute this package and associated |
153
|
|
|
|
|
|
|
files under the same terms as Perl itself. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=cut |