Skip to content

Commit a41c756

Browse files
simonhampclaude
andcommitted
Remove Anystack license creation from subscription handler
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5368d22 commit a41c756

File tree

2 files changed

+3
-56
lines changed

2 files changed

+3
-56
lines changed

app/Jobs/HandleCustomerSubscriptionCreatedJob.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public function handle(): void
3939
return;
4040
}
4141

42-
$subscriptionPlan = \App\Enums\Subscription::fromStripeSubscription($stripeSubscription);
4342
$cashierSubscriptionItemId = SubscriptionItem::query()
4443
->where('stripe_id', $stripeSubscription->items->first()->id)
4544
->first()
@@ -82,18 +81,7 @@ public function handle(): void
8281
}
8382
}
8483

85-
// Normal flow - create a new license
86-
$nameParts = explode(' ', $user->name ?? '', 2);
87-
$firstName = $nameParts[0] ?: null;
88-
$lastName = $nameParts[1] ?? null;
89-
90-
dispatch(new CreateAnystackLicenseJob(
91-
$user,
92-
$subscriptionPlan,
93-
$cashierSubscriptionItemId,
94-
$firstName,
95-
$lastName,
96-
));
84+
// License creation via Anystack has been disabled for now.
9785
}
9886

9987
protected function constructStripeSubscription(): ?Subscription

tests/Feature/Jobs/HandleCustomerSubscriptionCreatedJobTest.php

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class HandleCustomerSubscriptionCreatedJobTest extends TestCase
2020
use RefreshDatabase;
2121

2222
/** @test */
23-
public function it_dispatches_the_create_anystack_license_job_with_correct_data()
23+
public function it_does_not_dispatch_create_anystack_license_job()
2424
{
2525
$this->createTestData('John Doe');
2626

@@ -31,48 +31,7 @@ public function it_dispatches_the_create_anystack_license_job_with_correct_data(
3131
$job = new HandleCustomerSubscriptionCreatedJob($webhookCall);
3232
$job->handle();
3333

34-
Bus::assertDispatched(CreateAnystackLicenseJob::class, function (CreateAnystackLicenseJob $job) {
35-
return $job->user instanceof User &&
36-
$job->user->email === 'test@example.com' &&
37-
$job->subscription === Subscription::Max &&
38-
$job->firstName === 'John' &&
39-
$job->lastName === 'Doe';
40-
});
41-
}
42-
43-
/**
44-
* @dataProvider customerNameProvider
45-
*
46-
* @test
47-
*/
48-
public function it_extracts_customer_name_parts_correctly($fullName, $expectedFirstName, $expectedLastName)
49-
{
50-
$this->createTestData($fullName);
51-
52-
$webhookCall = new WebhookHandled($this->getTestWebhookPayload());
53-
54-
Bus::fake();
55-
56-
$job = new HandleCustomerSubscriptionCreatedJob($webhookCall);
57-
$job->handle();
58-
59-
Bus::assertDispatched(CreateAnystackLicenseJob::class, function ($job) use ($expectedFirstName, $expectedLastName) {
60-
return $job->firstName === $expectedFirstName &&
61-
$job->lastName === $expectedLastName;
62-
});
63-
}
64-
65-
/**
66-
* Data provider for customer name tests
67-
*/
68-
public static function customerNameProvider()
69-
{
70-
return [
71-
'Full name' => ['John Doe', 'John', 'Doe'],
72-
'First name only' => ['Jane', 'Jane', null],
73-
'Empty string' => ['', null, null],
74-
'Null value' => [null, null, null],
75-
];
34+
Bus::assertNotDispatched(CreateAnystackLicenseJob::class);
7635
}
7736

7837
/** @test */

0 commit comments

Comments
 (0)