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 / Checkout.php
Checkout.php
444 lines 15.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 * Checkout 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 Checkout 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 'checkout_page_url' => 'string',
29 'ask_for_shipping_address' => 'bool',
30 'merchant_support_email' => 'string',
31 'pre_populate_buyer_email' => 'string',
32 'pre_populate_shipping_address' => '\SquareConnect\Model\Address',
33 'redirect_url' => 'string',
34 'order' => '\SquareConnect\Model\Order',
35 'created_at' => 'string',
36 'additional_recipients' => '\SquareConnect\Model\AdditionalRecipient[]'
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 'checkout_page_url' => 'checkout_page_url',
46 'ask_for_shipping_address' => 'ask_for_shipping_address',
47 'merchant_support_email' => 'merchant_support_email',
48 'pre_populate_buyer_email' => 'pre_populate_buyer_email',
49 'pre_populate_shipping_address' => 'pre_populate_shipping_address',
50 'redirect_url' => 'redirect_url',
51 'order' => 'order',
52 'created_at' => 'created_at',
53 'additional_recipients' => 'additional_recipients'
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 'checkout_page_url' => 'setCheckoutPageUrl',
63 'ask_for_shipping_address' => 'setAskForShippingAddress',
64 'merchant_support_email' => 'setMerchantSupportEmail',
65 'pre_populate_buyer_email' => 'setPrePopulateBuyerEmail',
66 'pre_populate_shipping_address' => 'setPrePopulateShippingAddress',
67 'redirect_url' => 'setRedirectUrl',
68 'order' => 'setOrder',
69 'created_at' => 'setCreatedAt',
70 'additional_recipients' => 'setAdditionalRecipients'
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 'checkout_page_url' => 'getCheckoutPageUrl',
80 'ask_for_shipping_address' => 'getAskForShippingAddress',
81 'merchant_support_email' => 'getMerchantSupportEmail',
82 'pre_populate_buyer_email' => 'getPrePopulateBuyerEmail',
83 'pre_populate_shipping_address' => 'getPrePopulateShippingAddress',
84 'redirect_url' => 'getRedirectUrl',
85 'order' => 'getOrder',
86 'created_at' => 'getCreatedAt',
87 'additional_recipients' => 'getAdditionalRecipients'
88 );
89
90 /**
91 * $id ID generated by Square Checkout when a new checkout is requested.
92 * @var string
93 */
94 protected $id;
95 /**
96 * $checkout_page_url The URL that the buyer's browser should be redirected to after the checkout is completed.
97 * @var string
98 */
99 protected $checkout_page_url;
100 /**
101 * $ask_for_shipping_address If `true`, Square Checkout will collect shipping information on your behalf and store that information with the transaction information in your Square Dashboard. Default: `false`.
102 * @var bool
103 */
104 protected $ask_for_shipping_address;
105 /**
106 * $merchant_support_email The email address to display on the Square Checkout confirmation page and confirmation email that the buyer can use to contact the merchant. If this value is not set, the confirmation page and email will display the primary email address associated with the merchant's Square account. Default: none; only exists if explicitly set.
107 * @var string
108 */
109 protected $merchant_support_email;
110 /**
111 * $pre_populate_buyer_email If provided, the buyer's email is pre-populated on the checkout page as an editable text field. Default: none; only exists if explicitly set.
112 * @var string
113 */
114 protected $pre_populate_buyer_email;
115 /**
116 * $pre_populate_shipping_address If provided, the buyer's shipping info is pre-populated on the checkout page as editable text fields. Default: none; only exists if explicitly set.
117 * @var \SquareConnect\Model\Address
118 */
119 protected $pre_populate_shipping_address;
120 /**
121 * $redirect_url The URL to redirect to after checkout is completed with `checkoutId`, Square's `orderId`, `transactionId`, and `referenceId` appended as URL parameters. For example, if the provided redirect_url is `http://www.example.com/order-complete`, a successful transaction redirects the customer to: `http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx` If you do not provide a redirect URL, Square Checkout will display an order confirmation page on your behalf; however Square strongly recommends that you provide a redirect URL so you can verify the transaction results and finalize the order through your existing/normal confirmation workflow.
122 * @var string
123 */
124 protected $redirect_url;
125 /**
126 * $order Order to be checked out.
127 * @var \SquareConnect\Model\Order
128 */
129 protected $order;
130 /**
131 * $created_at The time when the checkout was created, in RFC 3339 format.
132 * @var string
133 */
134 protected $created_at;
135 /**
136 * $additional_recipients Additional recipients (other than the merchant) receiving a portion of this checkout. For example, fees assessed on the purchase by a third party integration.
137 * @var \SquareConnect\Model\AdditionalRecipient[]
138 */
139 protected $additional_recipients;
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["checkout_page_url"])) {
154 $this->checkout_page_url = $data["checkout_page_url"];
155 } else {
156 $this->checkout_page_url = null;
157 }
158 if (isset($data["ask_for_shipping_address"])) {
159 $this->ask_for_shipping_address = $data["ask_for_shipping_address"];
160 } else {
161 $this->ask_for_shipping_address = null;
162 }
163 if (isset($data["merchant_support_email"])) {
164 $this->merchant_support_email = $data["merchant_support_email"];
165 } else {
166 $this->merchant_support_email = null;
167 }
168 if (isset($data["pre_populate_buyer_email"])) {
169 $this->pre_populate_buyer_email = $data["pre_populate_buyer_email"];
170 } else {
171 $this->pre_populate_buyer_email = null;
172 }
173 if (isset($data["pre_populate_shipping_address"])) {
174 $this->pre_populate_shipping_address = $data["pre_populate_shipping_address"];
175 } else {
176 $this->pre_populate_shipping_address = null;
177 }
178 if (isset($data["redirect_url"])) {
179 $this->redirect_url = $data["redirect_url"];
180 } else {
181 $this->redirect_url = null;
182 }
183 if (isset($data["order"])) {
184 $this->order = $data["order"];
185 } else {
186 $this->order = null;
187 }
188 if (isset($data["created_at"])) {
189 $this->created_at = $data["created_at"];
190 } else {
191 $this->created_at = null;
192 }
193 if (isset($data["additional_recipients"])) {
194 $this->additional_recipients = $data["additional_recipients"];
195 } else {
196 $this->additional_recipients = 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 ID generated by Square Checkout when a new checkout is requested.
212 * @return $this
213 */
214 public function setId($id)
215 {
216 $this->id = $id;
217 return $this;
218 }
219 /**
220 * Gets checkout_page_url
221 * @return string
222 */
223 public function getCheckoutPageUrl()
224 {
225 return $this->checkout_page_url;
226 }
227
228 /**
229 * Sets checkout_page_url
230 * @param string $checkout_page_url The URL that the buyer's browser should be redirected to after the checkout is completed.
231 * @return $this
232 */
233 public function setCheckoutPageUrl($checkout_page_url)
234 {
235 $this->checkout_page_url = $checkout_page_url;
236 return $this;
237 }
238 /**
239 * Gets ask_for_shipping_address
240 * @return bool
241 */
242 public function getAskForShippingAddress()
243 {
244 return $this->ask_for_shipping_address;
245 }
246
247 /**
248 * Sets ask_for_shipping_address
249 * @param bool $ask_for_shipping_address If `true`, Square Checkout will collect shipping information on your behalf and store that information with the transaction information in your Square Dashboard. Default: `false`.
250 * @return $this
251 */
252 public function setAskForShippingAddress($ask_for_shipping_address)
253 {
254 $this->ask_for_shipping_address = $ask_for_shipping_address;
255 return $this;
256 }
257 /**
258 * Gets merchant_support_email
259 * @return string
260 */
261 public function getMerchantSupportEmail()
262 {
263 return $this->merchant_support_email;
264 }
265
266 /**
267 * Sets merchant_support_email
268 * @param string $merchant_support_email The email address to display on the Square Checkout confirmation page and confirmation email that the buyer can use to contact the merchant. If this value is not set, the confirmation page and email will display the primary email address associated with the merchant's Square account. Default: none; only exists if explicitly set.
269 * @return $this
270 */
271 public function setMerchantSupportEmail($merchant_support_email)
272 {
273 $this->merchant_support_email = $merchant_support_email;
274 return $this;
275 }
276 /**
277 * Gets pre_populate_buyer_email
278 * @return string
279 */
280 public function getPrePopulateBuyerEmail()
281 {
282 return $this->pre_populate_buyer_email;
283 }
284
285 /**
286 * Sets pre_populate_buyer_email
287 * @param string $pre_populate_buyer_email If provided, the buyer's email is pre-populated on the checkout page as an editable text field. Default: none; only exists if explicitly set.
288 * @return $this
289 */
290 public function setPrePopulateBuyerEmail($pre_populate_buyer_email)
291 {
292 $this->pre_populate_buyer_email = $pre_populate_buyer_email;
293 return $this;
294 }
295 /**
296 * Gets pre_populate_shipping_address
297 * @return \SquareConnect\Model\Address
298 */
299 public function getPrePopulateShippingAddress()
300 {
301 return $this->pre_populate_shipping_address;
302 }
303
304 /**
305 * Sets pre_populate_shipping_address
306 * @param \SquareConnect\Model\Address $pre_populate_shipping_address If provided, the buyer's shipping info is pre-populated on the checkout page as editable text fields. Default: none; only exists if explicitly set.
307 * @return $this
308 */
309 public function setPrePopulateShippingAddress($pre_populate_shipping_address)
310 {
311 $this->pre_populate_shipping_address = $pre_populate_shipping_address;
312 return $this;
313 }
314 /**
315 * Gets redirect_url
316 * @return string
317 */
318 public function getRedirectUrl()
319 {
320 return $this->redirect_url;
321 }
322
323 /**
324 * Sets redirect_url
325 * @param string $redirect_url The URL to redirect to after checkout is completed with `checkoutId`, Square's `orderId`, `transactionId`, and `referenceId` appended as URL parameters. For example, if the provided redirect_url is `http://www.example.com/order-complete`, a successful transaction redirects the customer to: `http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx` If you do not provide a redirect URL, Square Checkout will display an order confirmation page on your behalf; however Square strongly recommends that you provide a redirect URL so you can verify the transaction results and finalize the order through your existing/normal confirmation workflow.
326 * @return $this
327 */
328 public function setRedirectUrl($redirect_url)
329 {
330 $this->redirect_url = $redirect_url;
331 return $this;
332 }
333 /**
334 * Gets order
335 * @return \SquareConnect\Model\Order
336 */
337 public function getOrder()
338 {
339 return $this->order;
340 }
341
342 /**
343 * Sets order
344 * @param \SquareConnect\Model\Order $order Order to be checked out.
345 * @return $this
346 */
347 public function setOrder($order)
348 {
349 $this->order = $order;
350 return $this;
351 }
352 /**
353 * Gets created_at
354 * @return string
355 */
356 public function getCreatedAt()
357 {
358 return $this->created_at;
359 }
360
361 /**
362 * Sets created_at
363 * @param string $created_at The time when the checkout was created, in RFC 3339 format.
364 * @return $this
365 */
366 public function setCreatedAt($created_at)
367 {
368 $this->created_at = $created_at;
369 return $this;
370 }
371 /**
372 * Gets additional_recipients
373 * @return \SquareConnect\Model\AdditionalRecipient[]
374 */
375 public function getAdditionalRecipients()
376 {
377 return $this->additional_recipients;
378 }
379
380 /**
381 * Sets additional_recipients
382 * @param \SquareConnect\Model\AdditionalRecipient[] $additional_recipients Additional recipients (other than the merchant) receiving a portion of this checkout. For example, fees assessed on the purchase by a third party integration.
383 * @return $this
384 */
385 public function setAdditionalRecipients($additional_recipients)
386 {
387 $this->additional_recipients = $additional_recipients;
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