1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Common\PayPalModel;
6 use PayPal\Converter\FormatConverter;
7 use PayPal\Validation\NumericValidator;
8 use PayPal\Validation\UrlValidator;
9
10 /**
11 * Class InvoiceItem
12 *
13 * Information about a single line item.
14 *
15 * @package PayPal\Api
16 *
17 * @property string name
18 * @property string description
19 * @property \PayPal\Api\number quantity
20 * @property \PayPal\Api\Currency unit_price
21 * @property \PayPal\Api\Tax tax
22 * @property string date
23 * @property \PayPal\Api\Cost discount
24 * @property string unit_of_measure
25 */
26 class InvoiceItem extends PayPalModel
27 {
28 /**
29 * Name of the item. 200 characters max.
30 *
31 * @param string $name
32 *
33 * @return $this
34 */
35 public function setName($name)
36 {
37 $this->name = $name;
38 return $this;
39 }
40
41 /**
42 * Name of the item. 200 characters max.
43 *
44 * @return string
45 */
46 public function getName()
47 {
48 return $this->name;
49 }
50
51 /**
52 * Description of the item. 1000 characters max.
53 *
54 * @param string $description
55 *
56 * @return $this
57 */
58 public function setDescription($description)
59 {
60 $this->description = $description;
61 return $this;
62 }
63
64 /**
65 * Description of the item. 1000 characters max.
66 *
67 * @return string
68 */
69 public function getDescription()
70 {
71 return $this->description;
72 }
73
74 /**
75 * Quantity of the item. Range of -10000 to 10000.
76 *
77 * @param string|double $quantity
78 *
79 * @return $this
80 */
81 public function setQuantity($quantity)
82 {
83 NumericValidator::validate($quantity, "Quantity");
84 $quantity = FormatConverter::formatToPrice($quantity);
85 $this->quantity = $quantity;
86 return $this;
87 }
88
89 /**
90 * Quantity of the item. Range of -10000 to 10000.
91 *
92 * @return string
93 */
94 public function getQuantity()
95 {
96 return $this->quantity;
97 }
98
99 /**
100 * Unit price of the item. Range of -1,000,000 to 1,000,000.
101 *
102 * @param \PayPal\Api\Currency $unit_price
103 *
104 * @return $this
105 */
106 public function setUnitPrice($unit_price)
107 {
108 $this->unit_price = $unit_price;
109 return $this;
110 }
111
112 /**
113 * Unit price of the item. Range of -1,000,000 to 1,000,000.
114 *
115 * @return \PayPal\Api\Currency
116 */
117 public function getUnitPrice()
118 {
119 return $this->unit_price;
120 }
121
122 /**
123 * Tax associated with the item.
124 *
125 * @param \PayPal\Api\Tax $tax
126 *
127 * @return $this
128 */
129 public function setTax($tax)
130 {
131 $this->tax = $tax;
132 return $this;
133 }
134
135 /**
136 * Tax associated with the item.
137 *
138 * @return \PayPal\Api\Tax
139 */
140 public function getTax()
141 {
142 return $this->tax;
143 }
144
145 /**
146 * The date when the item or service was provided. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
147 *
148 * @param string $date
149 *
150 * @return $this
151 */
152 public function setDate($date)
153 {
154 $this->date = $date;
155 return $this;
156 }
157
158 /**
159 * The date when the item or service was provided. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
160 *
161 * @return string
162 */
163 public function getDate()
164 {
165 return $this->date;
166 }
167
168 /**
169 * The item discount, as a percent or an amount value.
170 *
171 * @param \PayPal\Api\Cost $discount
172 *
173 * @return $this
174 */
175 public function setDiscount($discount)
176 {
177 $this->discount = $discount;
178 return $this;
179 }
180
181 /**
182 * The item discount, as a percent or an amount value.
183 *
184 * @return \PayPal\Api\Cost
185 */
186 public function getDiscount()
187 {
188 return $this->discount;
189 }
190
191 /**
192 * The image URL. Maximum length is 4000 characters.
193 * @deprecated Not publicly available
194 * @param string $image_url
195 * @throws \InvalidArgumentException
196 * @return $this
197 */
198 public function setImageUrl($image_url)
199 {
200 UrlValidator::validate($image_url, "ImageUrl");
201 $this->image_url = $image_url;
202 return $this;
203 }
204
205 /**
206 * The image URL. Maximum length is 4000 characters.
207 * @deprecated Not publicly available
208 * @return string
209 */
210 public function getImageUrl()
211 {
212 return $this->image_url;
213 }
214
215 /**
216 * The unit of measure of the item being invoiced.
217 * Valid Values: ["QUANTITY", "HOURS", "AMOUNT"]
218 *
219 * @param string $unit_of_measure
220 *
221 * @return $this
222 */
223 public function setUnitOfMeasure($unit_of_measure)
224 {
225 $this->unit_of_measure = $unit_of_measure;
226 return $this;
227 }
228
229 /**
230 * The unit of measure of the item being invoiced.
231 *
232 * @return string
233 */
234 public function getUnitOfMeasure()
235 {
236 return $this->unit_of_measure;
237 }
238
239 }
240