systemConfig = $systemConfig; $this->companyDataWrapper = $companyDataWrapper; } /** * @return CopperSurchargeData|null */ public function findConfigurationData(): ?CopperSurchargeData { try { $articleId = (int)$this->systemConfig->getValue( self::NAMESPACE, 'articleid' ); $surchargePositionType = (int)$this->systemConfig->getValue( self::NAMESPACE, 'surchargepositiontype' ); $surchargeDocumentConversion = (int)$this->systemConfig->getValue( self::NAMESPACE, 'surchargedocumentconversion' ); $surchargeInvoice = (int)$this->systemConfig->getValue( self::NAMESPACE, 'surchargeinvoice' ); $surchargeDeliveryCosts = (float)$this->systemConfig->getValue( self::NAMESPACE, 'surchargedeliverycosts' ); $surchargeCopperBase = (string)$this->systemConfig->getValue( self::NAMESPACE, 'surchargecopperbase' ); $surchargeCopperBaseStandard = (float)$this->systemConfig->getValue( self::NAMESPACE, 'surchargecopperbasestandard' ); $copperNumberOption = (string)$this->systemConfig->getValue( self::NAMESPACE, 'coppernumberoption' ); $surchargeMaintenanceType = (int)$this->systemConfig->getValue( self::NAMESPACE, 'surchargemaintenancetype' ); } catch (ConfigurationKeyNotFoundException $e) { return null; } return new CopperSurchargeData( $articleId, $surchargePositionType, $surchargeDocumentConversion, $surchargeInvoice, $surchargeDeliveryCosts, $surchargeCopperBase, $surchargeCopperBaseStandard, $surchargeMaintenanceType, $copperNumberOption ); } /** * @param CopperSurchargeData $copperSurchargeData * * @throws InvalidArgumentException * @throws ValueTooLargeException */ public function setConfigurationData(CopperSurchargeData $copperSurchargeData) { $this->systemConfig->setValue( self::NAMESPACE, 'articleid', (string)$copperSurchargeData->getCopperSurchargeArticleId() ); $this->systemConfig->setValue( self::NAMESPACE, 'surchargepositiontype', (string)$copperSurchargeData->getSurchargePositionType() ); $this->systemConfig->setValue( self::NAMESPACE, 'surchargedocumentconversion', (string)$copperSurchargeData->getSurchargeDocumentConversion() ); $this->systemConfig->setValue( self::NAMESPACE, 'surchargeinvoice', (string)$copperSurchargeData->getSurchargeInvoice() ); $this->systemConfig->setValue( self::NAMESPACE, 'surchargedeliverycosts', (string)$copperSurchargeData->getSurchargeDeliveryCosts() ); $this->systemConfig->setValue( self::NAMESPACE, 'surchargecopperbase', (string)$copperSurchargeData->getSurchargeCopperBase() ); $this->systemConfig->setValue( self::NAMESPACE, 'surchargecopperbasestandard', (string)$copperSurchargeData->getSurchargeCopperBaseStandard() ); $this->systemConfig->setValue( self::NAMESPACE, 'coppernumberoption', $copperSurchargeData->getCopperNumberOption() ); $this->systemConfig->setValue( self::NAMESPACE, 'surchargemaintenancetype', (string)$copperSurchargeData->getSurchargeMaintenanceType() ); } /** * @param string $field * * @return string */ public function findCompanyData(string $field): string { return $this->companyDataWrapper->getCompanyData($field); } }