File Coverage

lib/Net/API/Stripe/Billing/Invoice/TaxAmount.pm
Criterion Covered Total %
statement 19 22 86.3
branch n/a
condition n/a
subroutine 7 10 70.0
pod 3 3 100.0
total 29 35 82.8


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Billing/Invoice/TaxAmount.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::Invoice::TaxAmount;
11             BEGIN
12             {
13 1     1   1061 use strict;
  1         2  
  1         30  
14 1     1   5 use warnings;
  1         2  
  1         27  
15 1     1   5 use parent qw( Net::API::Stripe::Generic );
  1         1  
  1         5  
16 1     1   65 use vars qw( $VERSION );
  1         3  
  1         47  
17 1     1   18 our( $VERSION ) = 'v0.100.0';
18             };
19              
20 1     1   4 use strict;
  1         2  
  1         17  
21 1     1   4 use warnings;
  1         2  
  1         93  
22              
23 0     0 1   sub amount { return( shift->_set_get_number( 'amount', @_ ) ); }
24              
25 0     0 1   sub inclusive { return( shift->_set_get_boolean( 'inclusive', @_ ) ); }
26              
27 0     0 1   sub tax_rate { return( shift->_set_get_scalar_or_object( 'tax_rate', 'Net::API::Stripe::Tax::Rate', @_ ) ); }
28              
29             1;
30              
31             __END__
32              
33             =encoding utf8
34              
35             =head1 NAME
36              
37             Net::API::Stripe::Billing::Invoice::TaxAmount - A Stripe Invoice Tax Amount
38              
39             =head1 SYNOPSIS
40              
41             my $tax_amount_obj = $inv_line->tax_amounts({
42             amount => 2000,
43             inclusive => 1,
44             });
45              
46             =head1 VERSION
47              
48             v0.100.0
49              
50             =head1 DESCRIPTION
51              
52             This is use in L<Net::API::Stripe::Billing::Invoice> to calculate all the tax amounts. More particularly this is called from B<tax_amounts> in L<Net::API::Stripe::Billing::Invoice::LineItems>
53              
54             =head1 CONSTRUCTOR
55              
56             =head2 new( %ARG )
57              
58             Creates a new L<Net::API::Stripe::Billing::Invoice::TaxAmount> 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 amount integer
64              
65             The amount, in JPY, of the tax.
66              
67             =head2 inclusive boolean
68              
69             Whether this tax amount is inclusive or exclusive.
70              
71             =head2 tax_rate string (expandable)
72              
73             The tax rate that was applied to get this tax amount.
74              
75             When expanded, this is a L<Net::API::Stripe::Tax::Rate> object.
76              
77             =head1 API SAMPLE
78              
79             {
80             "id": "in_fake123456789",
81             "object": "invoice",
82             "account_country": "JP",
83             "account_name": "Provider, Inc",
84             "amount_due": 8000,
85             "amount_paid": 8000,
86             "amount_remaining": 0,
87             "application_fee_amount": null,
88             "attempt_count": 1,
89             "attempted": true,
90             "auto_advance": false,
91             "billing": "charge_automatically",
92             "billing_reason": "subscription",
93             "charge": "ch_fake123456789",
94             "collection_method": "charge_automatically",
95             "created": 1507273919,
96             "currency": "jpy",
97             "custom_fields": null,
98             "customer": "cus_fake123456789",
99             "customer_address": null,
100             "customer_email": "john.doe@example.com",
101             "customer_name": null,
102             "customer_phone": null,
103             "customer_shipping": null,
104             "customer_tax_exempt": "none",
105             "customer_tax_ids": [],
106             "default_payment_method": null,
107             "default_source": null,
108             "default_tax_rates": [],
109             "description": null,
110             "discount": null,
111             "due_date": null,
112             "ending_balance": 0,
113             "footer": null,
114             "hosted_invoice_url": "https://pay.stripe.com/invoice/invst_fake123456789",
115             "invoice_pdf": "https://pay.stripe.com/invoice/invst_fake123456789/pdf",
116             "lines": {
117             "data": [
118             {
119             "id": "sli_fake123456789",
120             "object": "line_item",
121             "amount": 8000,
122             "currency": "jpy",
123             "description": "1 × Provider, Inc professional monthly membership (at ¥8,000 / month)",
124             "discountable": true,
125             "livemode": false,
126             "metadata": {},
127             "period": {
128             "end": 1559441759,
129             "start": 1556763359
130             },
131             "plan": {
132             "id": "professional-monthly-jpy",
133             "object": "plan",
134             "active": true,
135             "aggregate_usage": null,
136             "amount": 8000,
137             "amount_decimal": "8000",
138             "billing_scheme": "per_unit",
139             "created": 1541833564,
140             "currency": "jpy",
141             "interval": "month",
142             "interval_count": 1,
143             "livemode": false,
144             "metadata": {},
145             "nickname": null,
146             "product": "prod_fake123456789",
147             "tiers": null,
148             "tiers_mode": null,
149             "transform_usage": null,
150             "trial_period_days": null,
151             "usage_type": "licensed"
152             },
153             "proration": false,
154             "quantity": 1,
155             "subscription": "sub_fake123456789",
156             "subscription_item": "si_fake123456789",
157             "tax_amounts": [],
158             "tax_rates": [],
159             "type": "subscription"
160             }
161             ],
162             "has_more": false,
163             "object": "list",
164             "url": "/v1/invoices/in_fake123456789/lines"
165             },
166             "livemode": false,
167             "metadata": {},
168             "next_payment_attempt": null,
169             "number": "53DB91F-0001",
170             "paid": true,
171             "payment_intent": null,
172             "period_end": 1507273919,
173             "period_start": 1507273919,
174             "post_payment_credit_notes_amount": 0,
175             "pre_payment_credit_notes_amount": 0,
176             "receipt_number": "2066-1929",
177             "starting_balance": 0,
178             "statement_descriptor": null,
179             "status": "paid",
180             "status_transitions": {
181             "finalized_at": 1507273919,
182             "marked_uncollectible_at": null,
183             "paid_at": 1507273919,
184             "voided_at": null
185             },
186             "subscription": "sub_fake123456789",
187             "subtotal": 8000,
188             "tax": null,
189             "tax_percent": null,
190             "total": 8000,
191             "total_tax_amounts": [],
192             "webhooks_delivered_at": 1507273920
193             }
194              
195             =head1 HISTORY
196              
197             =head2 v0.1
198              
199             Initial version
200              
201             =head1 AUTHOR
202              
203             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
204              
205             =head1 SEE ALSO
206              
207             Stripe API documentation:
208              
209             L<https://stripe.com/docs/api/invoices>
210              
211             =head1 COPYRIGHT & LICENSE
212              
213             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
214              
215             You can use, copy, modify and redistribute this package and associated
216             files under the same terms as Perl itself.
217              
218             =cut