PluginProbe
WooCommerce Square / 2.2.5
WooCommerce Square v2.2.5
5.5.0 5.4.3 5.4.2 5.4.1 5.4.0 trunk 1.0.25 1.0.26 1.0.27 1.0.28 1.0.29 1.0.30 1.0.31 1.0.32 1.0.33 1.0.34 1.0.35 1.0.36 1.0.37 1.0.38 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 All 132 releases
woocommerce-square / vendor / square / connect / lib / Model / CatalogItemVariation.php
CatalogItemVariation.php
609 lines 19.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * NOTE: This class is auto generated by the swagger code generator program.
4 * https://github.com/swagger-api/swagger-codegen
5 * Do not edit the class manually.
6 */
7
8 namespace SquareConnect\Model;
9
10 use \ArrayAccess;
11 /**
12 * CatalogItemVariation Class Doc Comment
13 *
14 * @category Class
15 * @package SquareConnect
16 * @author Square Inc.
17 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
18 * @link https://squareup.com/developers
19 */
20 class CatalogItemVariation implements ArrayAccess
21 {
22 /**
23 * Array of property to type mappings. Used for (de)serialization
24 * @var string[]
25 */
26 static $swaggerTypes = array(
27 'item_id' => 'string',
28 'name' => 'string',
29 'sku' => 'string',
30 'upc' => 'string',
31 'ordinal' => 'int',
32 'pricing_type' => 'string',
33 'price_money' => '\SquareConnect\Model\Money',
34 'location_overrides' => '\SquareConnect\Model\ItemVariationLocationOverrides[]',
35 'track_inventory' => 'bool',
36 'inventory_alert_type' => 'string',
37 'inventory_alert_threshold' => 'int',
38 'user_data' => 'string',
39 'service_duration' => 'int',
40 'item_option_values' => '\SquareConnect\Model\CatalogItemOptionValueForItemVariation[]',
41 'measurement_unit_id' => 'string'
42 );
43
44 /**
45 * Array of attributes where the key is the local name, and the value is the original name
46 * @var string[]
47 */
48 static $attributeMap = array(
49 'item_id' => 'item_id',
50 'name' => 'name',
51 'sku' => 'sku',
52 'upc' => 'upc',
53 'ordinal' => 'ordinal',
54 'pricing_type' => 'pricing_type',
55 'price_money' => 'price_money',
56 'location_overrides' => 'location_overrides',
57 'track_inventory' => 'track_inventory',
58 'inventory_alert_type' => 'inventory_alert_type',
59 'inventory_alert_threshold' => 'inventory_alert_threshold',
60 'user_data' => 'user_data',
61 'service_duration' => 'service_duration',
62 'item_option_values' => 'item_option_values',
63 'measurement_unit_id' => 'measurement_unit_id'
64 );
65
66 /**
67 * Array of attributes to setter functions (for deserialization of responses)
68 * @var string[]
69 */
70 static $setters = array(
71 'item_id' => 'setItemId',
72 'name' => 'setName',
73 'sku' => 'setSku',
74 'upc' => 'setUpc',
75 'ordinal' => 'setOrdinal',
76 'pricing_type' => 'setPricingType',
77 'price_money' => 'setPriceMoney',
78 'location_overrides' => 'setLocationOverrides',
79 'track_inventory' => 'setTrackInventory',
80 'inventory_alert_type' => 'setInventoryAlertType',
81 'inventory_alert_threshold' => 'setInventoryAlertThreshold',
82 'user_data' => 'setUserData',
83 'service_duration' => 'setServiceDuration',
84 'item_option_values' => 'setItemOptionValues',
85 'measurement_unit_id' => 'setMeasurementUnitId'
86 );
87
88 /**
89 * Array of attributes to getter functions (for serialization of requests)
90 * @var string[]
91 */
92 static $getters = array(
93 'item_id' => 'getItemId',
94 'name' => 'getName',
95 'sku' => 'getSku',
96 'upc' => 'getUpc',
97 'ordinal' => 'getOrdinal',
98 'pricing_type' => 'getPricingType',
99 'price_money' => 'getPriceMoney',
100 'location_overrides' => 'getLocationOverrides',
101 'track_inventory' => 'getTrackInventory',
102 'inventory_alert_type' => 'getInventoryAlertType',
103 'inventory_alert_threshold' => 'getInventoryAlertThreshold',
104 'user_data' => 'getUserData',
105 'service_duration' => 'getServiceDuration',
106 'item_option_values' => 'getItemOptionValues',
107 'measurement_unit_id' => 'getMeasurementUnitId'
108 );
109
110 /**
111 * $item_id The ID of the [CatalogItem](#type-catalogitem) associated with this item variation. Searchable.
112 * @var string
113 */
114 protected $item_id;
115 /**
116 * $name The item variation's name. Searchable. This field has max length of 255 Unicode code points.
117 * @var string
118 */
119 protected $name;
120 /**
121 * $sku The item variation's SKU, if any. Searchable.
122 * @var string
123 */
124 protected $sku;
125 /**
126 * $upc The item variation's UPC, if any. Searchable in the Connect API. This field is only exposed in the Connect API. It is not exposed in Square's Dashboard, Square Point of Sale app or Retail Point of Sale app.
127 * @var string
128 */
129 protected $upc;
130 /**
131 * $ordinal The order in which this item variation should be displayed. This value is read-only. On writes, the ordinal for each item variation within a parent [CatalogItem](#type-catalogitem) is set according to the item variations's position. On reads, the value is not guaranteed to be sequential or unique.
132 * @var int
133 */
134 protected $ordinal;
135 /**
136 * $pricing_type Indicates whether the item variation's price is fixed or determined at the time of sale. See [CatalogPricingType](#type-catalogpricingtype) for possible values
137 * @var string
138 */
139 protected $pricing_type;
140 /**
141 * $price_money The item variation's price, if fixed pricing is used.
142 * @var \SquareConnect\Model\Money
143 */
144 protected $price_money;
145 /**
146 * $location_overrides Per-[location](#type-location) price and inventory overrides.
147 * @var \SquareConnect\Model\ItemVariationLocationOverrides[]
148 */
149 protected $location_overrides;
150 /**
151 * $track_inventory If `true`, inventory tracking is active for the variation.
152 * @var bool
153 */
154 protected $track_inventory;
155 /**
156 * $inventory_alert_type Indicates whether the item variation displays an alert when its inventory quantity is less than or equal to its `inventory_alert_threshold`. See [InventoryAlertType](#type-inventoryalerttype) for possible values
157 * @var string
158 */
159 protected $inventory_alert_type;
160 /**
161 * $inventory_alert_threshold If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. This value is always an integer.
162 * @var int
163 */
164 protected $inventory_alert_threshold;
165 /**
166 * $user_data Arbitrary user metadata to associate with the item variation. Cannot exceed 255 characters. Searchable.
167 * @var string
168 */
169 protected $user_data;
170 /**
171 * $service_duration If the [CatalogItem](#type-catalogitem) that owns this item variation is of type `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For example, a 30 minute appointment would have the value `1800000`, which is equal to 30 (minutes) * 60 (seconds per minute) * 1000 (milliseconds per second).
172 * @var int
173 */
174 protected $service_duration;
175 /**
176 * $item_option_values List of item option values associated with this item variation. Listed in the same order as the item options of the parent item.
177 * @var \SquareConnect\Model\CatalogItemOptionValueForItemVariation[]
178 */
179 protected $item_option_values;
180 /**
181 * $measurement_unit_id ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity sold of this item variation. If left unset, the item will be sold in whole quantities.
182 * @var string
183 */
184 protected $measurement_unit_id;
185
186 /**
187 * Constructor
188 * @param mixed[] $data Associated array of property value initializing the model
189 */
190 public function __construct(array $data = null)
191 {
192 if ($data != null) {
193 if (isset($data["item_id"])) {
194 $this->item_id = $data["item_id"];
195 } else {
196 $this->item_id = null;
197 }
198 if (isset($data["name"])) {
199 $this->name = $data["name"];
200 } else {
201 $this->name = null;
202 }
203 if (isset($data["sku"])) {
204 $this->sku = $data["sku"];
205 } else {
206 $this->sku = null;
207 }
208 if (isset($data["upc"])) {
209 $this->upc = $data["upc"];
210 } else {
211 $this->upc = null;
212 }
213 if (isset($data["ordinal"])) {
214 $this->ordinal = $data["ordinal"];
215 } else {
216 $this->ordinal = null;
217 }
218 if (isset($data["pricing_type"])) {
219 $this->pricing_type = $data["pricing_type"];
220 } else {
221 $this->pricing_type = null;
222 }
223 if (isset($data["price_money"])) {
224 $this->price_money = $data["price_money"];
225 } else {
226 $this->price_money = null;
227 }
228 if (isset($data["location_overrides"])) {
229 $this->location_overrides = $data["location_overrides"];
230 } else {
231 $this->location_overrides = null;
232 }
233 if (isset($data["track_inventory"])) {
234 $this->track_inventory = $data["track_inventory"];
235 } else {
236 $this->track_inventory = null;
237 }
238 if (isset($data["inventory_alert_type"])) {
239 $this->inventory_alert_type = $data["inventory_alert_type"];
240 } else {
241 $this->inventory_alert_type = null;
242 }
243 if (isset($data["inventory_alert_threshold"])) {
244 $this->inventory_alert_threshold = $data["inventory_alert_threshold"];
245 } else {
246 $this->inventory_alert_threshold = null;
247 }
248 if (isset($data["user_data"])) {
249 $this->user_data = $data["user_data"];
250 } else {
251 $this->user_data = null;
252 }
253 if (isset($data["service_duration"])) {
254 $this->service_duration = $data["service_duration"];
255 } else {
256 $this->service_duration = null;
257 }
258 if (isset($data["item_option_values"])) {
259 $this->item_option_values = $data["item_option_values"];
260 } else {
261 $this->item_option_values = null;
262 }
263 if (isset($data["measurement_unit_id"])) {
264 $this->measurement_unit_id = $data["measurement_unit_id"];
265 } else {
266 $this->measurement_unit_id = null;
267 }
268 }
269 }
270 /**
271 * Gets item_id
272 * @return string
273 */
274 public function getItemId()
275 {
276 return $this->item_id;
277 }
278
279 /**
280 * Sets item_id
281 * @param string $item_id The ID of the [CatalogItem](#type-catalogitem) associated with this item variation. Searchable.
282 * @return $this
283 */
284 public function setItemId($item_id)
285 {
286 $this->item_id = $item_id;
287 return $this;
288 }
289 /**
290 * Gets name
291 * @return string
292 */
293 public function getName()
294 {
295 return $this->name;
296 }
297
298 /**
299 * Sets name
300 * @param string $name The item variation's name. Searchable. This field has max length of 255 Unicode code points.
301 * @return $this
302 */
303 public function setName($name)
304 {
305 $this->name = $name;
306 return $this;
307 }
308 /**
309 * Gets sku
310 * @return string
311 */
312 public function getSku()
313 {
314 return $this->sku;
315 }
316
317 /**
318 * Sets sku
319 * @param string $sku The item variation's SKU, if any. Searchable.
320 * @return $this
321 */
322 public function setSku($sku)
323 {
324 $this->sku = $sku;
325 return $this;
326 }
327 /**
328 * Gets upc
329 * @return string
330 */
331 public function getUpc()
332 {
333 return $this->upc;
334 }
335
336 /**
337 * Sets upc
338 * @param string $upc The item variation's UPC, if any. Searchable in the Connect API. This field is only exposed in the Connect API. It is not exposed in Square's Dashboard, Square Point of Sale app or Retail Point of Sale app.
339 * @return $this
340 */
341 public function setUpc($upc)
342 {
343 $this->upc = $upc;
344 return $this;
345 }
346 /**
347 * Gets ordinal
348 * @return int
349 */
350 public function getOrdinal()
351 {
352 return $this->ordinal;
353 }
354
355 /**
356 * Sets ordinal
357 * @param int $ordinal The order in which this item variation should be displayed. This value is read-only. On writes, the ordinal for each item variation within a parent [CatalogItem](#type-catalogitem) is set according to the item variations's position. On reads, the value is not guaranteed to be sequential or unique.
358 * @return $this
359 */
360 public function setOrdinal($ordinal)
361 {
362 $this->ordinal = $ordinal;
363 return $this;
364 }
365 /**
366 * Gets pricing_type
367 * @return string
368 */
369 public function getPricingType()
370 {
371 return $this->pricing_type;
372 }
373
374 /**
375 * Sets pricing_type
376 * @param string $pricing_type Indicates whether the item variation's price is fixed or determined at the time of sale. See [CatalogPricingType](#type-catalogpricingtype) for possible values
377 * @return $this
378 */
379 public function setPricingType($pricing_type)
380 {
381 $this->pricing_type = $pricing_type;
382 return $this;
383 }
384 /**
385 * Gets price_money
386 * @return \SquareConnect\Model\Money
387 */
388 public function getPriceMoney()
389 {
390 return $this->price_money;
391 }
392
393 /**
394 * Sets price_money
395 * @param \SquareConnect\Model\Money $price_money The item variation's price, if fixed pricing is used.
396 * @return $this
397 */
398 public function setPriceMoney($price_money)
399 {
400 $this->price_money = $price_money;
401 return $this;
402 }
403 /**
404 * Gets location_overrides
405 * @return \SquareConnect\Model\ItemVariationLocationOverrides[]
406 */
407 public function getLocationOverrides()
408 {
409 return $this->location_overrides;
410 }
411
412 /**
413 * Sets location_overrides
414 * @param \SquareConnect\Model\ItemVariationLocationOverrides[] $location_overrides Per-[location](#type-location) price and inventory overrides.
415 * @return $this
416 */
417 public function setLocationOverrides($location_overrides)
418 {
419 $this->location_overrides = $location_overrides;
420 return $this;
421 }
422 /**
423 * Gets track_inventory
424 * @return bool
425 */
426 public function getTrackInventory()
427 {
428 return $this->track_inventory;
429 }
430
431 /**
432 * Sets track_inventory
433 * @param bool $track_inventory If `true`, inventory tracking is active for the variation.
434 * @return $this
435 */
436 public function setTrackInventory($track_inventory)
437 {
438 $this->track_inventory = $track_inventory;
439 return $this;
440 }
441 /**
442 * Gets inventory_alert_type
443 * @return string
444 */
445 public function getInventoryAlertType()
446 {
447 return $this->inventory_alert_type;
448 }
449
450 /**
451 * Sets inventory_alert_type
452 * @param string $inventory_alert_type Indicates whether the item variation displays an alert when its inventory quantity is less than or equal to its `inventory_alert_threshold`. See [InventoryAlertType](#type-inventoryalerttype) for possible values
453 * @return $this
454 */
455 public function setInventoryAlertType($inventory_alert_type)
456 {
457 $this->inventory_alert_type = $inventory_alert_type;
458 return $this;
459 }
460 /**
461 * Gets inventory_alert_threshold
462 * @return int
463 */
464 public function getInventoryAlertThreshold()
465 {
466 return $this->inventory_alert_threshold;
467 }
468
469 /**
470 * Sets inventory_alert_threshold
471 * @param int $inventory_alert_threshold If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. This value is always an integer.
472 * @return $this
473 */
474 public function setInventoryAlertThreshold($inventory_alert_threshold)
475 {
476 $this->inventory_alert_threshold = $inventory_alert_threshold;
477 return $this;
478 }
479 /**
480 * Gets user_data
481 * @return string
482 */
483 public function getUserData()
484 {
485 return $this->user_data;
486 }
487
488 /**
489 * Sets user_data
490 * @param string $user_data Arbitrary user metadata to associate with the item variation. Cannot exceed 255 characters. Searchable.
491 * @return $this
492 */
493 public function setUserData($user_data)
494 {
495 $this->user_data = $user_data;
496 return $this;
497 }
498 /**
499 * Gets service_duration
500 * @return int
501 */
502 public function getServiceDuration()
503 {
504 return $this->service_duration;
505 }
506
507 /**
508 * Sets service_duration
509 * @param int $service_duration If the [CatalogItem](#type-catalogitem) that owns this item variation is of type `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For example, a 30 minute appointment would have the value `1800000`, which is equal to 30 (minutes) * 60 (seconds per minute) * 1000 (milliseconds per second).
510 * @return $this
511 */
512 public function setServiceDuration($service_duration)
513 {
514 $this->service_duration = $service_duration;
515 return $this;
516 }
517 /**
518 * Gets item_option_values
519 * @return \SquareConnect\Model\CatalogItemOptionValueForItemVariation[]
520 */
521 public function getItemOptionValues()
522 {
523 return $this->item_option_values;
524 }
525
526 /**
527 * Sets item_option_values
528 * @param \SquareConnect\Model\CatalogItemOptionValueForItemVariation[] $item_option_values List of item option values associated with this item variation. Listed in the same order as the item options of the parent item.
529 * @return $this
530 */
531 public function setItemOptionValues($item_option_values)
532 {
533 $this->item_option_values = $item_option_values;
534 return $this;
535 }
536 /**
537 * Gets measurement_unit_id
538 * @return string
539 */
540 public function getMeasurementUnitId()
541 {
542 return $this->measurement_unit_id;
543 }
544
545 /**
546 * Sets measurement_unit_id
547 * @param string $measurement_unit_id ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity sold of this item variation. If left unset, the item will be sold in whole quantities.
548 * @return $this
549 */
550 public function setMeasurementUnitId($measurement_unit_id)
551 {
552 $this->measurement_unit_id = $measurement_unit_id;
553 return $this;
554 }
555 /**
556 * Returns true if offset exists. False otherwise.
557 * @param integer $offset Offset
558 * @return boolean
559 */
560 public function offsetExists($offset)
561 {
562 return isset($this->$offset);
563 }
564
565 /**
566 * Gets offset.
567 * @param integer $offset Offset
568 * @return mixed
569 */
570 public function offsetGet($offset)
571 {
572 return $this->$offset;
573 }
574
575 /**
576 * Sets value based on offset.
577 * @param integer $offset Offset
578 * @param mixed $value Value to be set
579 * @return void
580 */
581 public function offsetSet($offset, $value)
582 {
583 $this->$offset = $value;
584 }
585
586 /**
587 * Unsets offset.
588 * @param integer $offset Offset
589 * @return void
590 */
591 public function offsetUnset($offset)
592 {
593 unset($this->$offset);
594 }
595
596 /**
597 * Gets the string presentation of the object
598 * @return string
599 */
600 public function __toString()
601 {
602 if (defined('JSON_PRETTY_PRINT')) {
603 return json_encode(\SquareConnect\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
604 } else {
605 return json_encode(\SquareConnect\ObjectSerializer::sanitizeForSerialization($this));
606 }
607 }
608 }
609