Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like ShoppingService often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use ShoppingService, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
56 | class ShoppingService |
||
|
|||
57 | { |
||
58 | /** |
||
59 | * @var MailTemplateRepository |
||
60 | */ |
||
61 | protected $mailTemplateRepository; |
||
62 | |||
63 | /** |
||
64 | * @var MailService |
||
65 | */ |
||
66 | protected $mailService; |
||
67 | |||
68 | /** |
||
69 | * @var EventDispatcher |
||
70 | */ |
||
71 | protected $eventDispatcher; |
||
72 | |||
73 | /** |
||
74 | * @var FormFactory |
||
75 | */ |
||
76 | protected $formFactory; |
||
77 | |||
78 | /** |
||
79 | * @var DeliveryFeeRepository |
||
80 | */ |
||
81 | protected $deliveryFeeRepository; |
||
82 | |||
83 | /** |
||
84 | * @var TaxRuleRepository |
||
85 | */ |
||
86 | protected $taxRuleRepository; |
||
87 | |||
88 | /** |
||
89 | * @var CustomerAddressRepository |
||
90 | */ |
||
91 | protected $customerAddressRepository; |
||
92 | |||
93 | /** |
||
94 | * @var DeliveryRepository |
||
95 | */ |
||
96 | protected $deliveryRepository; |
||
97 | |||
98 | /** |
||
99 | * @var DeliveryTimeRepository |
||
100 | */ |
||
101 | protected $deliveryTimeRepository; |
||
102 | |||
103 | /** |
||
104 | * @var OrderStatusRepository |
||
105 | */ |
||
106 | protected $orderStatusRepository; |
||
107 | |||
108 | /** |
||
109 | * @var PaymentRepository |
||
110 | */ |
||
111 | protected $paymentRepository; |
||
112 | |||
113 | /** |
||
114 | * @var DeviceTypeRepository |
||
115 | */ |
||
116 | protected $deviceTypeRepository; |
||
117 | |||
118 | /** |
||
119 | * @var EntityManager |
||
120 | */ |
||
121 | protected $entityManager; |
||
122 | |||
123 | /** |
||
124 | * @var EccubeConfig |
||
125 | */ |
||
126 | protected $eccubeConfig; |
||
127 | |||
128 | /** |
||
129 | * @var PrefRepository |
||
130 | */ |
||
131 | protected $prefRepository; |
||
132 | |||
133 | /** |
||
134 | * @var Session |
||
135 | */ |
||
136 | protected $session; |
||
137 | |||
138 | /** |
||
139 | * @var OrderRepository |
||
140 | */ |
||
141 | protected $orderRepository; |
||
142 | |||
143 | /** |
||
144 | * @var BaseInfo |
||
145 | */ |
||
146 | protected $BaseInfo; |
||
147 | |||
148 | /** |
||
149 | * @var \Eccube\Service\CartService |
||
150 | */ |
||
151 | protected $cartService; |
||
152 | |||
153 | /** |
||
154 | * @var \Eccube\Service\OrderService |
||
155 | * |
||
156 | * @deprecated |
||
157 | */ |
||
158 | protected $orderService; |
||
159 | |||
160 | /** |
||
161 | * @var AuthorizationCheckerInterface |
||
162 | */ |
||
163 | protected $authorizationChecker; |
||
164 | |||
165 | /** |
||
166 | * @var \Mobile_Detect |
||
167 | */ |
||
168 | protected $mobileDetect; |
||
169 | |||
170 | /** |
||
171 | * ShoppingService constructor. |
||
172 | * |
||
173 | * @param MailTemplateRepository $mailTemplateRepository |
||
174 | * @param MailService $mailService |
||
175 | * @param EventDispatcher $eventDispatcher |
||
176 | * @param FormFactory $formFactory |
||
177 | * @param DeliveryFeeRepository $deliveryFeeRepository |
||
178 | * @param TaxRuleRepository $taxRuleRepository |
||
179 | * @param CustomerAddressRepository $customerAddressRepository |
||
180 | * @param DeliveryRepository $deliveryRepository |
||
181 | * @param DeliveryTimeRepository $deliveryTimeRepository |
||
182 | * @param OrderStatusRepository $orderStatusRepository |
||
183 | * @param PaymentRepository $paymentRepository |
||
184 | * @param DeviceTypeRepository $deviceTypeRepository |
||
185 | * @param EntityManager $entityManager |
||
186 | * @param EccubeConfig $eccubeConfig |
||
187 | * @param PrefRepository $prefRepository |
||
188 | * @param Session $session |
||
189 | * @param OrderRepository $orderRepository |
||
190 | * @param CartService $cartService |
||
191 | * @param OrderService $orderService |
||
192 | * @param BaseInfo $BaseInfo |
||
193 | * @param AuthorizationCheckerInterface $authorizationChecker |
||
194 | * @param \Mobile_Detect $mobileDetect |
||
195 | */ |
||
196 | 59 | public function __construct( |
|
197 | MailTemplateRepository $mailTemplateRepository, |
||
198 | MailService $mailService, |
||
199 | EventDispatcherInterface $eventDispatcher, |
||
200 | FormFactoryInterface $formFactory, |
||
201 | DeliveryFeeRepository $deliveryFeeRepository, |
||
202 | TaxRuleRepository $taxRuleRepository, |
||
203 | CustomerAddressRepository $customerAddressRepository, |
||
204 | DeliveryRepository $deliveryRepository, |
||
205 | DeliveryTimeRepository $deliveryTimeRepository, |
||
206 | OrderStatusRepository $orderStatusRepository, |
||
207 | PaymentRepository $paymentRepository, |
||
208 | DeviceTypeRepository $deviceTypeRepository, |
||
209 | EntityManagerInterface $entityManager, |
||
210 | EccubeConfig $eccubeConfig, |
||
211 | PrefRepository $prefRepository, |
||
212 | SessionInterface $session, |
||
213 | OrderRepository $orderRepository, |
||
214 | CartService $cartService, |
||
215 | OrderService $orderService, |
||
216 | BaseInfo $BaseInfo, |
||
217 | AuthorizationCheckerInterface $authorizationChecker, |
||
218 | \Mobile_Detect $mobileDetect |
||
219 | ) { |
||
220 | 59 | $this->mailTemplateRepository = $mailTemplateRepository; |
|
221 | 59 | $this->mailService = $mailService; |
|
222 | 59 | $this->eventDispatcher = $eventDispatcher; |
|
223 | 59 | $this->formFactory = $formFactory; |
|
224 | 59 | $this->deliveryFeeRepository = $deliveryFeeRepository; |
|
225 | 59 | $this->taxRuleRepository = $taxRuleRepository; |
|
226 | 59 | $this->customerAddressRepository = $customerAddressRepository; |
|
227 | 59 | $this->deliveryRepository = $deliveryRepository; |
|
228 | 59 | $this->deliveryTimeRepository = $deliveryTimeRepository; |
|
229 | 59 | $this->orderStatusRepository = $orderStatusRepository; |
|
230 | 59 | $this->paymentRepository = $paymentRepository; |
|
231 | 59 | $this->deviceTypeRepository = $deviceTypeRepository; |
|
232 | 59 | $this->entityManager = $entityManager; |
|
233 | 59 | $this->eccubeConfig = $eccubeConfig; |
|
234 | 59 | $this->prefRepository = $prefRepository; |
|
235 | 59 | $this->session = $session; |
|
236 | 59 | $this->orderRepository = $orderRepository; |
|
237 | 59 | $this->cartService = $cartService; |
|
238 | 59 | $this->orderService = $orderService; |
|
239 | 59 | $this->BaseInfo = $BaseInfo; |
|
240 | 59 | $this->authorizationChecker = $authorizationChecker; |
|
241 | 59 | $this->mobileDetect = $mobileDetect; |
|
242 | } |
||
243 | |||
244 | /** |
||
245 | * セッションにセットされた受注情報を取得 |
||
246 | * |
||
247 | * @param null $status |
||
248 | * |
||
249 | * @return null|object |
||
250 | */ |
||
251 | 51 | public function getOrder($status = null) |
|
252 | { |
||
253 | // 受注データを取得 |
||
254 | 51 | $preOrderId = $this->cartService->getPreOrderId(); |
|
255 | 51 | if (!$preOrderId) { |
|
256 | 51 | return null; |
|
257 | } |
||
258 | |||
259 | $condition = [ |
||
260 | 40 | 'pre_order_id' => $preOrderId, |
|
261 | ]; |
||
262 | |||
263 | 40 | if (!is_null($status)) { |
|
264 | $condition += [ |
||
265 | 40 | 'OrderStatus' => $status, |
|
266 | ]; |
||
267 | } |
||
268 | |||
269 | 40 | $Order = $this->orderRepository->findOneBy($condition); |
|
270 | |||
271 | 40 | return $Order; |
|
272 | } |
||
273 | |||
274 | /** |
||
275 | * 非会員情報を取得 |
||
276 | * |
||
277 | * @param $sesisonKey |
||
278 | * |
||
279 | * @return $Customer|null |
||
280 | */ |
||
281 | public function getNonMember($sesisonKey) |
||
282 | { |
||
283 | if ($NonMember = $this->session->get($sesisonKey)) { |
||
284 | $Pref = $this->prefRepository->find($NonMember->getPref()->getId()); |
||
285 | $NonMember->setPref($Pref); |
||
286 | |||
287 | return $NonMember; |
||
288 | } |
||
289 | } |
||
290 | |||
291 | /** |
||
292 | * 受注情報を作成 |
||
293 | * |
||
294 | * @param $Customer |
||
295 | * |
||
296 | * @return \Eccube\Entity\Order |
||
297 | */ |
||
298 | public function createOrder($Customer) |
||
299 | { |
||
300 | // ランダムなpre_order_idを作成 |
||
301 | View Code Duplication | do { |
|
302 | $preOrderId = sha1(StringUtil::random(32)); |
||
303 | $Order = $this->orderRepository->findOneBy([ |
||
304 | 'pre_order_id' => $preOrderId, |
||
305 | 'OrderStatus' => OrderStatus::PROCESSING, |
||
306 | ]); |
||
307 | } while ($Order); |
||
308 | |||
309 | // 受注情報、受注明細情報、お届け先情報、配送商品情報を作成 |
||
310 | $Order = $this->registerPreOrder( |
||
311 | $Customer, |
||
312 | $preOrderId); |
||
313 | |||
314 | $this->cartService->setPreOrderId($preOrderId); |
||
315 | $this->cartService->save(); |
||
316 | |||
317 | return $Order; |
||
318 | } |
||
319 | |||
320 | /** |
||
321 | * 仮受注情報作成 |
||
322 | * |
||
323 | * @param $Customer |
||
324 | * @param $preOrderId |
||
325 | * |
||
326 | * @return mixed |
||
327 | * |
||
328 | * @throws \Doctrine\ORM\NoResultException |
||
329 | * @throws \Doctrine\ORM\NonUniqueResultException |
||
330 | */ |
||
331 | public function registerPreOrder(Customer $Customer, $preOrderId) |
||
332 | { |
||
333 | $this->em = $this->entityManager; |
||
334 | |||
335 | // 受注情報を作成 |
||
336 | $Order = $this->getNewOrder($Customer); |
||
337 | $Order->setPreOrderId($preOrderId); |
||
338 | |||
339 | $DeviceType = $this->deviceTypeRepository->find($this->mobileDetect->isMobile() ? DeviceType::DEVICE_TYPE_SP : DeviceType::DEVICE_TYPE_PC); |
||
340 | $Order->setDeviceType($DeviceType); |
||
341 | |||
342 | $this->entityManager->persist($Order); |
||
343 | |||
344 | // 配送業者情報を取得 |
||
345 | $deliveries = $this->getDeliveriesCart(); |
||
346 | |||
347 | // お届け先情報を作成 |
||
348 | $Order = $this->getNewShipping($Order, $Customer, $deliveries); |
||
349 | |||
350 | // 受注明細情報、配送商品情報を作成 |
||
351 | $Order = $this->getNewDetails($Order); |
||
352 | |||
353 | // 小計 |
||
354 | $subTotal = $this->orderService->getSubTotal($Order); |
||
355 | |||
356 | // 消費税のみの小計 |
||
357 | $tax = $this->orderService->getTotalTax($Order); |
||
358 | |||
359 | // 配送料合計金額 |
||
360 | // TODO CalculateDeliveryFeeStrategy でセットする |
||
361 | // $Order->setDeliveryFeeTotal($this->getShippingDeliveryFeeTotal($Order->getShippings())); |
||
362 | |||
363 | // 小計 |
||
364 | $Order->setSubTotal($subTotal); |
||
365 | |||
366 | // 配送料無料条件(合計金額) |
||
367 | $this->setDeliveryFreeAmount($Order); |
||
368 | |||
369 | // 配送料無料条件(合計数量) |
||
370 | $this->setDeliveryFreeQuantity($Order); |
||
371 | |||
372 | // 初期選択の支払い方法をセット |
||
373 | $payments = $this->paymentRepository->findAllowedPayments($deliveries, true, $Order); |
||
374 | |||
375 | if (count($payments) > 0) { |
||
376 | $payment = $payments[0]; |
||
377 | $Order->setPayment($payment); |
||
378 | $Order->setPaymentMethod($payment->getMethod()); |
||
379 | $Order->setCharge($payment->getCharge()); |
||
380 | } else { |
||
381 | $Order->setCharge(0); |
||
382 | } |
||
383 | |||
384 | $Order->setTax($tax); |
||
385 | |||
386 | // 合計金額の計算 |
||
387 | $this->calculatePrice($Order); |
||
388 | |||
389 | $this->entityManager->flush(); |
||
390 | |||
391 | return $Order; |
||
392 | } |
||
393 | |||
394 | /** |
||
395 | * 受注情報を作成 |
||
396 | * |
||
397 | * @param $Customer |
||
398 | * |
||
399 | * @return \Eccube\Entity\Order |
||
400 | */ |
||
401 | public function getNewOrder(Customer $Customer) |
||
402 | { |
||
403 | $Order = $this->newOrder(); |
||
404 | $this->copyToOrderFromCustomer($Order, $Customer); |
||
405 | |||
406 | return $Order; |
||
407 | } |
||
408 | |||
409 | /** |
||
410 | * 受注情報を作成 |
||
411 | * |
||
412 | * @return \Eccube\Entity\Order |
||
413 | */ |
||
414 | public function newOrder() |
||
415 | { |
||
416 | $OrderStatus = $this->orderStatusRepository->find(OrderStatus::PROCESSING); |
||
417 | $Order = new \Eccube\Entity\Order($OrderStatus); |
||
418 | |||
419 | return $Order; |
||
420 | } |
||
421 | |||
422 | /** |
||
423 | * 受注情報を作成 |
||
424 | * |
||
425 | * @param \Eccube\Entity\Order $Order |
||
426 | * @param \Eccube\Entity\Customer|null $Customer |
||
427 | * |
||
428 | * @return \Eccube\Entity\Order |
||
429 | */ |
||
430 | public function copyToOrderFromCustomer(Order $Order, Customer $Customer = null) |
||
431 | { |
||
432 | if (is_null($Customer)) { |
||
433 | return $Order; |
||
434 | } |
||
435 | |||
436 | if ($Customer->getId()) { |
||
437 | $Order->setCustomer($Customer); |
||
438 | } |
||
439 | $Order |
||
440 | ->setName01($Customer->getName01()) |
||
441 | ->setName02($Customer->getName02()) |
||
442 | ->setKana01($Customer->getKana01()) |
||
443 | ->setKana02($Customer->getKana02()) |
||
444 | ->setCompanyName($Customer->getCompanyName()) |
||
445 | ->setEmail($Customer->getEmail()) |
||
446 | ->setPhoneNumber($Customer->getPhoneNumber()) |
||
447 | ->setPostalCode($Customer->getPostalCode()) |
||
448 | ->setPref($Customer->getPref()) |
||
449 | ->setAddr01($Customer->getAddr01()) |
||
450 | ->setAddr02($Customer->getAddr02()) |
||
451 | ->setSex($Customer->getSex()) |
||
452 | ->setBirth($Customer->getBirth()) |
||
453 | ->setJob($Customer->getJob()); |
||
454 | |||
455 | return $Order; |
||
456 | } |
||
457 | |||
458 | /** |
||
459 | * 配送業者情報を取得 |
||
460 | * |
||
461 | * @return array |
||
462 | */ |
||
463 | public function getDeliveriesCart() |
||
470 | |||
471 | /** |
||
472 | * 配送業者情報を取得 |
||
473 | * |
||
474 | * @param Order $Order |
||
475 | * |
||
476 | * @return array |
||
477 | */ |
||
478 | public function getDeliveriesOrder(Order $Order) |
||
485 | |||
486 | /** |
||
487 | * 配送業者情報を取得 |
||
488 | * |
||
489 | * @param $saleTypes |
||
490 | * @param $Order |
||
491 | * |
||
492 | * @return array |
||
493 | */ |
||
494 | public function getDeliveries($saleTypes, Order $Order = null) |
||
495 | { |
||
496 | // 販売種別に紐づく配送業者を取得 |
||
497 | $deliveries = $this->deliveryRepository->getDeliveries($saleTypes); |
||
498 | $deliveries = $this->filterDeliveries($deliveries, $Order); |
||
499 | |||
500 | return $deliveries; |
||
501 | } |
||
502 | |||
503 | /** |
||
504 | * お届け先情報を作成 |
||
505 | * |
||
506 | * @param Order $Order |
||
507 | * @param Customer $Customer |
||
508 | * @param $deliveries |
||
509 | * |
||
510 | * @return Order |
||
511 | */ |
||
512 | public function getNewShipping(Order $Order, Customer $Customer, $deliveries) |
||
537 | |||
538 | /** |
||
539 | * お届け先情報を作成 |
||
540 | * |
||
541 | * @param \Eccube\Entity\Shipping $Shipping |
||
542 | * @param \Eccube\Entity\Customer|null $Customer |
||
543 | * |
||
544 | * @return \Eccube\Entity\Shipping |
||
545 | */ |
||
546 | public function copyToShippingFromCustomer(Shipping $Shipping, Customer $Customer = null) |
||
586 | |||
587 | /** |
||
588 | * 受注明細情報、配送商品情報を作成 |
||
589 | * |
||
590 | * @param Order $Order |
||
591 | * |
||
592 | * @return Order |
||
593 | */ |
||
594 | public function getNewDetails(Order $Order) |
||
612 | |||
613 | /** |
||
614 | * 配送商品情報を作成 |
||
615 | * |
||
616 | * @param Order $Order |
||
617 | * @param Product $Product |
||
618 | * @param ProductClass $ProductClass |
||
619 | * @param $quantity |
||
620 | * |
||
621 | * @return \Eccube\Entity\OrderItem |
||
622 | */ |
||
623 | public function getNewOrderItem(Order $Order, Product $Product, ProductClass $ProductClass, $quantity) |
||
680 | |||
681 | /** |
||
682 | * お届け先ごとの送料合計を取得 |
||
683 | * |
||
684 | * @param $shippings |
||
685 | * |
||
686 | * @return int |
||
687 | */ |
||
688 | public function getShippingDeliveryFeeTotal($shippings) |
||
697 | |||
698 | /** |
||
699 | * 商品ごとの配送料を取得 |
||
700 | * |
||
701 | * @param Shipping $Shipping |
||
702 | * |
||
703 | * @return int |
||
704 | */ |
||
705 | public function getProductDeliveryFee(Shipping $Shipping) |
||
716 | |||
717 | /** |
||
718 | * 住所などの情報が変更された時に金額の再計算を行う |
||
719 | * |
||
720 | * @deprecated PurchaseFlowで行う |
||
721 | * |
||
722 | * @param Order $Order |
||
723 | * |
||
724 | * @return Order |
||
725 | */ |
||
726 | public function getAmount(Order $Order) |
||
746 | |||
747 | /** |
||
748 | * 配送料金の設定 |
||
749 | * |
||
750 | * @param Shipping $Shipping |
||
751 | * @param Delivery|null $Delivery |
||
752 | */ |
||
753 | public function setShippingDeliveryFee(Shipping $Shipping, Delivery $Delivery = null) |
||
774 | |||
775 | /** |
||
776 | * 配送料無料条件(合計金額)の条件を満たしていれば配送料金を0に設定 |
||
777 | * |
||
778 | * @param Order $Order |
||
779 | */ |
||
780 | View Code Duplication | public function setDeliveryFreeAmount(Order $Order) |
|
781 | { |
||
782 | // 配送料無料条件(合計金額) |
||
783 | $deliveryFreeAmount = $this->BaseInfo->getDeliveryFreeAmount(); |
||
784 | if (!is_null($deliveryFreeAmount)) { |
||
785 | // 合計金額が設定金額以上であれば送料無料 |
||
786 | if ($Order->getSubTotal() >= $deliveryFreeAmount) { |
||
787 | $Order->setDeliveryFeeTotal(0); |
||
788 | // お届け先情報の配送料も0にセット |
||
789 | $shippings = $Order->getShippings(); |
||
790 | foreach ($shippings as $Shipping) { |
||
791 | $Shipping->setShippingDeliveryFee(0); |
||
792 | } |
||
793 | } |
||
794 | } |
||
795 | } |
||
796 | |||
797 | /** |
||
798 | * 配送料無料条件(合計数量)の条件を満たしていれば配送料金を0に設定 |
||
799 | * |
||
800 | * @param Order $Order |
||
801 | */ |
||
802 | View Code Duplication | public function setDeliveryFreeQuantity(Order $Order) |
|
803 | { |
||
804 | // 配送料無料条件(合計数量) |
||
805 | $deliveryFreeQuantity = $this->BaseInfo->getDeliveryFreeQuantity(); |
||
806 | if (!is_null($deliveryFreeQuantity)) { |
||
807 | // 合計数量が設定数量以上であれば送料無料 |
||
808 | if ($this->orderService->getTotalQuantity($Order) >= $deliveryFreeQuantity) { |
||
809 | $Order->setDeliveryFeeTotal(0); |
||
810 | // お届け先情報の配送料も0にセット |
||
811 | $shippings = $Order->getShippings(); |
||
812 | foreach ($shippings as $Shipping) { |
||
813 | $Shipping->setShippingDeliveryFee(0); |
||
814 | } |
||
815 | } |
||
816 | } |
||
817 | } |
||
818 | |||
819 | /** |
||
820 | * 受注情報、お届け先情報の更新 |
||
821 | * |
||
822 | * @param Order $Order 受注情報 |
||
823 | * @param $data フォームデータ |
||
824 | * |
||
825 | * @deprecated since 3.0.5, to be removed in 3.1 |
||
826 | */ |
||
827 | public function setOrderUpdate(Order $Order, $data) |
||
860 | |||
861 | /** |
||
862 | * 受注情報の更新 |
||
863 | * |
||
864 | * @param Order $Order 受注情報 |
||
865 | */ |
||
866 | 6 | public function setOrderUpdateData(Order $Order) |
|
873 | |||
874 | /** |
||
875 | * 会員情報の更新 |
||
876 | * |
||
877 | * @param Order $Order 受注情報 |
||
878 | * @param Customer $user ログインユーザ |
||
879 | */ |
||
880 | public function setCustomerUpdate(Order $Order, Customer $user) |
||
893 | |||
894 | /** |
||
895 | * お届け日を取得 |
||
896 | * |
||
897 | * @param Order $Order |
||
898 | * |
||
899 | * @return array |
||
900 | */ |
||
901 | public function getFormDeliveryDurations(Order $Order) |
||
902 | { |
||
947 | |||
948 | /** |
||
949 | * 支払方法を取得 |
||
950 | * |
||
951 | * @param $deliveries |
||
952 | * @param Order $Order |
||
953 | * |
||
954 | * @return array |
||
955 | */ |
||
956 | public function getFormPayments($deliveries, Order $Order) |
||
962 | |||
963 | /** |
||
964 | * お届け先ごとにFormを作成 |
||
965 | * |
||
966 | * @param Order $Order |
||
967 | * |
||
968 | * @return \Symfony\Component\Form\Form |
||
969 | * |
||
970 | * @deprecated since 3.0, to be removed in 3.1 |
||
971 | */ |
||
972 | View Code Duplication | public function getShippingForm(Order $Order) |
|
997 | |||
998 | /** |
||
999 | * お届け先ごとにFormBuilderを作成 |
||
1000 | * |
||
1001 | * @param Order $Order |
||
1002 | * |
||
1003 | * @return \Symfony\Component\Form\FormBuilderInterface |
||
1004 | * |
||
1005 | * @deprecated 利用している箇所なし |
||
1006 | */ |
||
1007 | View Code Duplication | public function getShippingFormBuilder(Order $Order) |
|
1030 | |||
1031 | /** |
||
1032 | * フォームデータを更新 |
||
1033 | * |
||
1034 | * @param Order $Order |
||
1035 | * @param array $data |
||
1036 | * |
||
1037 | * @deprecated |
||
1038 | */ |
||
1039 | public function setFormData(Order $Order, array $data) |
||
1058 | |||
1059 | /** |
||
1060 | * 配送料の合計金額を計算 |
||
1061 | * |
||
1062 | * @param Order $Order |
||
1063 | * |
||
1064 | * @return Order |
||
1065 | */ |
||
1066 | public function calculateDeliveryFee(Order $Order) |
||
1083 | |||
1084 | /** |
||
1085 | * 購入処理を行う |
||
1086 | * |
||
1087 | * @param Order $Order |
||
1088 | * |
||
1089 | * @deprecated PurchaseFlow::purchase() を使用してください |
||
1090 | */ |
||
1091 | public function processPurchase(Order $Order) |
||
1101 | |||
1102 | /** |
||
1103 | * 値引き可能かチェック |
||
1104 | * |
||
1105 | * @param Order $Order |
||
1106 | * @param $discount |
||
1107 | * |
||
1108 | * @return bool |
||
1109 | */ |
||
1110 | public function isDiscount(Order $Order, $discount) |
||
1118 | |||
1119 | /** |
||
1120 | * 値引き金額をセット |
||
1121 | * |
||
1122 | * @param Order $Order |
||
1123 | * @param $discount |
||
1124 | */ |
||
1125 | public function setDiscount(Order $Order, $discount) |
||
1129 | |||
1130 | /** |
||
1131 | * 合計金額を計算 |
||
1132 | * |
||
1133 | * @param Order $Order |
||
1134 | * |
||
1135 | * @return Order |
||
1136 | */ |
||
1137 | public function calculatePrice(Order $Order) |
||
1151 | |||
1152 | /** |
||
1153 | * 受注ステータスをセット |
||
1154 | * |
||
1155 | * @param Order $Order |
||
1156 | * @param $status |
||
1157 | * |
||
1158 | * @return Order |
||
1159 | */ |
||
1160 | 6 | public function setOrderStatus(Order $Order, $status) |
|
1175 | |||
1176 | /** |
||
1177 | * 受注メール送信を行う |
||
1178 | * |
||
1179 | * @param Order $Order |
||
1180 | * |
||
1181 | * @return MailHistory |
||
1182 | */ |
||
1183 | 6 | public function sendOrderMail(Order $Order) |
|
1201 | |||
1202 | /** |
||
1203 | * 受注処理完了通知 |
||
1204 | * |
||
1205 | * @param Order $Order |
||
1206 | */ |
||
1207 | public function notifyComplete(Order $Order) |
||
1217 | |||
1218 | /** |
||
1219 | * Filter deliveries match to multi shipping |
||
1220 | * |
||
1221 | * @param array $Deliveries |
||
1222 | * @param Order $Order |
||
1223 | * |
||
1224 | * @return array |
||
1225 | */ |
||
1226 | 50 | public function filterDeliveries(array $Deliveries, Order $Order = null) |
|
1242 | } |
||
1243 |