Replace the static Engine call (which silently failed) with Engine::default() and a MySQL named lock. Add engine->overlay integration test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
28 lines
705 B
PHP
28 lines
705 B
PHP
<?php
|
|
declare( strict_types=1 );
|
|
|
|
namespace StreamGoals\PayPal;
|
|
|
|
/** Production transport backed by wp_remote_request. */
|
|
final class WpTransport implements HttpTransport {
|
|
|
|
public function request( string $method, string $url, array $headers, ?string $body ): array {
|
|
$args = array(
|
|
'method' => $method,
|
|
'headers' => $headers,
|
|
'timeout' => 20,
|
|
);
|
|
if ( null !== $body ) {
|
|
$args['body'] = $body;
|
|
}
|
|
$res = wp_remote_request( $url, $args );
|
|
if ( is_wp_error( $res ) ) {
|
|
throw new TransportException( $res->get_error_message() );
|
|
}
|
|
return array(
|
|
'status' => (int) wp_remote_retrieve_response_code( $res ),
|
|
'body' => (string) wp_remote_retrieve_body( $res ),
|
|
);
|
|
}
|
|
}
|