/**
  * @return void
  */
 public function testSetTaxRateWhenExemptTaxRateUsedAndCountryMatchingShouldUseCountryRate()
 {
     $shipmentMethodEntity = $this->createShipmentMethodWithTaxSet(20, 'DE');
     $quoteTransfer = new QuoteTransfer();
     $addressTransfer = new AddressTransfer();
     $addressTransfer->setIso2Code('DE');
     $quoteTransfer->setShippingAddress($addressTransfer);
     $shipmentTransfer = new ShipmentTransfer();
     $shipmentMethodTransfer = new ShipmentMethodTransfer();
     $shipmentMethodTransfer->fromArray($shipmentMethodEntity->toArray(), true);
     $shipmentTransfer->setMethod($shipmentMethodTransfer);
     $quoteTransfer->setShipment($shipmentTransfer);
     $shipmentFacadeTest = $this->createShipmentFacade();
     $shipmentFacadeTest->calculateShipmentTaxRate($quoteTransfer);
     $this->assertEquals('20.00', $shipmentMethodTransfer->getTaxRate());
 }
 /**
  * @return \Generated\Shared\Transfer\QuoteTransfer
  */
 protected function createQuoteTransfer()
 {
     $quoteTransfer = new QuoteTransfer();
     $shipmentMethodTransfer = new ShipmentMethodTransfer();
     $shipmentMethodTransfer->setName('DummyShipment');
     $shipmentTransfer = new ShipmentTransfer();
     $shipmentTransfer->setMethod($shipmentMethodTransfer);
     $quoteTransfer->setShipment($shipmentTransfer);
     $expenseTransfer = new ExpenseTransfer();
     $expenseTransfer->setName($shipmentMethodTransfer->getName());
     $expenseTransfer->setType(ShipmentConstants::SHIPMENT_EXPENSE_TYPE);
     $quoteTransfer->addExpense($expenseTransfer);
     return $quoteTransfer;
 }
Esempio n. 3
0
 /**
  * @return \Generated\Shared\Transfer\QuoteTransfer
  */
 private function getValidBaseQuoteTransfer()
 {
     $country = new SpyCountry();
     $country->setIso2Code('ix');
     $country->save();
     $quoteTransfer = new QuoteTransfer();
     $billingAddress = new AddressTransfer();
     $billingAddress->setIso2Code('ix')->setAddress1('address-1-1-test')->setFirstName('Max')->setLastName('Mustermann')->setZipCode('1337')->setCity('SpryHome');
     $shippingAddress = new AddressTransfer();
     $shippingAddress->setIso2Code('ix')->setAddress1('address-1-2-test')->setFirstName('Max')->setLastName('Mustermann')->setZipCode('1337')->setCity('SpryHome');
     $totals = new TotalsTransfer();
     $totals->setGrandTotal(1337)->setSubtotal(337);
     $quoteTransfer->setShippingAddress($shippingAddress)->setBillingAddress($billingAddress)->setTotals($totals);
     $customerTransfer = new CustomerTransfer();
     $customerTransfer->setEmail('*****@*****.**');
     $customerTransfer->setFirstName('Max');
     $customerTransfer->setLastName('Mustermann');
     $quoteTransfer->setCustomer($customerTransfer);
     $shipmentTransfer = new ShipmentTransfer();
     $shipmentTransfer->setMethod(new ShipmentMethodTransfer());
     $quoteTransfer->setShipment($shipmentTransfer);
     $itemTransfer = new ItemTransfer();
     $itemTransfer->setUnitGrossPrice(1)->setQuantity(1)->setName('test-name')->setSku('sku-test');
     $quoteTransfer->addItem($itemTransfer);
     $paymentTransfer = new PaymentTransfer();
     $paymentTransfer->setPaymentSelection('dummyPaymentInvoice');
     $quoteTransfer->setPayment($paymentTransfer);
     return $quoteTransfer;
 }
Esempio n. 4
0
 /**
  * @return \Generated\Shared\Transfer\QuoteTransfer
  */
 protected function getBaseQuoteTransfer()
 {
     $quoteTransfer = new QuoteTransfer();
     $country = new SpyCountry();
     $country->setIso2Code('xi')->save();
     $productAbstract1 = new SpyProductAbstract();
     $productAbstract1->setSku('AOSB1337')->setAttributes('{}');
     $productConcrete1 = new SpyProduct();
     $productConcrete1->setSku('OSB1337')->setAttributes('{}')->setSpyProductAbstract($productAbstract1)->save();
     $productAbstract2 = new SpyProductAbstract();
     $productAbstract2->setSku('AOSB1338')->setAttributes('{}');
     $productConcrete2 = new SpyProduct();
     $productConcrete2->setSku('OSB1338')->setSpyProductAbstract($productAbstract2)->setAttributes('{}')->save();
     $stock = new SpyStock();
     $stock->setName('testStock');
     $stock1 = new SpyStockProduct();
     $stock1->setQuantity(1)->setStock($stock)->setSpyProduct($productConcrete1)->save();
     $stock2 = new SpyStockProduct();
     $stock2->setQuantity(1)->setStock($stock)->setSpyProduct($productConcrete2)->save();
     $item1 = new ItemTransfer();
     $item1->setSku('OSB1337')->setQuantity(1)->setUnitGrossPrice(3000)->setName('Product1');
     $item2 = new ItemTransfer();
     $item2->setSku('OSB1338')->setQuantity(1)->setUnitGrossPrice(4000)->setName('Product2');
     $quoteTransfer->addItem($item1);
     $quoteTransfer->addItem($item2);
     $totals = new TotalsTransfer();
     $totals->setGrandTotal(1000)->setSubtotal(500);
     $quoteTransfer->setTotals($totals);
     $billingAddress = new AddressTransfer();
     $shippingAddress = new AddressTransfer();
     $billingAddress->setIso2Code('xi')->setEmail('*****@*****.**')->setFirstName('Max')->setLastName('Mustermann')->setAddress1('Straße')->setAddress2('82')->setZipCode('12345')->setCity('Entenhausen');
     $shippingAddress->setIso2Code('xi')->setFirstName('Max')->setLastName('Mustermann')->setEmail('*****@*****.**')->setAddress1('Straße')->setAddress2('84')->setZipCode('12346')->setCity('Entenhausen2');
     $quoteTransfer->setBillingAddress($billingAddress);
     $quoteTransfer->setShippingAddress($shippingAddress);
     $customerTransfer = new CustomerTransfer();
     $customerTransfer->setIsGuest(false)->setEmail('*****@*****.**');
     $quoteTransfer->setCustomer($customerTransfer);
     $shipment = new ShipmentTransfer();
     $shipment->setMethod(new ShipmentMethodTransfer());
     $quoteTransfer->setShipment($shipment);
     $paymentTransfer = new PaymentTransfer();
     $paymentTransfer->setPaymentSelection('no_payment');
     $quoteTransfer->setPayment($paymentTransfer);
     return $quoteTransfer;
 }