PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0.1
GiveWP – Donation Plugin and Fundraising Platform v4.18.0.1
4.18.0.1 4.18.0 4.17.0 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 All 258 releases
← All changes | src/Framework/PaymentGateways/Webhooks/EventHandlers/SubscriptionRenewalDonationCreated.php +19 -1 4.16.2 → 4.18.0.1 View file →
@@ -11,8 +11,9 @@
11 11 */
12 12 class SubscriptionRenewalDonationCreated
13 13 {
14 14 /**
15 + * @since 4.18.0 Bail when the subscription has no initial donation instead of fataling on it.
15 16 * @since 4.0.0 updated to create the renewal from subscription model
16 17 * @since 3.16.0 Add log messages and a defensive approach to prevent duplicated renewals
17 18 * @since 3.6.0
18 19 */
@@ -36,9 +37,26 @@
36 37
37 38 return;
38 39 }
39 40
40 - if ($subscription->initialDonation()->gatewayTransactionId === $gatewayTransactionId) {
41 + $initialDonation = $subscription->initialDonation();
42 +
43 + if ( ! $initialDonation) {
44 + PaymentGatewayLog::error(
45 + sprintf('The renewal was not created for the gateway transaction ID %s because the subscription %s has no initial donation to copy the donor details from.',
46 + $gatewayTransactionId, $subscription->id),
47 + [
48 + 'Gateway Subscription ID' => $gatewaySubscriptionId,
49 + 'Gateway Transaction ID' => $gatewayTransactionId,
50 + 'Message' => $message,
51 + 'Subscription' => $subscription->toArray(),
52 + ]
53 + );
54 +
55 + return;
56 + }
57 +
58 + if ($initialDonation->gatewayTransactionId === $gatewayTransactionId) {
41 59 PaymentGatewayLog::error(
42 60 sprintf('The renewal was not created for the gateway transaction ID %s because the initial donation of the subscription %s is already using the informed gateway transaction ID %s.',
43 61 $gatewayTransactionId, $subscription->id, $gatewaySubscriptionId),
44 62 [