Drop refund handling, finalize captures via webhook, add profanity filter
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
35f5d1acfb
commit
2e3abf33d9
11 files changed
+420
-82
No files matched your search
@@ -160,13 +160,13 @@ final class PayPalClientTest extends TestCase {
|
||||
$this->assertFalse( $c->verifyWebhook( $headers, $raw, 'WHID' ) );
|
||||
}
|
||||
|
||||
public function test_create_webhook_registers_three_events(): void {
|
||||
public function test_create_webhook_registers_only_completed_event(): void {
|
||||
$c = $this->client();
|
||||
$this->http->queue = array( $this->token(), FakeTransport::json( 201, array( 'id' => 'WH77' ) ) );
|
||||
$this->assertSame( 'WH77', $c->createWebhook( 'https://x.test/wp-json/streamgoals/v1/webhook' ) );
|
||||
$body = json_decode( $this->http->calls[1]['body'], true );
|
||||
$names = array_column( $body['event_types'], 'name' );
|
||||
$this->assertSame( array( 'PAYMENT.CAPTURE.COMPLETED', 'PAYMENT.CAPTURE.REFUNDED', 'PAYMENT.CAPTURE.REVERSED' ), $names );
|
||||
$this->assertSame( array( 'PAYMENT.CAPTURE.COMPLETED' ), $names );
|
||||
}
|
||||
|
||||
public function test_test_connection_messages(): void {
|
||||
@@ -197,15 +197,5 @@ final class PayPalClientTest extends TestCase {
|
||||
$this->assertSame( '7', $done->customId );
|
||||
$this->assertSame( 'ORD', $done->orderId );
|
||||
$this->assertSame( 500, $done->amount->minor );
|
||||
|
||||
$ref = WebhookEvent::fromArray( array(
|
||||
'id' => 'E2', 'event_type' => 'PAYMENT.CAPTURE.REFUNDED',
|
||||
'resource' => array( 'id' => 'REF1', 'links' => array(
|
||||
array( 'rel' => 'self', 'href' => 'https://api/v2/payments/refunds/REF1' ),
|
||||
array( 'rel' => 'up', 'href' => 'https://api/v2/payments/captures/CAP1' ),
|
||||
) ),
|
||||
) );
|
||||
$this->assertSame( 'CAP1', $ref->captureId );
|
||||
$this->assertNull( $ref->amount );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user