paddle-logging verbessert
This commit is contained in:
@@ -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']);
|
||||
|
||||
Reference in New Issue
Block a user