cartID = $cartID; return $this; } /** * @return mixed */ public function getCartId() { return $this->cartID; } /** * @param mixed $cartItems * @throws \Qs\Service\TaxCloud\Exception * @return $this */ public function setCartItems($cartItems) { foreach ($cartItems as &$cartItem) { if ($cartItem instanceof CartItem) { continue; } if (is_array($cartItem)) { $cartItem = new CartItem($cartItem); continue; } throw new Exception('Invalid cart item type'); } $this->cartItems = $cartItems; return $this; } /** * @return mixed */ public function getCartItems() { return $this->cartItems; } /** * @param mixed $customerID * @return $this */ public function setCustomerId($customerID) { $this->customerID = $customerID; return $this; } /** * @return mixed */ public function getCustomerId() { return $this->customerID; } /** * @param mixed $deliveredBySeller * @return $this */ public function setDeliveredBySeller($deliveredBySeller) { $this->deliveredBySeller = $deliveredBySeller; return $this; } /** * @return mixed */ public function getDeliveredBySeller() { return $this->deliveredBySeller; } /** * @param mixed $destination * @return $this */ public function setDestination($destination) { $this->_initAddress($destination); $this->destination = $destination; return $this; } /** * @return mixed */ public function getDestination() { return $this->destination; } /** * @param mixed $exemptCert * @return $this */ public function setExemptCert($exemptCert) { $this->exemptCert = $exemptCert; return $this; } /** * @return mixed */ public function getExemptCert() { return $this->exemptCert; } /** * @param mixed $origin * @throws \Qs\Service\TaxCloud\Exception * @return $this */ public function setOrigin($origin) { $this->_initAddress($origin); $this->origin = $origin; return $this; } protected function _initAddress(&$address) { if (is_array($address)) { $address = new Address($address); } if (!($address instanceof Address)) { throw new Exception('Invalid Origin Address'); } return $this; } /** * @return mixed */ public function getOrigin() { return $this->origin; } }