AddressAdapter.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Payment\Gateway\Data\Order;
  7. use Magento\Payment\Gateway\Data\AddressAdapterInterface;
  8. use Magento\Sales\Api\Data\OrderAddressInterface;
  9. /**
  10. * Class AddressAdapter
  11. */
  12. class AddressAdapter implements AddressAdapterInterface
  13. {
  14. /**
  15. * @var OrderAddressInterface
  16. */
  17. private $address;
  18. /**
  19. * @param OrderAddressInterface $address
  20. */
  21. public function __construct(OrderAddressInterface $address)
  22. {
  23. $this->address = $address;
  24. }
  25. /**
  26. * Get region name
  27. *
  28. * @return string
  29. */
  30. public function getRegionCode()
  31. {
  32. return $this->address->getRegionCode();
  33. }
  34. /**
  35. * Get country id
  36. *
  37. * @return string
  38. */
  39. public function getCountryId()
  40. {
  41. return $this->address->getCountryId();
  42. }
  43. /**
  44. * Get street line 1
  45. *
  46. * @return string
  47. */
  48. public function getStreetLine1()
  49. {
  50. $street = $this->address->getStreet();
  51. return isset($street[0]) ? $street[0]: '';
  52. }
  53. /**
  54. * Get street line 2
  55. *
  56. * @return string
  57. */
  58. public function getStreetLine2()
  59. {
  60. $street = $this->address->getStreet();
  61. return isset($street[1]) ? $street[1]: '';
  62. }
  63. /**
  64. * Get telephone number
  65. *
  66. * @return string
  67. */
  68. public function getTelephone()
  69. {
  70. return $this->address->getTelephone();
  71. }
  72. /**
  73. * Get postcode
  74. *
  75. * @return string
  76. */
  77. public function getPostcode()
  78. {
  79. return $this->address->getPostcode();
  80. }
  81. /**
  82. * Get city name
  83. *
  84. * @return string
  85. */
  86. public function getCity()
  87. {
  88. return $this->address->getCity();
  89. }
  90. /**
  91. * Get first name
  92. *
  93. * @return string
  94. */
  95. public function getFirstname()
  96. {
  97. return $this->address->getFirstname();
  98. }
  99. /**
  100. * Get last name
  101. *
  102. * @return string
  103. */
  104. public function getLastname()
  105. {
  106. return $this->address->getLastname();
  107. }
  108. /**
  109. * Get middle name
  110. *
  111. * @return string|null
  112. */
  113. public function getMiddlename()
  114. {
  115. return $this->address->getMiddlename();
  116. }
  117. /**
  118. * Get customer id
  119. *
  120. * @return int|null
  121. */
  122. public function getCustomerId()
  123. {
  124. return $this->address->getCustomerId();
  125. }
  126. /**
  127. * Get billing/shipping email
  128. *
  129. * @return string
  130. */
  131. public function getEmail()
  132. {
  133. return $this->address->getEmail();
  134. }
  135. /**
  136. * Returns name prefix
  137. *
  138. * @return string
  139. */
  140. public function getPrefix()
  141. {
  142. return $this->address->getPrefix();
  143. }
  144. /**
  145. * Returns name suffix
  146. *
  147. * @return string
  148. */
  149. public function getSuffix()
  150. {
  151. return $this->address->getSuffix();
  152. }
  153. /**
  154. * Get company
  155. *
  156. * @return string
  157. */
  158. public function getCompany()
  159. {
  160. return $this->address->getCompany();
  161. }
  162. }