line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Stripe API - ~/lib/Net/API/Stripe/Billing/Plan/TransformUsage.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
|
|
|
|
|
|
|
BEGIN |
11
|
|
|
|
|
|
|
{ |
12
|
|
|
|
|
|
|
use strict; |
13
|
2
|
|
|
2
|
|
24204707
|
use warnings; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
60
|
|
14
|
2
|
|
|
2
|
|
11
|
use parent qw( Net::API::Stripe::Generic ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
59
|
|
15
|
2
|
|
|
2
|
|
9
|
use vars qw( $VERSION ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
16
|
2
|
|
|
2
|
|
143
|
our( $VERSION ) = 'v0.100.0'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
116
|
|
17
|
2
|
|
|
2
|
|
40
|
}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use strict; |
20
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
37
|
|
21
|
2
|
|
|
2
|
|
10
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
160
|
|
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
0
|
1
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
0
|
|
|
0
|
1
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=encoding utf8 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Net::API::Stripe::Billing::Plan::TransformUsage - A Stripe Plan Transform Usage Object |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $usage = $plan->transform_usage({ |
36
|
|
|
|
|
|
|
divide_by => 2, |
37
|
|
|
|
|
|
|
round => 0, |
38
|
|
|
|
|
|
|
}); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 VERSION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
v0.100.0 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with tiers. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Called from method B<transform_usage> in L<Net::API::Stripe::Billing::Plan> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 new( %ARG ) |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Creates a new L<Net::API::Stripe::Billing::Plan::TransformUsage> object. |
55
|
|
|
|
|
|
|
It may also take an hash like arguments, that also are method of the same name. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 METHODS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 divide_by integer |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Divide usage by this number. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 round string |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
After division, either round the result up or down. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 API SAMPLE |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
{ |
70
|
|
|
|
|
|
|
"id": "expert-monthly-jpy", |
71
|
|
|
|
|
|
|
"object": "plan", |
72
|
|
|
|
|
|
|
"active": true, |
73
|
|
|
|
|
|
|
"aggregate_usage": null, |
74
|
|
|
|
|
|
|
"amount": 8000, |
75
|
|
|
|
|
|
|
"amount_decimal": "8000", |
76
|
|
|
|
|
|
|
"billing_scheme": "per_unit", |
77
|
|
|
|
|
|
|
"created": 1507273129, |
78
|
|
|
|
|
|
|
"currency": "jpy", |
79
|
|
|
|
|
|
|
"interval": "month", |
80
|
|
|
|
|
|
|
"interval_count": 1, |
81
|
|
|
|
|
|
|
"livemode": false, |
82
|
|
|
|
|
|
|
"metadata": {}, |
83
|
|
|
|
|
|
|
"nickname": null, |
84
|
|
|
|
|
|
|
"product": "prod_fake123456789", |
85
|
|
|
|
|
|
|
"tiers": null, |
86
|
|
|
|
|
|
|
"tiers_mode": null, |
87
|
|
|
|
|
|
|
"transform_usage": null, |
88
|
|
|
|
|
|
|
"trial_period_days": null, |
89
|
|
|
|
|
|
|
"usage_type": "licensed" |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 HISTORY |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 v0.1 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Initial version |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 AUTHOR |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 SEE ALSO |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Stripe API documentation: |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L<https://stripe.com/docs/api/plans/object> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Copyright (c) 2019-2020 DEGUEST Pte. Ltd. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
You can use, copy, modify and redistribute this package and associated |
113
|
|
|
|
|
|
|
files under the same terms as Perl itself. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |