public function testCustomer() { $this->address->unsetData('cusomer_id'); $this->assertFalse($this->address->getCustomer()); $this->address->setCustomerId(self::ORIG_CUSTOMER_ID); $customer = $this->address->getCustomer(); $this->assertEquals(self::ORIG_CUSTOMER_ID, $customer->getId()); /** @var \Magento\Customer\Model\Customer $customer */ $customer = $this->getMockBuilder('Magento\\Customer\\Model\\Customer')->disableOriginalConstructor()->getMock(); $customer->expects($this->any())->method('getId')->will($this->returnValue(self::ORIG_CUSTOMER_ID + 1)); $this->address->setCustomer($customer); $this->assertEquals(self::ORIG_CUSTOMER_ID + 1, $this->address->getCustomerId()); }
/** * Add error message * * @param Address $customerAddress * @return $this */ protected function addErrorMessage($customerAddress) { $message = [(string) __('Your Tax ID cannot be validated.')]; $customer = $customerAddress->getCustomer(); if (!$this->scopeConfig->isSetFlag(HelperAddress::XML_PATH_VIV_DISABLE_AUTO_ASSIGN_DEFAULT) && !$customer->getDisableAutoGroupChange()) { $message[] = (string) __('You will be charged tax.'); } $email = $this->scopeConfig->getValue('trans_email/ident_support/email', ScopeInterface::SCOPE_STORE); $message[] = (string) __('If you believe this is an error, please contact us at %1', $email); $this->messageManager->addError(implode(' ', $message)); return $this; }
/** * 2016-04-04 * @param AA|CA|QA|OA $a * @return Customer|Quote|Order|null */ function df_address_owner($a) { return $a instanceof CA ? $a->getCustomer() : ($a instanceof QA ? $a->getQuote() : ($a instanceof OA ? $a->getOrder() : null)); }
/** * Check whether specified shipping address is default for its customer * * @param Address $address * @return bool */ protected function isDefaultShipping($address) { return $address->getId() && $address->getId() == $address->getCustomer()->getDefaultShipping() || $address->getIsPrimaryShipping() || $address->getIsDefaultShipping(); }