diff --git a/includes/class-depay-wc-payments-gateway.php b/includes/class-depay-wc-payments-gateway.php index 3157cc0..ff12615 100644 --- a/includes/class-depay-wc-payments-gateway.php +++ b/includes/class-depay-wc-payments-gateway.php @@ -179,7 +179,7 @@ public function get_accept( $order ) { ) ); } - if ( wp_remote_retrieve_response_code( $usd_amount ) === 429 ) { + if ( 429 === wp_remote_retrieve_response_code( $usd_amount ) ) { DePay_WC_Payments::log( 'To many requests! Please upgrade to DePay PRO.' ); throw new Exception( 'To many requests! Please upgrade to DePay PRO.' ); } else if ( is_wp_error($usd_amount) || wp_remote_retrieve_response_code( $usd_amount ) != 200 ) { @@ -202,7 +202,7 @@ public function get_accept( $order ) { } else { $get = wp_remote_get( sprintf( 'https://public.depay.com/currencies/%s', $currency ) ); } - if ( wp_remote_retrieve_response_code( $get ) === 429 ) { + if ( 429 === wp_remote_retrieve_response_code( $get ) ) { DePay_WC_Payments::log( 'To many requests! Please upgrade to DePay PRO.' ); throw new Exception( 'To many requests! Please upgrade to DePay PRO.' ); } else if ( is_wp_error($get) || wp_remote_retrieve_response_code( $get ) != 200 ) { @@ -262,7 +262,7 @@ public function get_accept( $order ) { for ($i = 0; $i < count($responses); $i++) { if ( 0 === $i % 2 ) { // even 0, 2, 4 ... - if ( $responses[$i]->status_code === 429 ) { + if ( 429 === $responses[$i]->status_code ) { DePay_WC_Payments::log( 'To many requests! Please upgrade to DePay PRO.' ); throw new Exception( 'To many requests! Please upgrade to DePay PRO.' ); } else if ( $responses[$i]->success && $responses[$i+1]->success && !empty( $responses[$i]->body ) && !empty( $responses[$i+1]->body ) ) { diff --git a/includes/class-depay-wc-payments-rest.php b/includes/class-depay-wc-payments-rest.php index 4fd008c..6cb2d5e 100644 --- a/includes/class-depay-wc-payments-rest.php +++ b/includes/class-depay-wc-payments-rest.php @@ -161,7 +161,7 @@ public function track_payment( $request ) { } } - if( $api_key ) { + if ( $api_key ) { $get = wp_remote_get( sprintf( 'https://api.depay.com/v2/tokens/decimals/%s/%s', $accepted_payment->blockchain, $accepted_payment->token ), array( @@ -192,7 +192,7 @@ public function track_payment( $request ) { if ( !empty($token) && $token->symbol === $currency ) { $total_in_usd = 0; } else { - if( $api_key ) { + if ( $api_key ) { $get = wp_remote_get( sprintf( 'https://api.depay.com/v2/currencies/%s', $currency ), array( @@ -288,7 +288,7 @@ public function track_payment( $request ) { 'base' => '0x9Db58B260EfAa2d6a94bEb7E219d073dF51cc7Bb' ]; - if( $api_key ) { + if ( $api_key ) { $endpoint = 'https://api.depay.com/v2/payments'; $headers = array( 'x-api-key' => $api_key,