public function testFindByZip5AndStateWithZip5()
 {
     $taxRate1 = $this->dummyData->getTaxRate();
     $this->taxRateRepository->shouldReceive('findByZip5AndState')->with($taxRate1->getZip5(), null)->andReturn($taxRate1)->once();
     $taxRate = $this->taxRateService->findByZip5AndState($taxRate1->getZip5());
     $this->assertEntitiesEqual($taxRate1, $taxRate);
 }
Example #2
0
 /**
  * @param UuidInterface $cartId
  * @param string $shipmentRateExternalId
  * @param OrderAddressDTO $shippingAddressDTO
  */
 public function setExternalShipmentRate(UuidInterface $cartId, $shipmentRateExternalId, OrderAddressDTO $shippingAddressDTO)
 {
     $cart = $this->cartRepository->findOneById($cartId);
     $shipmentRate = $this->shipmentGateway->getShipmentRateByExternalId($shipmentRateExternalId);
     $cart->setShipmentRate($shipmentRate);
     $shippingAddress = OrderAddressDTOBuilder::createFromDTO($shippingAddressDTO);
     $cart->setShippingAddress($shippingAddress);
     $taxRate = $this->taxRateRepository->findByZip5AndState($shippingAddressDTO->zip5, $shippingAddressDTO->state);
     $cart->setTaxRate($taxRate);
     $this->cartRepository->update($cart);
 }
 public function testSetExternalShipmentRate()
 {
     $cart = $this->getCartThatRepositoryWillFind();
     $this->cartRepositoryShouldUpdateOnce($cart);
     $orderAddressDTO = new OrderAddressDTO();
     $orderAddressDTO->zip5 = self::ZIP5;
     $taxRate = $this->dummyData->getTaxRate();
     $this->taxRateRepository->shouldReceive('findByZip5AndState')->with(self::ZIP5, null)->andReturn($taxRate)->once();
     $this->cartService->setExternalShipmentRate($cart->getId(), self::SHIPMENT_RATE_EXTERNAL_ID, $orderAddressDTO);
     $this->assertSame(self::SHIPMENT_RATE_EXTERNAL_ID, $cart->getShipmentRate()->getShipmentExternalId());
     $this->assertSame(self::ZIP5, $cart->getShippingAddress()->getZip5());
 }
Example #4
0
 /**
  * @param string $zip5
  * @param string $state
  * @return TaxRate|null
  */
 public function findByZip5AndState($zip5 = null, $state = null)
 {
     return $this->taxRateRepository->findByZip5AndState($zip5, $state);
 }
 public function testFindByZip5AndStateMissing()
 {
     $taxRate = $this->taxRateRepository->findByZip5AndState('11111');
     $this->assertSame(null, $taxRate);
 }