当前位置: 首页>>代码示例>>PHP>>正文


PHP OrderInterface::getShippingAddress方法代码示例

本文整理汇总了PHP中Sylius\Component\Core\Model\OrderInterface::getShippingAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderInterface::getShippingAddress方法的具体用法?PHP OrderInterface::getShippingAddress怎么用?PHP OrderInterface::getShippingAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sylius\Component\Core\Model\OrderInterface的用法示例。


在下文中一共展示了OrderInterface::getShippingAddress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 function it_should_recognize_subject_as_eligible_if_country_match(OrderInterface $subject, AddressInterface $address, CountryInterface $country)
 {
     $subject->getShippingAddress()->shouldBeCalled()->willReturn($address);
     $address->getCountry()->shouldBeCalled()->willReturn($country);
     $country->getId()->shouldBeCalled()->willReturn(1);
     $this->isEligible($subject, array('country' => 1))->shouldReturn(true);
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:7,代码来源:ShippingCountryRuleCheckerSpec.php

示例2:

 function it_should_recognize_subject_as_eligible_if_country_match(OrderInterface $subject, AddressInterface $address, CountryInterface $country, RepositoryInterface $countryRepository)
 {
     $country->getCode()->willReturn('IE');
     $address->getCountryCode()->willReturn('IE');
     $subject->getShippingAddress()->willReturn($address);
     $countryRepository->findOneBy(['code' => 'IE'])->willReturn($country);
     $this->isEligible($subject, ['country' => 'IE'])->shouldReturn(true);
 }
开发者ID:gabiudrescu,项目名称:Sylius,代码行数:8,代码来源:ShippingCountryRuleCheckerSpec.php

示例3: createCheckoutShippingForm

 /**
  * @param OrderInterface $order
  *
  * @return FormInterface
  */
 protected function createCheckoutShippingForm(OrderInterface $order)
 {
     $this->zones = $this->getZoneMatcher()->matchAll($order->getShippingAddress());
     if (empty($this->zones)) {
         $this->get('session')->getFlashBag()->add('error', 'sylius.checkout.shipping.error');
     }
     return $this->createForm('sylius_checkout_shipping', $order);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:13,代码来源:ShippingStep.php

示例4: getTaxZone

 /**
  * @param CoreOrderInterface $order
  *
  * @return ZoneInterface|null
  */
 private function getTaxZone(CoreOrderInterface $order)
 {
     $shippingAddress = $order->getShippingAddress();
     $zone = null;
     if (null !== $shippingAddress) {
         $zone = $this->zoneMatcher->match($shippingAddress);
     }
     return $zone ?: $this->defaultTaxZoneProvider->getZone($order);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:14,代码来源:OrderTaxesProcessor.php

示例5: saveAddresses

 /**
  * @param OrderInterface $order
  */
 public function saveAddresses(OrderInterface $order)
 {
     /** @var CustomerInterface $customer */
     $customer = $order->getCustomer();
     $shippingAddress = $order->getShippingAddress();
     $billingAddress = $order->getBillingAddress();
     $this->addressAdder->add($customer, clone $billingAddress);
     $this->addressAdder->add($customer, clone $shippingAddress);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:12,代码来源:CustomerOrderAddressesSaver.php

示例6:

 function it_saves_addresses_from_given_order(CustomerAddressAdderInterface $addressAdder, OrderInterface $order, CustomerInterface $customer, AddressInterface $shippingAddress, AddressInterface $billingAddress)
 {
     $order->getCustomer()->willReturn($customer);
     $order->getShippingAddress()->willReturn($shippingAddress);
     $order->getBillingAddress()->willReturn($billingAddress);
     $addressAdder->add($customer, clone $shippingAddress)->shouldBeCalled();
     $addressAdder->add($customer, clone $billingAddress)->shouldBeCalled();
     $this->saveAddresses($order);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:9,代码来源:CustomerOrderAddressesSaverSpec.php

示例7: createCheckoutShippingForm

 /**
  * @param OrderInterface $order
  *
  * @return FormInterface
  */
 protected function createCheckoutShippingForm(OrderInterface $order)
 {
     $this->zones = $this->getZoneMatcher()->matchAll($order->getShippingAddress());
     if (empty($this->zones)) {
         $this->get('session')->getFlashBag()->add('error', 'sylius.checkout.shipping.error');
     }
     return $this->createForm('sylius_checkout_shipping', $order, ['criteria' => ['zone' => !empty($this->zones) ? array_map(function ($zone) {
         return $zone->getId();
     }, $this->zones) : null, 'enabled' => true]]);
 }
开发者ID:Mozan,项目名称:Sylius,代码行数:15,代码来源:ShippingStep.php

示例8:

 function it_doesnt_apply_any_taxes_if_zone_is_missing(OrderInterface $order, Collection $collection, $taxationSettings)
 {
     $collection->isEmpty()->willReturn(false);
     $order->getItems()->willReturn($collection);
     $order->removeTaxAdjustments()->shouldBeCalled();
     $order->getShippingAddress()->willReturn(null);
     $taxationSettings->has('default_tax_zone')->willReturn(false);
     $order->addAdjustment(Argument::any())->shouldNotBeCalled();
     $this->applyTaxes($order);
 }
开发者ID:bcremer,项目名称:Sylius,代码行数:10,代码来源:TaxationProcessorSpec.php

示例9: iDeleteTheOrder

 /**
  * @When I delete the order :order
  */
 public function iDeleteTheOrder(OrderInterface $order)
 {
     $adjustmentsId = [];
     foreach ($order->getAdjustments() as $adjustment) {
         $adjustmentsId[] = $adjustment->getId();
     }
     $this->sharedStorage->set('deleted_adjustments', $adjustmentsId);
     $this->sharedStorage->set('deleted_addresses', [$order->getShippingAddress()->getId(), $order->getBillingAddress()->getId()]);
     $this->sharedStorage->set('order_id', $order->getId());
     $this->orderRepository->remove($order);
 }
开发者ID:gabiudrescu,项目名称:Sylius,代码行数:14,代码来源:ManagingOrdersContext.php

示例10:

 function it_does_not_process_taxes_if_there_is_no_tax_zone(ZoneProviderInterface $defaultTaxZoneProvider, ZoneMatcherInterface $zoneMatcher, PrioritizedServiceRegistryInterface $strategyRegistry, OrderInterface $order, OrderItemInterface $orderItem, AddressInterface $address)
 {
     $order->getItems()->willReturn([$orderItem]);
     $order->isEmpty()->willReturn(false);
     $order->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
     $orderItem->removeAdjustmentsRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
     $order->getShippingAddress()->willReturn($address);
     $zoneMatcher->match($address)->willReturn(null);
     $defaultTaxZoneProvider->getZone($order)->willReturn(null);
     $strategyRegistry->all()->shouldNotBeCalled();
     $this->process($order);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:12,代码来源:OrderTaxesProcessorSpec.php

示例11: getZonesIdsForAddress

 /**
  * @param OrderInterface $order
  *
  * @return array
  */
 private function getZonesIdsForAddress(OrderInterface $order)
 {
     $matchedZones = $this->zoneMatcher->matchAll($order->getShippingAddress());
     if (empty($matchedZones)) {
         return [];
     }
     $zones = [];
     foreach ($matchedZones as $zone) {
         $zones[] = $zone->getId();
     }
     return $zones;
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:17,代码来源:ShippingMethodsByZonesAndChannelResolver.php

示例12: applyTaxes

 /**
  * {@inheritdoc}
  */
 public function applyTaxes(OrderInterface $order)
 {
     // Remove all tax adjustments, we recalculate everything from scratch.
     $order->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT);
     if ($order->getItems()->isEmpty()) {
         return;
     }
     $zone = null;
     if (null !== $order->getShippingAddress()) {
         // Match the tax zone.
         $zone = $this->zoneMatcher->match($order->getShippingAddress());
     }
     if ($this->settings->has('default_tax_zone')) {
         // If address does not match any zone, use the default one.
         $zone = $zone ?: $this->settings->get('default_tax_zone');
     }
     if (null === $zone) {
         return;
     }
     $taxes = $this->processTaxes($order, $zone);
     $this->addAdjustments($taxes, $order);
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:25,代码来源:TaxationProcessor.php

示例13:

 function it_does_not_apply_taxes_if_there_is_no_tax_zone($defaultTaxZoneProvider, $zoneMatcher, $orderItemsTaxesApplicator, AddressInterface $address, \Iterator $iterator, Collection $items, OrderInterface $order, OrderItemInterface $orderItem)
 {
     $order->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
     $order->getItems()->willReturn($items);
     $order->isEmpty()->willReturn(false);
     $items->count()->willReturn(1);
     $items->getIterator()->willReturn($iterator);
     $iterator->rewind()->shouldBeCalled();
     $iterator->valid()->willReturn(true, false)->shouldBeCalled();
     $iterator->current()->willReturn($orderItem);
     $iterator->next()->shouldBeCalled();
     $orderItem->removeAdjustmentsRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
     $order->getShippingAddress()->willReturn($address);
     $zoneMatcher->match($address)->willReturn(null);
     $defaultTaxZoneProvider->getZone()->willReturn(null);
     $orderItemsTaxesApplicator->apply(Argument::any())->shouldNotBeCalled();
     $this->apply($order);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:18,代码来源:OrderTaxesApplicatorSpec.php

示例14: createCheckoutShippingForm

 private function createCheckoutShippingForm(OrderInterface $order)
 {
     $zones = $this->getZoneMatcher()->matchAll($order->getShippingAddress());
     return $this->createApiForm('sylius_checkout_shipping', $order, array('criteria' => array('zone' => !empty($zones) ? array_map(function ($zone) {
         return $zone->getId();
     }, $zones) : null, 'enabled' => true)));
 }
开发者ID:Spomky,项目名称:Sylius,代码行数:7,代码来源:CheckoutController.php

示例15:

 function it_does_not_process_taxes_if_there_is_no_tax_zone(ZoneProviderInterface $defaultTaxZoneProvider, ZoneMatcherInterface $zoneMatcher, AddressInterface $address, \Iterator $itemsIterator, Collection $items, OrderInterface $order, OrderItemInterface $orderItem, PrioritizedServiceRegistryInterface $strategyRegistry)
 {
     $order->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
     $order->getItems()->willReturn($items);
     $order->isEmpty()->willReturn(false);
     $items->count()->willReturn(1);
     $items->getIterator()->willReturn($itemsIterator);
     $itemsIterator->rewind()->shouldBeCalled();
     $itemsIterator->valid()->willReturn(true, false)->shouldBeCalled();
     $itemsIterator->current()->willReturn($orderItem);
     $itemsIterator->next()->shouldBeCalled();
     $orderItem->removeAdjustmentsRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
     $order->getShippingAddress()->willReturn($address);
     $zoneMatcher->match($address)->willReturn(null);
     $defaultTaxZoneProvider->getZone($order)->willReturn(null);
     $strategyRegistry->all()->shouldNotBeCalled();
     $this->process($order);
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:18,代码来源:OrderTaxesProcessorSpec.php


注:本文中的Sylius\Component\Core\Model\OrderInterface::getShippingAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。