Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
OrderAdapter.php
Go to the documentation of this file.
1 <?php
7 
11 
16 {
20  private $order;
21 
25  private $addressAdapterFactory;
26 
31  public function __construct(
32  Order $order,
33  AddressAdapterFactory $addressAdapterFactory
34  ) {
35  $this->order = $order;
36  $this->addressAdapterFactory = $addressAdapterFactory;
37  }
38 
44  public function getCurrencyCode()
45  {
46  return $this->order->getBaseCurrencyCode();
47  }
48 
54  public function getOrderIncrementId()
55  {
56  return $this->order->getIncrementId();
57  }
58 
64  public function getCustomerId()
65  {
66  return $this->order->getCustomerId();
67  }
68 
74  public function getBillingAddress()
75  {
76  if ($this->order->getBillingAddress()) {
77  return $this->addressAdapterFactory->create(
78  ['address' => $this->order->getBillingAddress()]
79  );
80  }
81 
82  return null;
83  }
84 
90  public function getShippingAddress()
91  {
92  if ($this->order->getShippingAddress()) {
93  return $this->addressAdapterFactory->create(
94  ['address' => $this->order->getShippingAddress()]
95  );
96  }
97 
98  return null;
99  }
100 
106  public function getStoreId()
107  {
108  return $this->order->getStoreId();
109  }
110 
116  public function getId()
117  {
118  return $this->order->getEntityId();
119  }
120 
126  public function getGrandTotalAmount()
127  {
128  return $this->order->getBaseGrandTotal();
129  }
130 
136  public function getItems()
137  {
138  return $this->order->getItems();
139  }
140 
146  public function getRemoteIp()
147  {
148  return $this->order->getRemoteIp();
149  }
150 }
$order
Definition: order.php:55
__construct(Order $order, AddressAdapterFactory $addressAdapterFactory)