1 | <?php |
||
23 | final class TaxContext implements Context |
||
24 | { |
||
25 | /** |
||
26 | * @var FactoryInterface |
||
27 | */ |
||
28 | private $taxRateFactory; |
||
29 | |||
30 | /** |
||
31 | * @var FactoryInterface |
||
32 | */ |
||
33 | private $taxCategoryFactory; |
||
34 | |||
35 | /** |
||
36 | * @var RepositoryInterface |
||
37 | */ |
||
38 | private $taxRateRepository; |
||
39 | |||
40 | /** |
||
41 | * @var RepositoryInterface |
||
42 | */ |
||
43 | private $taxCategoryRepository; |
||
44 | |||
45 | /** |
||
46 | * @var RepositoryInterface |
||
47 | */ |
||
48 | private $zoneRepository; |
||
49 | |||
50 | /** |
||
51 | * @param FactoryInterface $taxRateFactory |
||
52 | * @param FactoryInterface $taxCategoryFactory |
||
53 | * @param RepositoryInterface $taxRateRepository |
||
54 | * @param RepositoryInterface $taxCategoryRepository |
||
55 | * @param RepositoryInterface $zoneRepository |
||
56 | */ |
||
57 | public function __construct( |
||
70 | |||
71 | /** |
||
72 | * @Transform /^"([^"]+)" tax category$/ |
||
73 | * @Transform /^tax category "([^"]+)"$/ |
||
74 | */ |
||
75 | public function getTaxCategoryByName($taxCategoryName) |
||
84 | |||
85 | /** |
||
86 | * @Given the store has :taxRateName tax rate of :taxRateAmount% for :taxCategoryName within :zone zone |
||
87 | * @Given /^the store has "([^"]+)" tax rate of ([^"]+)% for "([^"]+)" for (the rest of the world)$/ |
||
88 | */ |
||
89 | public function storeHasTaxRateWithinZone($taxRateName, $taxRateAmount, $taxCategoryName, ZoneInterface $zone) |
||
103 | |||
104 | /** |
||
105 | * @param string $taxCategoryName |
||
106 | * |
||
107 | * @return TaxCategoryInterface |
||
108 | */ |
||
109 | private function getOrCreateTaxCategory($taxCategoryName) |
||
117 | |||
118 | /** |
||
119 | * @param string $taxCategoryName |
||
120 | * |
||
121 | * @return TaxCategoryInterface |
||
122 | */ |
||
123 | private function createTaxCategory($taxCategoryName) |
||
133 | |||
134 | /** |
||
135 | * @param string $taxRateAmount |
||
136 | * |
||
137 | * @return string |
||
138 | */ |
||
139 | private function getAmountFromString($taxRateAmount) |
||
143 | |||
144 | /** |
||
145 | * @param string $taxRateName |
||
146 | * |
||
147 | * @return string |
||
148 | */ |
||
149 | private function getCodeFromName($taxRateName) |
||
153 | |||
154 | /** |
||
155 | * @param string $taxRateName |
||
156 | * @param string $zoneCode |
||
157 | * |
||
158 | * @return string |
||
159 | */ |
||
160 | private function getCodeFromNameAndZoneCode($taxRateName, $zoneCode) |
||
164 | } |
||
165 |