PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
← All changes | src/Donations/DataTransferObjects/DonationQueryData.php +24 -3 2.30.04.16.9 View file →
@@ -14,8 +14,9 @@
14 14
15 15 /**
16 16 * Class DonationData
17 17 *
18 + * @since 3.2.0 added honorific property
18 19 * @since 2.23.0 remove parentId property
19 20 * @since 2.19.6
20 21 */
21 22 final class DonationQueryData
@@ -48,8 +49,12 @@
48 49 * @var string
49 50 */
50 51 public $email;
51 52 /**
53 + * @var string
54 + */
55 + public $phone;
56 + /**
52 57 * @var int
53 58 */
54 59 public $id;
55 60 /**
@@ -119,12 +124,24 @@
119 124 /**
120 125 * @var string|null
121 126 */
122 127 public $comment;
128 + /**
129 + * @var string|null
130 + */
131 + public $honorific;
132 + /**
133 + * @var int
134 + */
135 + public $campaignId;
123 136
124 137 /**
125 138 * Convert data from object to Donation
126 139 *
140 + * @since 4.13.0 prevent fatal error when status is not valid
141 + * @since 4.0.0 Added campaignId property
142 + * @since 3.9.0 Add support for "phone" property
143 + * @since 3.2.0 add fallback for donation mode
127 144 * @since 2.23.0 remove parentId property
128 145 * @since 2.22.0 add support for company field
129 146 * @since 2.20.0 update for new amount property, fee amount recovered, and exchange rate
130 147 * @since 2.19.6
@@ -138,8 +155,9 @@
138 155 $self = new static();
139 156
140 157 $currency = $donationQueryObject->{DonationMetaKeys::CURRENCY()->getKeyAsCamelCase()};
141 158 $feeAmountRecovered = $donationQueryObject->{DonationMetaKeys::FEE_AMOUNT_RECOVERED()->getKeyAsCamelCase()};
159 + $donationMode = $donationQueryObject->{DonationMetaKeys::MODE()->getKeyAsCamelCase()};
142 160
143 161 $self->id = (int)$donationQueryObject->id;
144 162 $self->formId = (int)$donationQueryObject->{DonationMetaKeys::FORM_ID()->getKeyAsCamelCase()};
145 163 $self->formTitle = $donationQueryObject->{DonationMetaKeys::FORM_TITLE()->getKeyAsCamelCase()};
@@ -149,17 +167,19 @@
149 167 );
150 168 $self->feeAmountRecovered = $feeAmountRecovered ? Money::fromDecimal($feeAmountRecovered, $currency) : null;
151 169 $self->exchangeRate = $donationQueryObject->{DonationMetaKeys::EXCHANGE_RATE()->getKeyAsCamelCase()};
152 170 $self->donorId = (int)$donationQueryObject->{DonationMetaKeys::DONOR_ID()->getKeyAsCamelCase()};
171 + $self->honorific = $donationQueryObject->{DonationMetaKeys::HONORIFIC()->getKeyAsCamelCase()};
153 172 $self->firstName = $donationQueryObject->{DonationMetaKeys::FIRST_NAME()->getKeyAsCamelCase()};
154 173 $self->lastName = $donationQueryObject->{DonationMetaKeys::LAST_NAME()->getKeyAsCamelCase()};
155 174 $self->email = $donationQueryObject->{DonationMetaKeys::EMAIL()->getKeyAsCamelCase()};
175 + $self->phone = $donationQueryObject->{DonationMetaKeys::PHONE()->getKeyAsCamelCase()};
156 176 $self->gatewayId = $donationQueryObject->{DonationMetaKeys::GATEWAY()->getKeyAsCamelCase()};
157 177 $self->createdAt = Temporal::toDateTime($donationQueryObject->createdAt);
158 178 $self->updatedAt = Temporal::toDateTime($donationQueryObject->updatedAt);
159 - $self->status = new DonationStatus($donationQueryObject->status);
179 + $self->status = new DonationStatus(DonationStatus::isValid($donationQueryObject->status) ? $donationQueryObject->status : DonationStatus::PENDING);
160 180 $self->subscriptionId = (int)$donationQueryObject->{DonationMetaKeys::SUBSCRIPTION_ID()->getKeyAsCamelCase()};
161 - $self->mode = new DonationMode($donationQueryObject->{DonationMetaKeys::MODE()->getKeyAsCamelCase()});
181 + $self->mode = DonationMode::isValid($donationMode) ? new DonationMode($donationMode) : DonationMode::LIVE();
162 182 $self->billingAddress = BillingAddress::fromArray([
163 183 'country' => $donationQueryObject->{DonationMetaKeys::BILLING_COUNTRY()->getKeyAsCamelCase()},
164 184 'city' => $donationQueryObject->{DonationMetaKeys::BILLING_CITY()->getKeyAsCamelCase()},
165 185 'state' => $donationQueryObject->{DonationMetaKeys::BILLING_STATE()->getKeyAsCamelCase()},
@@ -176,8 +196,9 @@
176 196 $self->company = $donationQueryObject->{DonationMetaKeys::COMPANY()
177 197 ->getKeyAsCamelCase()};
178 198 $self->comment = $donationQueryObject->{DonationMetaKeys::COMMENT()
179 199 ->getKeyAsCamelCase()};
200 + $self->campaignId = (int)$donationQueryObject->{DonationMetaKeys::CAMPAIGN_ID()->getKeyAsCamelCase()};
180 201
181 202 if (!empty($donationQueryObject->{DonationMetaKeys::SUBSCRIPTION_INITIAL_DONATION()->getKeyAsCamelCase()})) {
182 203 $self->type = DonationType::SUBSCRIPTION();
183 204 } elseif ($self->subscriptionId) {
@@ -184,9 +205,9 @@
184 205 $self->type = DonationType::RENEWAL();
185 206 } else {
186 207 $self->type = DonationType::SINGLE();
187 208 }
188 -
209 +
189 210 return $self;
190 211 }
191 212
192 213 /**