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