PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
charitable / vendor / square / square / src / Legacy / Models / ApplicationDetails.php

ApplicationDetails.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Legacy/Models/ApplicationDetails.php

119 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Square\Legacy\Models;
6
7 use stdClass;
8
9 /**
10 * Details about the application that took the payment.
11 */
12 class ApplicationDetails implements \JsonSerializable
13 {
14 /**
15 * @var string|null
16 */
17 private $squareProduct;
18
19 /**
20 * @var array
21 */
22 private $applicationId = [];
23
24 /**
25 * Returns Square Product.
26 * A list of products to return to external callers.
27 */
28 public function getSquareProduct(): ?string
29 {
30 return $this->squareProduct;
31 }
32
33 /**
34 * Sets Square Product.
35 * A list of products to return to external callers.
36 *
37 * @maps square_product
38 */
39 public function setSquareProduct(?string $squareProduct): void
40 {
41 $this->squareProduct = $squareProduct;
42 }
43
44 /**
45 * Returns Application Id.
46 * The Square ID assigned to the application used to take the payment.
47 * Application developers can use this information to identify payments that
48 * their application processed.
49 * For example, if a developer uses a custom application to process payments,
50 * this field contains the application ID from the Developer Dashboard.
51 * If a seller uses a [Square App Marketplace](https://developer.squareup.com/docs/app-marketplace)
52 * application to process payments, the field contains the corresponding application ID.
53 */
54 public function getApplicationId(): ?string
55 {
56 if (count($this->applicationId) == 0) {
57 return null;
58 }
59 return $this->applicationId['value'];
60 }
61
62 /**
63 * Sets Application Id.
64 * The Square ID assigned to the application used to take the payment.
65 * Application developers can use this information to identify payments that
66 * their application processed.
67 * For example, if a developer uses a custom application to process payments,
68 * this field contains the application ID from the Developer Dashboard.
69 * If a seller uses a [Square App Marketplace](https://developer.squareup.com/docs/app-marketplace)
70 * application to process payments, the field contains the corresponding application ID.
71 *
72 * @maps application_id
73 */
74 public function setApplicationId(?string $applicationId): void
75 {
76 $this->applicationId['value'] = $applicationId;
77 }
78
79 /**
80 * Unsets Application Id.
81 * The Square ID assigned to the application used to take the payment.
82 * Application developers can use this information to identify payments that
83 * their application processed.
84 * For example, if a developer uses a custom application to process payments,
85 * this field contains the application ID from the Developer Dashboard.
86 * If a seller uses a [Square App Marketplace](https://developer.squareup.com/docs/app-marketplace)
87 * application to process payments, the field contains the corresponding application ID.
88 */
89 public function unsetApplicationId(): void
90 {
91 $this->applicationId = [];
92 }
93
94 /**
95 * Encode this object to JSON
96 *
97 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
98 * are set. (default: false)
99 *
100 * @return array|stdClass
101 */
102 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
103 public function jsonSerialize(bool $asArrayWhenEmpty = false)
104 {
105 $json = [];
106 if (isset($this->squareProduct)) {
107 $json['square_product'] = $this->squareProduct;
108 }
109 if (!empty($this->applicationId)) {
110 $json['application_id'] = $this->applicationId['value'];
111 }
112 $json = array_filter($json, function ($val) {
113 return $val !== null;
114 });
115
116 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
117 }
118 }
119