@@ -113,9 +113,7 @@ public function create( Webhook $hook ): Webhook {
113113 $ response = $ this ->request ( $ url , $ args );
114114
115115 if ( is_wp_error ( $ response ) ) {
116- throw new RuntimeException (
117- __ ( 'Not able to create a webhook. ' , 'woocommerce-paypal-payments ' )
118- );
116+ throw new RuntimeException ( 'Not able to create a webhook. ' );
119117 }
120118
121119 $ json = json_decode ( $ response ['body ' ] );
@@ -151,9 +149,7 @@ public function list(): array {
151149 $ response = $ this ->request ( $ url , $ args );
152150
153151 if ( is_wp_error ( $ response ) ) {
154- throw new RuntimeException (
155- __ ( 'Not able to load webhooks list. ' , 'woocommerce-paypal-payments ' )
156- );
152+ throw new RuntimeException ( 'Not able to load webhooks list. ' );
157153 }
158154
159155 $ json = json_decode ( $ response ['body ' ] );
@@ -195,9 +191,7 @@ public function delete( Webhook $hook ): void {
195191 $ response = $ this ->request ( $ url , $ args );
196192
197193 if ( $ response instanceof WP_Error ) {
198- throw new RuntimeException (
199- __ ( 'Not able to delete the webhook. ' , 'woocommerce-paypal-payments ' )
200- );
194+ throw new RuntimeException ( 'Not able to delete the webhook. ' );
201195 }
202196
203197 $ status_code = (int ) wp_remote_retrieve_response_code ( $ response );
@@ -250,9 +244,7 @@ public function simulate( Webhook $hook, string $event_type, ?string $resource_v
250244 $ response = $ this ->request ( $ url , $ args );
251245
252246 if ( is_wp_error ( $ response ) ) {
253- throw new RuntimeException (
254- __ ( 'Not able to simulate webhook. ' , 'woocommerce-paypal-payments ' )
255- );
247+ throw new RuntimeException ( 'Not able to simulate webhook. ' );
256248 }
257249 $ json = json_decode ( $ response ['body ' ] );
258250 $ status_code = (int ) wp_remote_retrieve_response_code ( $ response );
@@ -312,9 +304,7 @@ public function verify_event(
312304 );
313305 $ response = $ this ->request ( $ url , $ args );
314306 if ( is_wp_error ( $ response ) ) {
315- $ error = new RuntimeException (
316- __ ( 'Not able to verify webhook event. ' , 'woocommerce-paypal-payments ' )
317- );
307+ $ error = new RuntimeException ( 'Not able to verify webhook event. ' );
318308 $ this ->logger ->log (
319309 'warning ' ,
320310 $ error ->getMessage (),
@@ -340,9 +330,7 @@ public function verify_event(
340330 public function verify_current_request_for_webhook ( Webhook $ webhook ): bool {
341331
342332 if ( ! $ webhook ->id () ) {
343- $ error = new RuntimeException (
344- __ ( 'Not a valid webhook to verify. ' , 'woocommerce-paypal-payments ' )
345- );
333+ $ error = new RuntimeException ( 'Not a valid webhook to verify. ' );
346334 $ this ->logger ->log ( 'warning ' , $ error ->getMessage (), array ( 'webhook ' => $ webhook ) );
347335 throw $ error ;
348336 }
@@ -369,11 +357,7 @@ public function verify_current_request_for_webhook( Webhook $webhook ): bool {
369357
370358 $ error = new RuntimeException (
371359 sprintf (
372- // translators: %s is the headers key.
373- __ (
374- 'Not a valid webhook event. Header %s is missing ' ,
375- 'woocommerce-paypal-payments '
376- ),
360+ 'Not a valid webhook event. Header %s is missing ' ,
377361 $ key
378362 )
379363 );
0 commit comments