コード例 #1
0
 /**
  * @param int $taxRate
  * @param string $iso2Code
  *
  * @return \Orm\Zed\Shipment\Persistence\SpyShipmentMethod
  */
 protected function createShipmentMethodWithTaxSet($taxRate, $iso2Code)
 {
     $countryEntity = SpyCountryQuery::create()->findOneByIso2Code($iso2Code);
     $taxRateEntity1 = new SpyTaxRate();
     $taxRateEntity1->setRate($taxRate);
     $taxRateEntity1->setName('test rate 1');
     $taxRateEntity1->setFkCountry($countryEntity->getIdCountry());
     $taxRateEntity1->save();
     $taxRateEntity2 = new SpyTaxRate();
     $taxRateEntity2->setRate(13);
     $taxRateEntity2->setName('tax rate 2');
     $taxRateEntity2->setFkCountry($countryEntity->getIdCountry());
     $taxRateEntity2->save();
     $taxRateExemptEntity = new SpyTaxRate();
     $taxRateExemptEntity->setRate(0);
     $taxRateExemptEntity->setName(TaxConstants::TAX_EXEMPT_PLACEHOLDER);
     $taxRateExemptEntity->save();
     $taxSetEntity = new SpyTaxSet();
     $taxSetEntity->setName('name of tax set');
     $taxSetEntity->save();
     $taxSetTaxRateEntity = new SpyTaxSetTax();
     $taxSetTaxRateEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $taxSetTaxRateEntity->setFkTaxRate($taxRateEntity1->getIdTaxRate());
     $taxSetTaxRateEntity->save();
     $taxSetTaxRateEntity = new SpyTaxSetTax();
     $taxSetTaxRateEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $taxSetTaxRateEntity->setFkTaxRate($taxRateEntity2->getIdTaxRate());
     $taxSetTaxRateEntity->save();
     $taxSetTaxRateEntity = new SpyTaxSetTax();
     $taxSetTaxRateEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $taxSetTaxRateEntity->setFkTaxRate($taxRateExemptEntity->getIdTaxRate());
     $taxSetTaxRateEntity->save();
     $shipmentCarrierEntity = new SpyShipmentCarrier();
     $shipmentCarrierEntity->setName('name carrier');
     $shipmentCarrierEntity->save();
     $shipmentMethodEntity = new SpyShipmentMethod();
     $shipmentMethodEntity->setFkShipmentCarrier($shipmentCarrierEntity->getIdShipmentCarrier());
     $shipmentMethodEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $shipmentMethodEntity->setName('test shipment method');
     $shipmentMethodEntity->save();
     return $shipmentMethodEntity;
 }
コード例 #2
0
ファイル: Carrier.php プロジェクト: spryker/Shipment
 /**
  * @param \Generated\Shared\Transfer\ShipmentCarrierTransfer $carrierTransfer
  *
  * @return int
  */
 public function create(ShipmentCarrierTransfer $carrierTransfer)
 {
     $carrierEntity = new SpyShipmentCarrier();
     $carrierEntity->setName($carrierTransfer->getName())->setIsActive($carrierTransfer->getIsActive())->save();
     return $carrierEntity->getPrimaryKey();
 }