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