1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Common\PayPalModel;
6 use PayPal\Validation\UrlValidator;
7
8 /**
9 * Class CartBase
10 *
11 * Base properties of a cart resource
12 *
13 * @package PayPal\Api
14 *
15 * @property string reference_id
16 * @property \PayPal\Api\Amount amount
17 * @property \PayPal\Api\Payee payee
18 * @property string description
19 * @property string note_to_payee
20 * @property string custom
21 * @property string invoice_number
22 * @property string purchase_order
23 * @property string soft_descriptor
24 * @property \PayPal\Api\PaymentOptions payment_options
25 * @property \PayPal\Api\ItemList item_list
26 * @property string notify_url
27 * @property string order_url
28 */
29 class CartBase extends PayPalModel
30 {
31 /**
32 * Merchant identifier to the purchase unit. Optional parameter
33 *
34 * @param string $reference_id
35 *
36 * @return $this
37 */
38 public function setReferenceId($reference_id)
39 {
40 $this->reference_id = $reference_id;
41 return $this;
42 }
43
44 /**
45 * Merchant identifier to the purchase unit. Optional parameter
46 *
47 * @return string
48 */
49 public function getReferenceId()
50 {
51 return $this->reference_id;
52 }
53
54 /**
55 * Amount being collected.
56 *
57 * @param \PayPal\Api\Amount $amount
58 *
59 * @return $this
60 */
61 public function setAmount($amount)
62 {
63 $this->amount = $amount;
64 return $this;
65 }
66
67 /**
68 * Amount being collected.
69 *
70 * @return \PayPal\Api\Amount
71 */
72 public function getAmount()
73 {
74 return $this->amount;
75 }
76
77 /**
78 * Recipient of the funds in this transaction.
79 *
80 * @param \PayPal\Api\Payee $payee
81 *
82 * @return $this
83 */
84 public function setPayee($payee)
85 {
86 $this->payee = $payee;
87 return $this;
88 }
89
90 /**
91 * Recipient of the funds in this transaction.
92 *
93 * @return \PayPal\Api\Payee
94 */
95 public function getPayee()
96 {
97 return $this->payee;
98 }
99
100 /**
101 * Description of what is being paid for.
102 *
103 * @param string $description
104 *
105 * @return $this
106 */
107 public function setDescription($description)
108 {
109 $this->description = $description;
110 return $this;
111 }
112
113 /**
114 * Description of what is being paid for.
115 *
116 * @return string
117 */
118 public function getDescription()
119 {
120 return $this->description;
121 }
122
123 /**
124 * Note to the recipient of the funds in this transaction.
125 *
126 * @param string $note_to_payee
127 *
128 * @return $this
129 */
130 public function setNoteToPayee($note_to_payee)
131 {
132 $this->note_to_payee = $note_to_payee;
133 return $this;
134 }
135
136 /**
137 * Note to the recipient of the funds in this transaction.
138 *
139 * @return string
140 */
141 public function getNoteToPayee()
142 {
143 return $this->note_to_payee;
144 }
145
146 /**
147 * free-form field for the use of clients
148 *
149 * @param string $custom
150 *
151 * @return $this
152 */
153 public function setCustom($custom)
154 {
155 $this->custom = $custom;
156 return $this;
157 }
158
159 /**
160 * free-form field for the use of clients
161 *
162 * @return string
163 */
164 public function getCustom()
165 {
166 return $this->custom;
167 }
168
169 /**
170 * invoice number to track this payment
171 *
172 * @param string $invoice_number
173 *
174 * @return $this
175 */
176 public function setInvoiceNumber($invoice_number)
177 {
178 $this->invoice_number = $invoice_number;
179 return $this;
180 }
181
182 /**
183 * invoice number to track this payment
184 *
185 * @return string
186 */
187 public function getInvoiceNumber()
188 {
189 return $this->invoice_number;
190 }
191
192 /**
193 * purchase order is number or id specific to this payment
194 *
195 * @param string $purchase_order
196 *
197 * @return $this
198 */
199 public function setPurchaseOrder($purchase_order)
200 {
201 $this->purchase_order = $purchase_order;
202 return $this;
203 }
204
205 /**
206 * purchase order is number or id specific to this payment
207 *
208 * @return string
209 */
210 public function getPurchaseOrder()
211 {
212 return $this->purchase_order;
213 }
214
215 /**
216 * Soft descriptor used when charging this funding source. If length exceeds max length, the value will be truncated
217 *
218 * @param string $soft_descriptor
219 *
220 * @return $this
221 */
222 public function setSoftDescriptor($soft_descriptor)
223 {
224 $this->soft_descriptor = $soft_descriptor;
225 return $this;
226 }
227
228 /**
229 * Soft descriptor used when charging this funding source. If length exceeds max length, the value will be truncated
230 *
231 * @return string
232 */
233 public function getSoftDescriptor()
234 {
235 return $this->soft_descriptor;
236 }
237
238 /**
239 * Soft descriptor city used when charging this funding source. If length exceeds max length, the value will be truncated. Only supported when the `payment_method` is set to `credit_card`
240 * @deprecated Not publicly available
241 * @param string $soft_descriptor_city
242 *
243 * @return $this
244 */
245 public function setSoftDescriptorCity($soft_descriptor_city)
246 {
247 $this->soft_descriptor_city = $soft_descriptor_city;
248 return $this;
249 }
250
251 /**
252 * Soft descriptor city used when charging this funding source. If length exceeds max length, the value will be truncated. Only supported when the `payment_method` is set to `credit_card`
253 * @deprecated Not publicly available
254 * @return string
255 */
256 public function getSoftDescriptorCity()
257 {
258 return $this->soft_descriptor_city;
259 }
260
261 /**
262 * Payment options requested for this purchase unit
263 *
264 * @param \PayPal\Api\PaymentOptions $payment_options
265 *
266 * @return $this
267 */
268 public function setPaymentOptions($payment_options)
269 {
270 $this->payment_options = $payment_options;
271 return $this;
272 }
273
274 /**
275 * Payment options requested for this purchase unit
276 *
277 * @return \PayPal\Api\PaymentOptions
278 */
279 public function getPaymentOptions()
280 {
281 return $this->payment_options;
282 }
283
284 /**
285 * List of items being paid for.
286 *
287 * @param \PayPal\Api\ItemList $item_list
288 *
289 * @return $this
290 */
291 public function setItemList($item_list)
292 {
293 $this->item_list = $item_list;
294 return $this;
295 }
296
297 /**
298 * List of items being paid for.
299 *
300 * @return \PayPal\Api\ItemList
301 */
302 public function getItemList()
303 {
304 return $this->item_list;
305 }
306
307 /**
308 * URL to send payment notifications
309 *
310 * @param string $notify_url
311 * @throws \InvalidArgumentException
312 * @return $this
313 */
314 public function setNotifyUrl($notify_url)
315 {
316 UrlValidator::validate($notify_url, "NotifyUrl");
317 $this->notify_url = $notify_url;
318 return $this;
319 }
320
321 /**
322 * URL to send payment notifications
323 *
324 * @return string
325 */
326 public function getNotifyUrl()
327 {
328 return $this->notify_url;
329 }
330
331 /**
332 * Url on merchant site pertaining to this payment.
333 *
334 * @param string $order_url
335 * @throws \InvalidArgumentException
336 * @return $this
337 */
338 public function setOrderUrl($order_url)
339 {
340 UrlValidator::validate($order_url, "OrderUrl");
341 $this->order_url = $order_url;
342 return $this;
343 }
344
345 /**
346 * Url on merchant site pertaining to this payment.
347 *
348 * @return string
349 */
350 public function getOrderUrl()
351 {
352 return $this->order_url;
353 }
354
355 /**
356 * List of external funding being applied to the purchase unit. Each external_funding unit should have a unique reference_id
357 * @deprecated Not publicly available
358 * @param \PayPal\Api\ExternalFunding[] $external_funding
359 *
360 * @return $this
361 */
362 public function setExternalFunding($external_funding)
363 {
364 $this->external_funding = $external_funding;
365 return $this;
366 }
367
368 /**
369 * List of external funding being applied to the purchase unit. Each external_funding unit should have a unique reference_id
370 * @deprecated Not publicly available
371 * @return \PayPal\Api\ExternalFunding[]
372 */
373 public function getExternalFunding()
374 {
375 return $this->external_funding;
376 }
377
378 /**
379 * Append ExternalFunding to the list.
380 * @deprecated Not publicly available
381 * @param \PayPal\Api\ExternalFunding $externalFunding
382 * @return $this
383 */
384 public function addExternalFunding($externalFunding)
385 {
386 if (!$this->getExternalFunding()) {
387 return $this->setExternalFunding(array($externalFunding));
388 } else {
389 return $this->setExternalFunding(
390 array_merge($this->getExternalFunding(), array($externalFunding))
391 );
392 }
393 }
394
395 /**
396 * Remove ExternalFunding from the list.
397 * @deprecated Not publicly available
398 * @param \PayPal\Api\ExternalFunding $externalFunding
399 * @return $this
400 */
401 public function removeExternalFunding($externalFunding)
402 {
403 return $this->setExternalFunding(
404 array_diff($this->getExternalFunding(), array($externalFunding))
405 );
406 }
407
408 }
409