1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Common\PayPalModel;
6
7 /**
8 * Class ItemList
9 *
10 * List of items being paid for.
11 *
12 * @package PayPal\Api
13 *
14 * @property \PayPal\Api\Item[] items
15 * @property \PayPal\Api\ShippingAddress shipping_address
16 * @property string shipping_method
17 * @property string shipping_phone_number
18 */
19 class ItemList extends PayPalModel
20 {
21 /**
22 * List of items.
23 *
24 * @param \PayPal\Api\Item[] $items
25 *
26 * @return $this
27 */
28 public function setItems($items)
29 {
30 $this->items = $items;
31 return $this;
32 }
33
34 /**
35 * List of items.
36 *
37 * @return \PayPal\Api\Item[]
38 */
39 public function getItems()
40 {
41 return $this->items;
42 }
43
44 /**
45 * Append Items to the list.
46 *
47 * @param \PayPal\Api\Item $item
48 * @return $this
49 */
50 public function addItem($item)
51 {
52 if (!$this->getItems()) {
53 return $this->setItems(array($item));
54 } else {
55 return $this->setItems(
56 array_merge($this->getItems(), array($item))
57 );
58 }
59 }
60
61 /**
62 * Remove Items from the list.
63 *
64 * @param \PayPal\Api\Item $item
65 * @return $this
66 */
67 public function removeItem($item)
68 {
69 return $this->setItems(
70 array_diff($this->getItems(), array($item))
71 );
72 }
73
74 /**
75 * Shipping address.
76 *
77 * @param \PayPal\Api\ShippingAddress $shipping_address
78 *
79 * @return $this
80 */
81 public function setShippingAddress($shipping_address)
82 {
83 $this->shipping_address = $shipping_address;
84 return $this;
85 }
86
87 /**
88 * Shipping address.
89 *
90 * @return \PayPal\Api\ShippingAddress
91 */
92 public function getShippingAddress()
93 {
94 return $this->shipping_address;
95 }
96
97 /**
98 * Shipping method used for this payment like USPSParcel etc.
99 *
100 * @param string $shipping_method
101 *
102 * @return $this
103 */
104 public function setShippingMethod($shipping_method)
105 {
106 $this->shipping_method = $shipping_method;
107 return $this;
108 }
109
110 /**
111 * Shipping method used for this payment like USPSParcel etc.
112 *
113 * @return string
114 */
115 public function getShippingMethod()
116 {
117 return $this->shipping_method;
118 }
119
120 /**
121 * Allows merchant's to share payer’s contact number with PayPal for the current payment. Final contact number of payer associated with the transaction might be same as shipping_phone_number or different based on Payer’s action on PayPal. The phone number must be represented in its canonical international format, as defined by the E.164 numbering plan
122 *
123 * @param string $shipping_phone_number
124 *
125 * @return $this
126 */
127 public function setShippingPhoneNumber($shipping_phone_number)
128 {
129 $this->shipping_phone_number = $shipping_phone_number;
130 return $this;
131 }
132
133 /**
134 * Allows merchant's to share payer’s contact number with PayPal for the current payment. Final contact number of payer associated with the transaction might be same as shipping_phone_number or different based on Payer’s action on PayPal. The phone number must be represented in its canonical international format, as defined by the E.164 numbering plan
135 *
136 * @return string
137 */
138 public function getShippingPhoneNumber()
139 {
140 return $this->shipping_phone_number;
141 }
142
143 }
144