1 | <?php |
||
40 | final class OrderContext implements Context |
||
41 | { |
||
42 | /** |
||
43 | * @var SharedStorageInterface |
||
44 | */ |
||
45 | private $sharedStorage; |
||
46 | |||
47 | /** |
||
48 | * @var OrderRepositoryInterface |
||
49 | */ |
||
50 | private $orderRepository; |
||
51 | |||
52 | /** |
||
53 | * @var FactoryInterface |
||
54 | */ |
||
55 | private $orderFactory; |
||
56 | |||
57 | /** |
||
58 | * @var OrderShipmentProcessorInterface |
||
59 | */ |
||
60 | private $orderShipmentFactory; |
||
61 | |||
62 | /** |
||
63 | * @var PaymentFactoryInterface |
||
64 | */ |
||
65 | private $paymentFactory; |
||
66 | |||
67 | /** |
||
68 | * @var FactoryInterface |
||
69 | */ |
||
70 | private $orderItemFactory; |
||
71 | |||
72 | /** |
||
73 | * @var OrderItemQuantityModifierInterface |
||
74 | */ |
||
75 | private $itemQuantityModifier; |
||
76 | |||
77 | /** |
||
78 | * @var OrderRecalculatorInterface |
||
79 | */ |
||
80 | private $orderRecalculator; |
||
81 | |||
82 | /** |
||
83 | * @var ObjectManager |
||
84 | */ |
||
85 | private $objectManager; |
||
86 | |||
87 | /** |
||
88 | * @param SharedStorageInterface $sharedStorage |
||
89 | * @param OrderRepositoryInterface $orderRepository |
||
90 | * @param FactoryInterface $orderFactory |
||
91 | * @param OrderShipmentProcessorInterface $orderShipmentFactory |
||
92 | * @param PaymentFactoryInterface $paymentFactory |
||
93 | * @param FactoryInterface $orderItemFactory |
||
94 | * @param OrderItemQuantityModifierInterface $itemQuantityModifier |
||
95 | * @param SharedStorageInterface $sharedStorage |
||
96 | * @param OrderRecalculatorInterface $orderRecalculator |
||
97 | * @param ObjectManager $objectManager |
||
98 | */ |
||
99 | public function __construct( |
||
120 | |||
121 | /** |
||
122 | * @Given there is a customer :customer that placed an order :orderNumber |
||
123 | */ |
||
124 | public function thereIsCustomerThatPlacedOrder(CustomerInterface $customer, $orderNumber) |
||
132 | |||
133 | /** |
||
134 | * @Given /^the customer ("[^"]+" addressed it to "[^"]+", "[^"]+" "[^"]+" in the "[^"]+")$/ |
||
135 | */ |
||
136 | public function theCustomerAddressedItTo(AddressInterface $address) |
||
144 | |||
145 | /** |
||
146 | * @Given /^for the billing address (of "[^"]+" in the "[^"]+", "[^"]+" "[^"]+", "[^"]+")$/ |
||
147 | */ |
||
148 | public function forTheBillingAddressOf(AddressInterface $address) |
||
157 | |||
158 | /** |
||
159 | * @Given /^the customer chose ("[^"]+" shipping method) (to "[^"]+") with ("[^"]+" payment)$/ |
||
160 | */ |
||
161 | public function theCustomerChoseShippingToWithPayment( |
||
184 | |||
185 | /** |
||
186 | * @Given /^the customer chose ("[^"]+" shipping method) with ("[^"]+" payment)$/ |
||
187 | */ |
||
188 | public function theCustomerChoseShippingWithPayment( |
||
207 | |||
208 | /** |
||
209 | * @Given the customer bought a single :product |
||
210 | */ |
||
211 | public function theCustomerBoughtSingleProduct(ProductInterface $product) |
||
217 | |||
218 | /** |
||
219 | * @Given /^the customer bought ((?:a|an) "[^"]+") and ((?:a|an) "[^"]+")$/ |
||
220 | */ |
||
221 | public function theCustomerBoughtProductAndProduct(ProductInterface $product, ProductInterface $secondProduct) |
||
226 | |||
227 | |||
228 | /** |
||
229 | * @Given /^the customer bought (\d+) ("[^"]+" products)/ |
||
230 | */ |
||
231 | public function theCustomerBoughtSeveralProducts($quantity, ProductInterface $product) |
||
237 | |||
238 | /** |
||
239 | * @Given /^the customer bought a single ("[^"]+" variant of product "[^"]+")$/ |
||
240 | */ |
||
241 | public function theCustomerBoughtSingleProductVariant(ProductVariantInterface $productVariant) |
||
247 | |||
248 | /** |
||
249 | * @Given the customer bought a single :product using :coupon coupon |
||
250 | */ |
||
251 | public function theCustomerBoughtSingleUsing(ProductInterface $product, CouponInterface $coupon) |
||
260 | |||
261 | /** |
||
262 | * @Given /^(I) have already placed an order (\d+) times$/ |
||
263 | */ |
||
264 | public function iHaveAlreadyPlacedOrderNthTimes(UserInterface $user, $numberOfOrders) |
||
275 | |||
276 | /** |
||
277 | * @param ProductVariantInterface $productVariant |
||
278 | * @param int $price |
||
279 | * @param int $quantity |
||
280 | * |
||
281 | * @return OrderInterface |
||
282 | */ |
||
283 | private function addProductVariantToOrder(ProductVariantInterface $productVariant, $price, $quantity = 1) |
||
300 | |||
301 | /** |
||
302 | * @param CustomerInterface $customer |
||
303 | * @param string $number |
||
304 | * @param ChannelInterface|null $channel |
||
305 | * @param CurrencyInterface|null $currency |
||
306 | * |
||
307 | * @return OrderInterface |
||
308 | */ |
||
309 | private function createOrder( |
||
325 | } |
||
326 |