feat(subscription): add Stripe action controls

Add subscription action handling and tests for cancel, resume, and refund flows while resolving StripeClient through the container.
This commit is contained in:
Andras Bacsai committed 2026-06-12 15:54:21 +02:00
1 parent 1833ba7ce6
commit 61d2d17f52
17 files changed
+203 -46

No files matched your search

+3 -3
View File
@@ -36,7 +36,7 @@ class StripeProcessJob implements ShouldBeEncrypted, ShouldQueue
$data = data_get($this->event, 'data.object');
switch ($type) {
case 'radar.early_fraud_warning.created':
$stripe = new StripeClient(config('subscription.stripe_api_key'));
$stripe = app(StripeClient::class);
$id = data_get($data, 'id');
$charge = data_get($data, 'charge');
if ($charge) {
@@ -100,7 +100,7 @@ class StripeProcessJob implements ShouldBeEncrypted, ShouldQueue
if ($subscription->stripe_subscription_id) {
try {
$stripe = new StripeClient(config('subscription.stripe_api_key'));
$stripe = app(StripeClient::class);
$stripeSubscription = $stripe->subscriptions->retrieve(
$subscription->stripe_subscription_id
);
@@ -166,7 +166,7 @@ class StripeProcessJob implements ShouldBeEncrypted, ShouldQueue
// Verify payment status with Stripe API before sending failure notification
if ($paymentIntentId) {
try {
$stripe = new StripeClient(config('subscription.stripe_api_key'));
$stripe = app(StripeClient::class);
$paymentIntent = $stripe->paymentIntents->retrieve($paymentIntentId);
if (in_array($paymentIntent->status, ['processing', 'succeeded', 'requires_action', 'requires_confirmation'])) {