File Coverage

blib/lib/Business/cXML/Amount/TaxDetail.pm
Criterion Covered Total %
statement 31 31 100.0
branch 4 4 100.0
condition n/a
subroutine 10 10 100.0
pod 2 2 100.0
total 47 47 100.0


line stmt bran cond sub pod time code
1             =encoding utf-8
2              
3             =head1 NAME
4              
5             Business::cXML::Amount::TaxDetail - cXML tax details
6              
7             =head1 SYNOPSIS
8              
9             use Business::cXML::Amount;
10              
11             =head2 DESCRIPTION
12              
13             Object representation of a cXML tax details, part of a
14             L<Business::cXML::Amount> of type C<Tax>.
15              
16             Only small subset of the possible attributes are currently implemented.
17              
18             =head1 METHODS
19              
20             See L<Business::cXML::Object/COMMON METHODS>.
21              
22             =head1 PROPERTY METHODS
23              
24             See L<Business::cXML::Object/PROPERTY METHODS> for how the following operate.
25              
26             =over
27              
28             =cut
29              
30 3     3   40 use 5.014;
  3         9  
31 3     3   15 use strict;
  3         6  
  3         117  
32              
33             use base qw(Business::cXML::Object);
34 3     3   15  
  3         5  
  3         195  
35             use constant NODENAME => 'TaxDetail';
36 3     3   20 use constant PROPERTIES => (
  3         6  
  3         234  
37 3         32 category => '',
38             percent => undef,
39             basis => undef,
40             tax => (Business::cXML::Amount->new()),
41             description => undef,
42             purpose => undef,
43             );
44 3     3   17 use constant OBJ_PROPERTIES => (
  3         4  
45 3         158 basis => [ 'Business::cXML::Amount', 'TaxableAmount' ],
46             tax => [ 'Business::cXML::Amount', 'TaxAmount' ],
47             description => 'Business::cXML::Description',
48             );
49 3     3   19  
  3         4  
50             use Business::cXML::Amount;
51 3     3   16 use XML::LibXML::Ferry;
  3         12  
  3         79  
52 3     3   18  
  3         5  
  3         633  
53             my ($self, $el) = @_;
54              
55 2     2 1 7 $el->ferry($self, {
56             percentageRate => 'percent',
57 2         29 isVatRecoverable => '__UNIMPLEMENTED',
58             taxPointDate => '__UNIMPLEMENTED',
59             paymentDate => '__UNIMPLEMENTED',
60             isTriangularTransaction => '__UNIMPLEMENTED',
61             exemptDetail => '__UNIMPLEMENTED',
62             isWithholdingTax => '__UNIMPLEMENTED',
63             taxRateType => '__UNIMPLEMENTED',
64             basePercentageRate => '__UNIMPLEMENTED',
65             isIncludedInPrice => '__UNIMPLEMENTED',
66             TaxableAmount => [ 'basis', 'Business::cXML::Amount' ],
67             TaxAmount => [ 'tax', 'Business::cXML::Amount' ],
68             TaxLocation => '__UNIMPLEMENTED',
69             TriangularTransactionLawReference => '__UNIMPLEMENTED',
70             TaxRegime => '__UNIMPLEMENTED',
71             TaxExemption => '__UNIMPLEMENTED',
72             Description => [ 'description', 'Business::cXML::Description' ],
73             });
74             }
75              
76             my ($self, $doc) = @_;
77             my $node = $doc->create($self->{_nodeName}, undef,
78             purpose => $self->{purpose},
79 2     2 1 26 category => $self->{category},
80             percentageRate => $self->{percent},
81             );
82              
83             $node->add($self->{basis}->to_node($node)) if defined $self->{basis};
84 2         8 $node->add($self->{tax}->to_node($node));
85             # TaxLocation
86 2 100       74 $node->add($self->{description}->to_node($node)) if defined $self->{description};
87 2         21 # TriangularTransactionLawReference
88             # TaxRegime
89 2 100       31 # TaxExemption
90              
91             return $node;
92             }
93              
94 2         30 =item C<B<category>>
95              
96             Mandatory, i.e. C<gst>
97              
98             =item C<B<percent>>
99              
100             Optional, i.e. C<8>
101              
102             =item C<B<basis>>
103              
104             Optional, L<Business::cXML::Amount> of type C<TaxableAmount>
105              
106             =item C<B<tax>>
107              
108             Mandatory, L<Business::cXML::Amount> of type C<TaxAmount>
109              
110             =item C<B<description>>
111              
112             Optional, L<Business::cXML::Description> object
113              
114             =item C<B<purpose>>
115              
116             Optional, i.e. C<tax>, C<custom duty>, C<shippingTax>, C<specialHandlingTax>
117              
118             =back
119              
120             =head1 AUTHOR
121              
122             Stéphane Lavergne L<https://github.com/vphantom>
123              
124             =head1 ACKNOWLEDGEMENTS
125              
126             Graph X Design Inc. L<https://www.gxd.ca/> sponsored this project.
127              
128             =head1 COPYRIGHT & LICENSE
129              
130             Copyright (c) 2017-2018 Stéphane Lavergne L<https://github.com/vphantom>
131              
132             Permission is hereby granted, free of charge, to any person obtaining a copy
133             of this software and associated documentation files (the "Software"), to deal
134             in the Software without restriction, including without limitation the rights
135             to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
136             copies of the Software, and to permit persons to whom the Software is
137             furnished to do so, subject to the following conditions:
138              
139             The above copyright notice and this permission notice shall be included in all
140             copies or substantial portions of the Software.
141              
142             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
143             IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144             FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
145             AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
146             LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
147             OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
148             SOFTWARE.
149              
150             =cut
151              
152             1;