本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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]]);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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)));
}
示例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);
}