← All changes
|
src/Framework/PaymentGateways/Webhooks/EventHandlers/Actions/UpdateSubscriptionStatus.php
+11
-0
4.15.1
→
4.17.0
View file →
| @@ -4,8 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | use Exception; |
| 6 | 6 | use Give\Framework\PaymentGateways\Log\PaymentGatewayLog; |
| 7 | 7 | use Give\Subscriptions\Models\Subscription; |
| 8 | +use Give\Subscriptions\Models\SubscriptionNote; | |
| 8 | 9 | use Give\Subscriptions\ValueObjects\SubscriptionStatus; |
| 9 | 10 | |
| 10 | 11 | /** |
| 11 | 12 | * @since 3.6.0 |
| @@ -12,8 +13,9 @@ | ||
| 12 | 13 | */ |
| 13 | 14 | class UpdateSubscriptionStatus |
| 14 | 15 | { |
| 15 | 16 | /** |
| 17 | + * @since 4.16.0 Add note to subscription | |
| 16 | 18 | * @since 3.6.0 |
| 17 | 19 | * |
| 18 | 20 | * @throws Exception |
| 19 | 21 | */ |
| @@ -27,8 +29,17 @@ | ||
| 27 | 29 | |
| 28 | 30 | if (empty($message)) { |
| 29 | 31 | $message = $this->getMessageFromStatus($status); |
| 30 | 32 | } |
| 33 | + | |
| 34 | + SubscriptionNote::create([ | |
| 35 | + 'subscriptionId' => $subscription->id, | |
| 36 | + 'content' => $message . ' ' . sprintf( | |
| 37 | + __('%s subscription ID: %s', 'give'), | |
| 38 | + $subscription->initialDonation()->gateway()->getName(), | |
| 39 | + $subscription->gatewaySubscriptionId | |
| 40 | + ), | |
| 41 | + ]); | |
| 31 | 42 | |
| 32 | 43 | PaymentGatewayLog::info( |
| 33 | 44 | $message . ' ' . sprintf('Subscription ID: %s.', $subscription->id), |
| 34 | 45 | [ |