1 | <?php |
||
41 | final class OrderContext implements Context |
||
42 | { |
||
43 | /** |
||
44 | * @var SharedStorageInterface |
||
45 | */ |
||
46 | private $sharedStorage; |
||
47 | |||
48 | /** |
||
49 | * @var OrderRepositoryInterface |
||
50 | */ |
||
51 | private $orderRepository; |
||
52 | |||
53 | /** |
||
54 | * @var FactoryInterface |
||
55 | */ |
||
56 | private $orderFactory; |
||
57 | |||
58 | /** |
||
59 | * @var OrderShipmentProcessorInterface |
||
60 | */ |
||
61 | private $orderShipmentFactory; |
||
62 | |||
63 | /** |
||
64 | * @var PaymentFactoryInterface |
||
65 | */ |
||
66 | private $paymentFactory; |
||
67 | |||
68 | /** |
||
69 | * @var FactoryInterface |
||
70 | */ |
||
71 | private $orderItemFactory; |
||
72 | |||
73 | /** |
||
74 | * @var OrderItemQuantityModifierInterface |
||
75 | */ |
||
76 | private $itemQuantityModifier; |
||
77 | |||
78 | /** |
||
79 | * @var FactoryInterface |
||
80 | */ |
||
81 | private $customerFactory; |
||
82 | |||
83 | /** |
||
84 | * @var RepositoryInterface |
||
85 | */ |
||
86 | private $customerRepository; |
||
87 | |||
88 | /** |
||
89 | * @var OrderRecalculatorInterface |
||
90 | */ |
||
91 | private $orderRecalculator; |
||
92 | |||
93 | /** |
||
94 | * @var ObjectManager |
||
95 | */ |
||
96 | private $objectManager; |
||
97 | |||
98 | /** |
||
99 | * @param SharedStorageInterface $sharedStorage |
||
100 | * @param OrderRepositoryInterface $orderRepository |
||
101 | * @param FactoryInterface $orderFactory |
||
102 | * @param OrderShipmentProcessorInterface $orderShipmentFactory |
||
103 | * @param PaymentFactoryInterface $paymentFactory |
||
104 | * @param FactoryInterface $orderItemFactory |
||
105 | * @param OrderItemQuantityModifierInterface $itemQuantityModifier |
||
106 | * @param FactoryInterface $customerFactory |
||
107 | * @param RepositoryInterface $customerRepository |
||
108 | * @param OrderRecalculatorInterface $orderRecalculator |
||
109 | * @param ObjectManager $objectManager |
||
110 | */ |
||
111 | public function __construct( |
||
136 | |||
137 | /** |
||
138 | * @Given there is a customer :customer that placed an order :orderNumber |
||
139 | */ |
||
140 | public function thereIsCustomerThatPlacedOrder(CustomerInterface $customer, $orderNumber) |
||
148 | |||
149 | /** |
||
150 | * @Given /^the customer ("[^"]+" addressed it to "[^"]+", "[^"]+" "[^"]+" in the "[^"]+")$/ |
||
151 | */ |
||
152 | public function theCustomerAddressedItTo(AddressInterface $address) |
||
160 | |||
161 | /** |
||
162 | * @Given /^for the billing address (of "[^"]+" in the "[^"]+", "[^"]+" "[^"]+", "[^"]+")$/ |
||
163 | */ |
||
164 | public function forTheBillingAddressOf(AddressInterface $address) |
||
173 | |||
174 | /** |
||
175 | * @Given /^the customer chose ("[^"]+" shipping method) (to "[^"]+") with ("[^"]+" payment)$/ |
||
176 | */ |
||
177 | public function theCustomerChoseShippingToWithPayment( |
||
200 | |||
201 | /** |
||
202 | * @Given /^the customer chose ("[^"]+" shipping method) with ("[^"]+" payment)$/ |
||
203 | */ |
||
204 | public function theCustomerChoseShippingWithPayment( |
||
223 | |||
224 | /** |
||
225 | * @Given the customer bought a single :product |
||
226 | */ |
||
227 | public function theCustomerBoughtSingleProduct(ProductInterface $product) |
||
233 | |||
234 | /** |
||
235 | * @Given /^the customer bought ((?:a|an) "[^"]+") and ((?:a|an) "[^"]+")$/ |
||
236 | */ |
||
237 | public function theCustomerBoughtProductAndProduct(ProductInterface $product, ProductInterface $secondProduct) |
||
242 | |||
243 | |||
244 | /** |
||
245 | * @Given /^the customer bought (\d+) ("[^"]+" products)/ |
||
246 | */ |
||
247 | public function theCustomerBoughtSeveralProducts($quantity, ProductInterface $product) |
||
253 | |||
254 | /** |
||
255 | * @Given /^the customer bought a single ("[^"]+" variant of product "[^"]+")$/ |
||
256 | */ |
||
257 | public function theCustomerBoughtSingleProductVariant(ProductVariantInterface $productVariant) |
||
263 | |||
264 | /** |
||
265 | * @Given the customer bought a single :product using :coupon coupon |
||
266 | */ |
||
267 | public function theCustomerBoughtSingleUsing(ProductInterface $product, CouponInterface $coupon) |
||
276 | |||
277 | /** |
||
278 | * @Given /^(I) have already placed an order (\d+) times$/ |
||
279 | */ |
||
280 | public function iHaveAlreadyPlacedOrderNthTimes(UserInterface $user, $numberOfOrders) |
||
291 | |||
292 | /** |
||
293 | * @Given :numberOfCustomers customers have added products to the cart for total of :total |
||
294 | */ |
||
295 | public function customersHaveAddedProductsToTheCartForTotalOf($numberOfCustomers, $total) |
||
320 | |||
321 | /** |
||
322 | * @Given :numberOfCustomers customers have placed :numberOfOrders orders for total of :total |
||
323 | * @Given then :numberOfCustomers more customers have placed :numberOfOrders orders for total of :total |
||
324 | */ |
||
325 | public function customersHavePlacedOrdersForTotalOf($numberOfCustomers, $numberOfOrders, $total) |
||
350 | |||
351 | /** |
||
352 | * @param ProductVariantInterface $productVariant |
||
353 | * @param int $price |
||
354 | * @param int $quantity |
||
355 | * |
||
356 | * @return OrderInterface |
||
357 | */ |
||
358 | private function addProductVariantToOrder(ProductVariantInterface $productVariant, $price, $quantity = 1) |
||
375 | |||
376 | /** |
||
377 | * @param CustomerInterface $customer |
||
378 | * @param string $number |
||
379 | * @param ChannelInterface|null $channel |
||
380 | * @param CurrencyInterface|null $currency |
||
381 | * |
||
382 | * @return OrderInterface |
||
383 | */ |
||
384 | private function createOrder( |
||
400 | |||
401 | /** |
||
402 | * @param $count |
||
403 | * |
||
404 | * @return CustomerInterface[] |
||
405 | */ |
||
406 | private function generateCustomers($count) |
||
423 | |||
424 | /** |
||
425 | * @param string $price |
||
426 | * |
||
427 | * @return int |
||
428 | */ |
||
429 | private function getPriceFromString($price) |
||
433 | } |
||
434 |