Refactor invoice payment failure handling in webhooks.php
This commit is contained in:
		| @@ -824,8 +824,12 @@ Route::post('/payments/stripe/events', function () { | |||||||
|                 if (!$team) { |                 if (!$team) { | ||||||
|                     throw new Exception('No team found for subscription: ' . $subscription->id); |                     throw new Exception('No team found for subscription: ' . $subscription->id); | ||||||
|                 } |                 } | ||||||
|  |                 if (!$subscription->stripe_invoice_paid) { | ||||||
|                     SubscriptionInvoiceFailedJob::dispatch($team); |                     SubscriptionInvoiceFailedJob::dispatch($team); | ||||||
|                     send_internal_notification('Invoice payment failed: ' . $subscription->team->id); |                     send_internal_notification('Invoice payment failed: ' . $subscription->team->id); | ||||||
|  |                 } else { | ||||||
|  |                     send_internal_notification('Invoice payment failed but already paid: ' . $subscription->team->id); | ||||||
|  |                 } | ||||||
|                 break; |                 break; | ||||||
|             case 'payment_intent.payment_failed': |             case 'payment_intent.payment_failed': | ||||||
|                 $customerId = data_get($data, 'customer'); |                 $customerId = data_get($data, 'customer'); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Andras Bacsai
					Andras Bacsai