Address.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <?php
  2. /**
  3. * This file is part of the Klarna KP module
  4. *
  5. * (c) Klarna Bank AB (publ)
  6. *
  7. * For the full copyright and license information, please view the NOTICE
  8. * and LICENSE files that were distributed with this source code.
  9. */
  10. namespace Klarna\Kp\Model\Api\Request;
  11. use Klarna\Kp\Api\Data\AddressInterface;
  12. /**
  13. * Class Address
  14. *
  15. * @package Klarna\Kp\Model\Api\Request
  16. */
  17. class Address implements AddressInterface
  18. {
  19. use \Klarna\Kp\Model\Api\Export;
  20. /**
  21. * @var string
  22. */
  23. private $title;
  24. /**
  25. * @var string
  26. */
  27. private $given_name;
  28. /**
  29. * @var string
  30. */
  31. private $family_name;
  32. /**
  33. * @var string
  34. */
  35. private $email;
  36. /**
  37. * @var string
  38. */
  39. private $phone;
  40. /**
  41. * @var string
  42. */
  43. private $street_address;
  44. /**
  45. * @var string
  46. */
  47. private $street_address2;
  48. /**
  49. * @var string
  50. */
  51. private $city;
  52. /**
  53. * @var string
  54. */
  55. private $region;
  56. /**
  57. * @var string
  58. */
  59. private $postal_code;
  60. /**
  61. * @var string
  62. */
  63. private $country;
  64. /**
  65. * Constructor.
  66. *
  67. * @param array $data
  68. */
  69. public function __construct($data = [])
  70. {
  71. foreach ($data as $key => $value) {
  72. if (property_exists($this, $key)) {
  73. $this->$key = $value;
  74. $this->exports[] = $key;
  75. }
  76. }
  77. }
  78. /**
  79. * Title. Possible values Mr or Mrs
  80. *
  81. * @param string $title
  82. */
  83. public function setTitle($title)
  84. {
  85. $this->title = $title;
  86. }
  87. /**
  88. * Given name. [REQUIRED field]
  89. *
  90. * @param string $given_name
  91. */
  92. public function setGivenName($given_name)
  93. {
  94. $this->given_name = $given_name;
  95. }
  96. /**
  97. * Family name. [REQUIRED field]
  98. *
  99. * @param string $family_name
  100. */
  101. public function setFamilyName($family_name)
  102. {
  103. $this->family_name = $family_name;
  104. }
  105. /**
  106. * E+mail address. [REQUIRED field]
  107. *
  108. * @param string $email
  109. */
  110. public function setEmail($email)
  111. {
  112. $this->email = $email;
  113. }
  114. /**
  115. * Phone number.
  116. *
  117. * @param string $phone
  118. */
  119. public function setPhone($phone)
  120. {
  121. $this->phone = $phone;
  122. }
  123. /**
  124. * Street address, first line. [REQUIRED field]
  125. *
  126. * @param string $street_address
  127. */
  128. public function setStreetAddress($street_address)
  129. {
  130. $this->street_address = $street_address;
  131. }
  132. /**
  133. * Street address, second line.
  134. *
  135. * @param string $street_address
  136. */
  137. public function setStreetAddress2($street_address)
  138. {
  139. $this->street_address2 = $street_address;
  140. }
  141. /**
  142. * City. [REQUIRED field]
  143. *
  144. * @param string $city
  145. */
  146. public function setCity($city)
  147. {
  148. $this->city = $city;
  149. }
  150. /**
  151. * Region
  152. *
  153. * @param string $region
  154. */
  155. public function setRegion($region)
  156. {
  157. $this->region = $region;
  158. }
  159. /**
  160. * Postal/post code. [REQUIRED field]
  161. *
  162. * @param string $postal_code
  163. */
  164. public function setPostalCode($postal_code)
  165. {
  166. $this->postal_code = $postal_code;
  167. }
  168. /**
  169. * ISO 3166 alpha+2: Country. [REQUIRED field]
  170. *
  171. * @param string $country
  172. */
  173. public function setCountry($country)
  174. {
  175. $this->country = $country;
  176. }
  177. }