paddle-logging verbessert

This commit is contained in:
Codex Agent
2025-12-23 08:53:00 +01:00
parent aa6f9b35d9
commit 8267b2bca3
6 changed files with 263 additions and 44 deletions

View File

@@ -47,9 +47,11 @@ class PaddleWebhookControllerTest extends TestCase
],
];
$signature = hash_hmac('sha256', json_encode($payload), 'test_secret');
$timestamp = time();
$signature = hash_hmac('sha256', $timestamp.':'.json_encode($payload), 'test_secret');
$header = sprintf('ts=%s,h1=%s', $timestamp, $signature);
$response = $this->withHeader('Paddle-Webhook-Signature', $signature)
$response = $this->withHeader('Paddle-Signature', $header)
->postJson('/paddle/webhook', $payload);
$response->assertOk()->assertJson(['status' => 'processed']);
@@ -108,14 +110,16 @@ class PaddleWebhookControllerTest extends TestCase
],
];
$signature = hash_hmac('sha256', json_encode($payload), 'test_secret');
$timestamp = time();
$signature = hash_hmac('sha256', $timestamp.':'.json_encode($payload), 'test_secret');
$header = sprintf('ts=%s,h1=%s', $timestamp, $signature);
$first = $this->withHeader('Paddle-Webhook-Signature', $signature)
$first = $this->withHeader('Paddle-Signature', $header)
->postJson('/paddle/webhook', $payload);
$first->assertOk()->assertJson(['status' => 'processed']);
$second = $this->withHeader('Paddle-Webhook-Signature', $signature)
$second = $this->withHeader('Paddle-Signature', $header)
->postJson('/paddle/webhook', $payload);
$second->assertStatus(200)->assertJson(['status' => 'processed']);
@@ -168,9 +172,11 @@ class PaddleWebhookControllerTest extends TestCase
],
];
$signature = hash_hmac('sha256', json_encode($payload), 'test_secret');
$timestamp = time();
$signature = hash_hmac('sha256', $timestamp.':'.json_encode($payload), 'test_secret');
$header = sprintf('ts=%s,h1=%s', $timestamp, $signature);
$response = $this->withHeader('Paddle-Webhook-Signature', $signature)
$response = $this->withHeader('Paddle-Signature', $header)
->postJson('/paddle/webhook', $payload);
$response->assertOk()->assertJson(['status' => 'processed']);
@@ -185,7 +191,7 @@ class PaddleWebhookControllerTest extends TestCase
{
config(['paddle.webhook_secret' => 'secret']);
$response = $this->withHeader('Paddle-Webhook-Signature', 'invalid')
$response = $this->withHeader('Paddle-Signature', 'invalid')
->postJson('/paddle/webhook', ['event_type' => 'transaction.completed']);
$response->assertStatus(400)->assertJson(['status' => 'invalid']);