|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace LAShowroom\TaxJarBundle\Model\Response; |
|
4
|
|
|
|
|
5
|
|
|
class TaxBreakdown |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* @var TaxDetail |
|
9
|
|
|
*/ |
|
10
|
|
|
private $totalTax; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @var TaxDetail |
|
14
|
|
|
*/ |
|
15
|
|
|
private $stateTax; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @var TaxDetail |
|
19
|
|
|
*/ |
|
20
|
|
|
private $countyTax; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var TaxDetail |
|
24
|
|
|
*/ |
|
25
|
|
|
private $cityTax; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var TaxDetail |
|
29
|
|
|
*/ |
|
30
|
|
|
private $specialDistrictTax; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var LineItem[] |
|
34
|
|
|
*/ |
|
35
|
|
|
private $lineItems = []; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @param \stdClass $response |
|
39
|
|
|
*/ |
|
40
|
6 |
|
public function __construct(\stdClass $response) |
|
41
|
|
|
{ |
|
42
|
6 |
|
$this->totalTax = new TaxDetail( |
|
43
|
6 |
|
$response->taxable_amount, |
|
44
|
6 |
|
$response->combined_tax_rate, |
|
45
|
6 |
|
$response->tax_collectable |
|
46
|
|
|
); |
|
47
|
6 |
|
$this->stateTax = new TaxDetail( |
|
48
|
6 |
|
$response->state_taxable_amount, |
|
49
|
6 |
|
$response->state_tax_rate, |
|
50
|
6 |
|
$response->state_tax_collectable |
|
51
|
|
|
); |
|
52
|
6 |
|
$this->countyTax = new TaxDetail( |
|
53
|
6 |
|
$response->county_taxable_amount, |
|
54
|
6 |
|
$response->county_tax_rate, |
|
55
|
6 |
|
$response->county_tax_collectable |
|
56
|
|
|
); |
|
57
|
6 |
|
$this->cityTax = new TaxDetail( |
|
58
|
6 |
|
$response->city_taxable_amount, |
|
59
|
6 |
|
$response->city_tax_rate, |
|
60
|
6 |
|
$response->city_tax_collectable |
|
61
|
|
|
); |
|
62
|
6 |
|
$this->specialDistrictTax = new TaxDetail( |
|
63
|
6 |
|
$response->special_district_taxable_amount, |
|
64
|
6 |
|
$response->special_tax_rate, |
|
65
|
6 |
|
$response->special_district_tax_collectable |
|
66
|
|
|
); |
|
67
|
|
|
|
|
68
|
6 |
|
foreach ($response->line_items as $line_item) { |
|
69
|
6 |
|
$this->lineItems[] = new LineItem( |
|
70
|
6 |
|
new TaxDetail( |
|
71
|
6 |
|
$line_item->taxable_amount, |
|
72
|
6 |
|
$line_item->combined_tax_rate, |
|
73
|
6 |
|
$line_item->tax_collectable |
|
74
|
|
|
), |
|
75
|
6 |
|
new TaxDetail( |
|
76
|
6 |
|
$line_item->state_taxable_amount, |
|
77
|
6 |
|
$line_item->state_sales_tax_rate, |
|
78
|
6 |
|
$line_item->state_amount |
|
79
|
|
|
), |
|
80
|
6 |
|
new TaxDetail( |
|
81
|
6 |
|
$line_item->county_taxable_amount, |
|
82
|
6 |
|
$line_item->county_tax_rate, |
|
83
|
6 |
|
$line_item->county_amount |
|
84
|
|
|
), |
|
85
|
6 |
|
new TaxDetail( |
|
86
|
6 |
|
$line_item->city_taxable_amount, |
|
87
|
6 |
|
$line_item->city_tax_rate, |
|
88
|
6 |
|
$line_item->city_amount |
|
89
|
|
|
), |
|
90
|
6 |
|
new TaxDetail( |
|
91
|
6 |
|
$line_item->special_district_taxable_amount, |
|
92
|
6 |
|
$line_item->special_tax_rate, |
|
93
|
6 |
|
$line_item->special_district_amount |
|
94
|
|
|
), |
|
95
|
6 |
|
$line_item->id |
|
96
|
|
|
); |
|
97
|
|
|
} |
|
98
|
6 |
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @return TaxDetail |
|
102
|
|
|
*/ |
|
103
|
2 |
|
public function getTotalTax() |
|
104
|
|
|
{ |
|
105
|
2 |
|
return $this->totalTax; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @return TaxDetail |
|
110
|
|
|
*/ |
|
111
|
2 |
|
public function getStateTax() |
|
112
|
|
|
{ |
|
113
|
2 |
|
return $this->stateTax; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @return TaxDetail |
|
118
|
|
|
*/ |
|
119
|
2 |
|
public function getCountyTax() |
|
120
|
|
|
{ |
|
121
|
2 |
|
return $this->countyTax; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* @return TaxDetail |
|
126
|
|
|
*/ |
|
127
|
2 |
|
public function getCityTax() |
|
128
|
|
|
{ |
|
129
|
2 |
|
return $this->cityTax; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @return TaxDetail |
|
134
|
|
|
*/ |
|
135
|
2 |
|
public function getSpecialDistrictTax() |
|
136
|
|
|
{ |
|
137
|
2 |
|
return $this->specialDistrictTax; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @return LineItem[] |
|
142
|
|
|
*/ |
|
143
|
2 |
|
public function getLineItems() |
|
144
|
|
|
{ |
|
145
|
2 |
|
return $this->lineItems; |
|
146
|
|
|
} |
|
147
|
|
|
} |
|
148
|
|
|
|