function validRequired() { if ($this->productPrice <= 0) { throw new \InvalidArgumentException("product price field couldn't be zero. check yours input value : " . $this->productPrice); } if (!isset($this->productDeliveryInfo)) { throw new \InvalidArgumentException("you should contain ProductDeliveryInfo object."); } $this->productDeliveryInfo->validRequired(); foreach ($this->offerList as $offer) { if (is_object($offer) && $offer instanceof Offer) { $offer->validRequired(); } } foreach ($this->loyaltyList as $loyalty) { if (is_object($loyalty) && $loyalty instanceof Loyalty) { $loyalty->validRequired(); } } foreach ($this->shippingAddressList as $shippingAddress) { if (is_object($shippingAddress) && $shippingAddress instanceof ShippingAddress) { $shippingAddress->validRequiredToCheckout(); } } foreach ($this->monthlyInstallmentList as $monthlyInstallment) { if (is_object($monthlyInstallment) && $monthlyInstallment instanceof MonthlyInstallment) { $monthlyInstallment->validRequired(); } } }
public static function getDeliveryInfo() { $deliveryInfo = new ProductDeliveryInfo(); self::$productDeliveryInfoList[] = $deliveryInfo->setDeliveryType(DeliveryType::PREPAID)->setDeliveryName("선결제")->setDefaultDeliveryCostApplied(true)->setAdditionalDeliveryCostApplied(true); $deliveryInfo = new ProductDeliveryInfo(); self::$productDeliveryInfoList[] = $deliveryInfo->setDeliveryType(DeliveryType::FREE)->setDeliveryName("무료배송")->setDefaultDeliveryCostApplied(false)->setAdditionalDeliveryCostApplied(true); $deliveryInfo = new ProductDeliveryInfo(); self::$productDeliveryInfoList[] = $deliveryInfo->setDeliveryType(DeliveryType::DIY)->setDeliveryName("방문수령")->setDefaultDeliveryCostApplied(false)->setAdditionalDeliveryCostApplied(false); $deliveryInfo = new ProductDeliveryInfo(); self::$productDeliveryInfoList[] = $deliveryInfo->setDeliveryType(DeliveryType::QUICK)->setDeliveryName("퀵서비스")->setDefaultDeliveryCostApplied(false)->setAdditionalDeliveryCostApplied(false); $deliveryInfo = new ProductDeliveryInfo(); self::$productDeliveryInfoList[] = $deliveryInfo->setDeliveryType(DeliveryType::PAYMENT_ON_DELIVERY)->setDeliveryName("착불")->setDefaultDeliveryCostApplied(false)->setAdditionalDeliveryCostApplied(true); return self::$productDeliveryInfoList; }