verschieben des sofortigen verzichts auf das Widerrrufsrecht zum Anlegen des Events
This commit is contained in:
39
tests/Feature/Api/Tenant/BillingPortalTest.php
Normal file
39
tests/Feature/Api/Tenant/BillingPortalTest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Api\Tenant;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Tests\Feature\Tenant\TenantTestCase;
|
||||
|
||||
class BillingPortalTest extends TenantTestCase
|
||||
{
|
||||
public function test_tenant_can_create_paddle_portal_session(): void
|
||||
{
|
||||
Http::fake([
|
||||
'*paddle.com/customers' => Http::response([
|
||||
'data' => ['id' => 'cus_123'],
|
||||
], 200),
|
||||
'*paddle.com/customer-portal-sessions' => Http::response([
|
||||
'data' => [
|
||||
'urls' => [
|
||||
'general' => [
|
||||
'overview' => 'https://portal.example/overview',
|
||||
],
|
||||
],
|
||||
],
|
||||
], 200),
|
||||
]);
|
||||
|
||||
$this->tenant->forceFill(['paddle_customer_id' => null])->save();
|
||||
|
||||
$response = $this->authenticatedRequest('POST', '/api/v1/tenant/billing/portal');
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJsonPath('url', 'https://portal.example/overview');
|
||||
|
||||
$this->assertDatabaseHas('tenants', [
|
||||
'id' => $this->tenant->id,
|
||||
'paddle_customer_id' => 'cus_123',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user