/** * @param \Magento\Sales\Api\Data\OrderInterface $mageOrder * @return \Praxigento\Odoo\Data\Odoo\SaleOrder\Customer */ public function getSaleOrderCustomer(\Magento\Sales\Api\Data\OrderInterface $mageOrder) { $result = $this->_manObj->create(\Praxigento\Odoo\Data\Odoo\SaleOrder\Customer::class); /* collect data */ $custMageId = (int) $mageOrder->getCustomerId(); $dwnlCust = $this->_repoDwnlCustomer->getById($custMageId); $ref = $dwnlCust->getHumanRef(); $name = $mageOrder->getCustomerName(); $mageCust = $this->_repoMageCustomer->getById($custMageId); $groupCode = $this->_manBusinessCodes->getBusCodeForCustomerGroup($mageCust); /* init Odoo data object */ $result->setIdMage($custMageId); $result->setIdMlm($ref); $result->setName($name); $result->setGroupCode($groupCode); return $result; }
/** * Returns customer ID * * @return int|null */ public function getCustomerId() { return $this->order->getCustomerId(); }
/** * Get details for GetTaxRequest * * @param \Magento\Store\Api\Data\StoreInterface $store * @param $address \Magento\Quote\Api\Data\AddressInterface|\Magento\Sales\Api\Data\OrderAddressInterface * @param \Magento\Quote\Api\Data\CartInterface|\Magento\Sales\Api\Data\OrderInterface $object * @return array * @throws LocalizedException */ protected function retrieveGetTaxRequestFields(StoreInterface $store, $address, $object) { $customerId = $object->getCustomerId(); $customer = $this->getCustomerById($customerId); $storeId = $store->getId(); if ($this->config->getLiveMode() == Config::API_PROFILE_NAME_PROD) { $companyCode = $this->config->getCompanyCode($storeId); } else { $companyCode = $this->config->getDevelopmentCompanyCode($storeId); } $businessIdentificationNumber = $this->getBusinessIdentificationNumber($store, $address, $customer); $locationCode = $this->config->getLocationCode($store); return ['BusinessIdentificationNo' => $businessIdentificationNumber, 'CompanyCode' => $companyCode, 'LocationCode' => $locationCode, 'OriginAddress' => $this->address->getAddress($this->config->getOriginAddress($storeId))]; }