Example #1
0
 /**
  * @param \Generated\Shared\Transfer\TaxRateTransfer $taxRateTransfer
  *
  * @throws \Spryker\Zed\Tax\Business\Model\Exception\ResourceNotFoundException
  *
  * @return \Orm\Zed\Tax\Persistence\SpyTaxRate
  */
 private function findOrCreateTaxRateEntity(TaxRateTransfer $taxRateTransfer)
 {
     if ($taxRateTransfer->getIdTaxRate()) {
         $taxRateEntity = $this->queryContainer->queryTaxRate($taxRateTransfer->getIdTaxRate())->findOne();
         if (!$taxRateEntity) {
             throw new ResourceNotFoundException();
         }
     } else {
         $taxRateEntity = $this->createTaxRateEntity($taxRateTransfer);
     }
     return $taxRateEntity;
 }
Example #2
0
 /**
  * @param int $id
  *
  * @return bool
  */
 public function taxSetExists($id)
 {
     $taxSetQuery = $this->queryContainer->queryTaxSet($id);
     return $taxSetQuery->count() > 0;
 }
 /**
  * @param array $allIdProductAbstracts
  * @param string $countryIso2Code
  *
  * @return array
  */
 protected function findTaxRatesByAllIdProductAbstractsAndCountryIso2Code(array $allIdProductAbstracts, $countryIso2Code)
 {
     return $this->taxQueryContainer->queryTaxSetByIdProductAbstractAndCountryIso2Code($allIdProductAbstracts, $countryIso2Code)->find()->toArray();
 }