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 / Transaction.php
Transaction.php
444 lines 12.7 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 * Transaction 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 Transaction implements ArrayAccess
21 {
22 /**
23 * Array of property to type mappings. Used for (de)serialization
24 * @var string[]
25 */
26 static $swaggerTypes = array(
27 'id' => 'string',
28 'location_id' => 'string',
29 'created_at' => 'string',
30 'tenders' => '\SquareConnect\Model\Tender[]',
31 'refunds' => '\SquareConnect\Model\Refund[]',
32 'reference_id' => 'string',
33 'product' => 'string',
34 'client_id' => 'string',
35 'shipping_address' => '\SquareConnect\Model\Address',
36 'order_id' => 'string'
37 );
38
39 /**
40 * Array of attributes where the key is the local name, and the value is the original name
41 * @var string[]
42 */
43 static $attributeMap = array(
44 'id' => 'id',
45 'location_id' => 'location_id',
46 'created_at' => 'created_at',
47 'tenders' => 'tenders',
48 'refunds' => 'refunds',
49 'reference_id' => 'reference_id',
50 'product' => 'product',
51 'client_id' => 'client_id',
52 'shipping_address' => 'shipping_address',
53 'order_id' => 'order_id'
54 );
55
56 /**
57 * Array of attributes to setter functions (for deserialization of responses)
58 * @var string[]
59 */
60 static $setters = array(
61 'id' => 'setId',
62 'location_id' => 'setLocationId',
63 'created_at' => 'setCreatedAt',
64 'tenders' => 'setTenders',
65 'refunds' => 'setRefunds',
66 'reference_id' => 'setReferenceId',
67 'product' => 'setProduct',
68 'client_id' => 'setClientId',
69 'shipping_address' => 'setShippingAddress',
70 'order_id' => 'setOrderId'
71 );
72
73 /**
74 * Array of attributes to getter functions (for serialization of requests)
75 * @var string[]
76 */
77 static $getters = array(
78 'id' => 'getId',
79 'location_id' => 'getLocationId',
80 'created_at' => 'getCreatedAt',
81 'tenders' => 'getTenders',
82 'refunds' => 'getRefunds',
83 'reference_id' => 'getReferenceId',
84 'product' => 'getProduct',
85 'client_id' => 'getClientId',
86 'shipping_address' => 'getShippingAddress',
87 'order_id' => 'getOrderId'
88 );
89
90 /**
91 * $id The transaction's unique ID, issued by Square payments servers.
92 * @var string
93 */
94 protected $id;
95 /**
96 * $location_id The ID of the transaction's associated location.
97 * @var string
98 */
99 protected $location_id;
100 /**
101 * $created_at The time when the transaction was created, in RFC 3339 format.
102 * @var string
103 */
104 protected $created_at;
105 /**
106 * $tenders The tenders used to pay in the transaction.
107 * @var \SquareConnect\Model\Tender[]
108 */
109 protected $tenders;
110 /**
111 * $refunds Refunds that have been applied to any tender in the transaction.
112 * @var \SquareConnect\Model\Refund[]
113 */
114 protected $refunds;
115 /**
116 * $reference_id If the transaction was created with the [Charge](#endpoint-transactions-charge) endpoint, this value is the same as the value provided for the `reference_id` parameter in the request to that endpoint. Otherwise, it is not set.
117 * @var string
118 */
119 protected $reference_id;
120 /**
121 * $product The Square product that processed the transaction. See [TransactionProduct](#type-transactionproduct) for possible values
122 * @var string
123 */
124 protected $product;
125 /**
126 * $client_id If the transaction was created in the Square Point of Sale app, this value is the ID generated for the transaction by Square Point of Sale. This ID has no relationship to the transaction's canonical `id`, which is generated by Square's backend servers. This value is generated for bookkeeping purposes, in case the transaction cannot immediately be completed (for example, if the transaction is processed in offline mode). It is not currently possible with the Connect API to perform a transaction lookup by this value.
127 * @var string
128 */
129 protected $client_id;
130 /**
131 * $shipping_address The shipping address provided in the request, if any.
132 * @var \SquareConnect\Model\Address
133 */
134 protected $shipping_address;
135 /**
136 * $order_id The order_id is an identifier for the order associated with this transaction, if any.
137 * @var string
138 */
139 protected $order_id;
140
141 /**
142 * Constructor
143 * @param mixed[] $data Associated array of property value initializing the model
144 */
145 public function __construct(array $data = null)
146 {
147 if ($data != null) {
148 if (isset($data["id"])) {
149 $this->id = $data["id"];
150 } else {
151 $this->id = null;
152 }
153 if (isset($data["location_id"])) {
154 $this->location_id = $data["location_id"];
155 } else {
156 $this->location_id = null;
157 }
158 if (isset($data["created_at"])) {
159 $this->created_at = $data["created_at"];
160 } else {
161 $this->created_at = null;
162 }
163 if (isset($data["tenders"])) {
164 $this->tenders = $data["tenders"];
165 } else {
166 $this->tenders = null;
167 }
168 if (isset($data["refunds"])) {
169 $this->refunds = $data["refunds"];
170 } else {
171 $this->refunds = null;
172 }
173 if (isset($data["reference_id"])) {
174 $this->reference_id = $data["reference_id"];
175 } else {
176 $this->reference_id = null;
177 }
178 if (isset($data["product"])) {
179 $this->product = $data["product"];
180 } else {
181 $this->product = null;
182 }
183 if (isset($data["client_id"])) {
184 $this->client_id = $data["client_id"];
185 } else {
186 $this->client_id = null;
187 }
188 if (isset($data["shipping_address"])) {
189 $this->shipping_address = $data["shipping_address"];
190 } else {
191 $this->shipping_address = null;
192 }
193 if (isset($data["order_id"])) {
194 $this->order_id = $data["order_id"];
195 } else {
196 $this->order_id = null;
197 }
198 }
199 }
200 /**
201 * Gets id
202 * @return string
203 */
204 public function getId()
205 {
206 return $this->id;
207 }
208
209 /**
210 * Sets id
211 * @param string $id The transaction's unique ID, issued by Square payments servers.
212 * @return $this
213 */
214 public function setId($id)
215 {
216 $this->id = $id;
217 return $this;
218 }
219 /**
220 * Gets location_id
221 * @return string
222 */
223 public function getLocationId()
224 {
225 return $this->location_id;
226 }
227
228 /**
229 * Sets location_id
230 * @param string $location_id The ID of the transaction's associated location.
231 * @return $this
232 */
233 public function setLocationId($location_id)
234 {
235 $this->location_id = $location_id;
236 return $this;
237 }
238 /**
239 * Gets created_at
240 * @return string
241 */
242 public function getCreatedAt()
243 {
244 return $this->created_at;
245 }
246
247 /**
248 * Sets created_at
249 * @param string $created_at The time when the transaction was created, in RFC 3339 format.
250 * @return $this
251 */
252 public function setCreatedAt($created_at)
253 {
254 $this->created_at = $created_at;
255 return $this;
256 }
257 /**
258 * Gets tenders
259 * @return \SquareConnect\Model\Tender[]
260 */
261 public function getTenders()
262 {
263 return $this->tenders;
264 }
265
266 /**
267 * Sets tenders
268 * @param \SquareConnect\Model\Tender[] $tenders The tenders used to pay in the transaction.
269 * @return $this
270 */
271 public function setTenders($tenders)
272 {
273 $this->tenders = $tenders;
274 return $this;
275 }
276 /**
277 * Gets refunds
278 * @return \SquareConnect\Model\Refund[]
279 */
280 public function getRefunds()
281 {
282 return $this->refunds;
283 }
284
285 /**
286 * Sets refunds
287 * @param \SquareConnect\Model\Refund[] $refunds Refunds that have been applied to any tender in the transaction.
288 * @return $this
289 */
290 public function setRefunds($refunds)
291 {
292 $this->refunds = $refunds;
293 return $this;
294 }
295 /**
296 * Gets reference_id
297 * @return string
298 */
299 public function getReferenceId()
300 {
301 return $this->reference_id;
302 }
303
304 /**
305 * Sets reference_id
306 * @param string $reference_id If the transaction was created with the [Charge](#endpoint-transactions-charge) endpoint, this value is the same as the value provided for the `reference_id` parameter in the request to that endpoint. Otherwise, it is not set.
307 * @return $this
308 */
309 public function setReferenceId($reference_id)
310 {
311 $this->reference_id = $reference_id;
312 return $this;
313 }
314 /**
315 * Gets product
316 * @return string
317 */
318 public function getProduct()
319 {
320 return $this->product;
321 }
322
323 /**
324 * Sets product
325 * @param string $product The Square product that processed the transaction. See [TransactionProduct](#type-transactionproduct) for possible values
326 * @return $this
327 */
328 public function setProduct($product)
329 {
330 $this->product = $product;
331 return $this;
332 }
333 /**
334 * Gets client_id
335 * @return string
336 */
337 public function getClientId()
338 {
339 return $this->client_id;
340 }
341
342 /**
343 * Sets client_id
344 * @param string $client_id If the transaction was created in the Square Point of Sale app, this value is the ID generated for the transaction by Square Point of Sale. This ID has no relationship to the transaction's canonical `id`, which is generated by Square's backend servers. This value is generated for bookkeeping purposes, in case the transaction cannot immediately be completed (for example, if the transaction is processed in offline mode). It is not currently possible with the Connect API to perform a transaction lookup by this value.
345 * @return $this
346 */
347 public function setClientId($client_id)
348 {
349 $this->client_id = $client_id;
350 return $this;
351 }
352 /**
353 * Gets shipping_address
354 * @return \SquareConnect\Model\Address
355 */
356 public function getShippingAddress()
357 {
358 return $this->shipping_address;
359 }
360
361 /**
362 * Sets shipping_address
363 * @param \SquareConnect\Model\Address $shipping_address The shipping address provided in the request, if any.
364 * @return $this
365 */
366 public function setShippingAddress($shipping_address)
367 {
368 $this->shipping_address = $shipping_address;
369 return $this;
370 }
371 /**
372 * Gets order_id
373 * @return string
374 */
375 public function getOrderId()
376 {
377 return $this->order_id;
378 }
379
380 /**
381 * Sets order_id
382 * @param string $order_id The order_id is an identifier for the order associated with this transaction, if any.
383 * @return $this
384 */
385 public function setOrderId($order_id)
386 {
387 $this->order_id = $order_id;
388 return $this;
389 }
390 /**
391 * Returns true if offset exists. False otherwise.
392 * @param integer $offset Offset
393 * @return boolean
394 */
395 public function offsetExists($offset)
396 {
397 return isset($this->$offset);
398 }
399
400 /**
401 * Gets offset.
402 * @param integer $offset Offset
403 * @return mixed
404 */
405 public function offsetGet($offset)
406 {
407 return $this->$offset;
408 }
409
410 /**
411 * Sets value based on offset.
412 * @param integer $offset Offset
413 * @param mixed $value Value to be set
414 * @return void
415 */
416 public function offsetSet($offset, $value)
417 {
418 $this->$offset = $value;
419 }
420
421 /**
422 * Unsets offset.
423 * @param integer $offset Offset
424 * @return void
425 */
426 public function offsetUnset($offset)
427 {
428 unset($this->$offset);
429 }
430
431 /**
432 * Gets the string presentation of the object
433 * @return string
434 */
435 public function __toString()
436 {
437 if (defined('JSON_PRETTY_PRINT')) {
438 return json_encode(\SquareConnect\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
439 } else {
440 return json_encode(\SquareConnect\ObjectSerializer::sanitizeForSerialization($this));
441 }
442 }
443 }
444