bata; } public function setBata($bata): void { $this->bata = $bata; } /** * Set name. * * @param string $name * * @return Currency */ public function setName($name) { $this->name = $name; return $this; } /** * Get name. * * @return string */ public function getName() { return $this->name; } /** * Set id. * * @param string $id * * @return Currency */ public function setId($id) { $this->id = $id; return $this; } /** * Get id. * * @return string */ public function getId() { return $this->id; } /** * Set symbol. * * @param string $symbol * * @return Currency */ public function setSymbol($symbol) { $this->symbol = $symbol; return $this; } /** * Get symbol. * * @return string */ public function getSymbol() { return $this->symbol; } /** * Set priceRound. * * @param int $priceRound * * @return Currency */ public function setPriceRound($priceRound) { $this->priceRound = $priceRound; return $this; } /** * Get priceRound. * * @return int */ public function getPriceRound() { return $this->priceRound; } /** * Set priceRoundOrder. * * @param int $priceRoundOrder * * @return Currency */ public function setPriceRoundOrder($priceRoundOrder) { $this->priceRoundOrder = $priceRoundOrder; return $this; } /** * Get priceRoundOrder. * * @return int */ public function getPriceRoundOrder() { return $this->priceRoundOrder; } /** * Set priceRoundDirection. * * @param string $priceRoundDirection * * @return Currency */ public function setPriceRoundDirection($priceRoundDirection) { $this->priceRoundDirection = $priceRoundDirection; return $this; } /** * Get priceRoundDirection. * * @return string */ public function getPriceRoundDirection() { return $this->priceRoundDirection; } /** * Set pricePrecision. * * @param string $pricePrecision * * @return Currency */ public function setPricePrecision($pricePrecision) { $this->pricePrecision = $pricePrecision; return $this; } /** * Get pricePrecision. * * @return string */ public function getPricePrecision() { return $this->pricePrecision; } /** * Set priceDecimalMark. * * @param string $priceDecimalMark * * @return Currency */ public function setPriceDecimalMark($priceDecimalMark) { $this->priceDecimalMark = $priceDecimalMark; return $this; } /** * Get priceDecimalMark. * * @return string */ public function getPriceDecimalMark() { return $this->priceDecimalMark; } /** * Set rate. * * @param \Decimal $rate * * @return Currency */ public function setRate($rate) { $this->rate = toDecimal($rate); return $this; } /** * Get rate. * * @return \Decimal */ public function getRate() { return $this->rate; } /** * Set sync. * * @param string $sync * * @return Currency */ public function setSync($sync) { $this->sync = $sync; return $this; } /** * Get sync. * * @return string */ public function getSync() { return $this->sync; } /** * Set corrections. * * @param \Decimal $corrections * * @return Currency */ public function setCorrections($corrections) { $this->corrections = $corrections; return $this; } /** * Get corrections. * * @return \Decimal */ public function getCorrections() { return $this->corrections; } /** * Set syncDateUpdate. * * @param \DateTime $syncDateUpdate * * @return Currency */ public function setSyncDateUpdate($syncDateUpdate) { $this->syncDateUpdate = $syncDateUpdate; return $this; } /** * Get syncDateUpdate. * * @return \DateTime */ public function getSyncDateUpdate() { return $this->syncDateUpdate; } public function setSyncDateUpdated() { $this->syncDateUpdate = new \DateTime('now'); } /** * @return array */ public function getData() { return json_decode($this->data ?? '', true); } /** * @param string|null $data */ public function setData($data): void { $this->data = $data; } public function hasB2BSettings() { return $this->getData()['b2b'] ?? false; } public function createB2BInstance() { $b2bCurrency = clone $this; $b2bValues = $this->getData()['b2b']; if ($b2bValues) { $b2bCurrency->setPriceRound($b2bValues['price_round']); $b2bCurrency->setPriceRoundOrder($b2bValues['price_round_order']); $b2bCurrency->setPriceRoundDirection($b2bValues['price_round_direction']); $b2bCurrency->setPricePrecision($b2bValues['price_precision']); $b2bCurrency->setPriceDecimalMark($b2bValues['price_decimal_mark']); $b2bCurrency->setBata($b2bValues['bata']); } return $b2bCurrency; } }