son = json_decode( $response['body'] ); $status_code = (int) wp_remote_retrieve_response_code( $response ); if ( 200 !== $status_code ) { throw new PayPalApiException( $json, $status_code ); } return $this->plan_factory->from_paypal_response( $json ); } /** * Updates pricing. * * @param string $id Plan ID. * @param BillingCycle $billing_cycle Billing cycle. * * @return void * * @throws RuntimeException If the request fails. * @throws PayPalApiException If the request fails. */ public function update_pricing( string $id, BillingCycle $billing_cycle ): void { $data = array( 'pricing_schemes' => array( (object) array( 'billing_cycle_sequence' => 1, 'pricing_scheme' => $billing_cycle->pricing_scheme(), ), ), ); $bearer = $this->bearer->bearer(); $url = trailingslashit( $this->host ) . 'v1/billing/plans/' . $id . '/update-pricing-schemes'; $args = array( 'method' => 'POST', 'headers' => array( 'Authorization' => 'Bearer ' . $bearer->token(), 'Content-Type' => 'application/json', ), 'body' => wp_json_encode( $data ), ); $response = $this->request( $url, $args ); if ( is_wp_error( $response ) || ! is_array( $response ) ) { throw new RuntimeException( 'Could not update pricing.' ); } $json = json_decode( $response['body'] ); $status_code = (int) wp_remote_retrieve_response_code( $response ); if ( 204 !== $status_code ) { throw new PayPalApiException( $json, $status_code ); } } /** * Deactivates a Subscription Plan. * * @param string $billing_plan_id The Plan ID. * * @return void * * @throws RuntimeException If the request fails. * @throws PayPalApiException If the request fails. */ public function deactivate_plan( string $billing_plan_id ) { $bearer = $this->bearer->bearer(); $url = trailingslashit( $this->host ) . 'v1/billing/plans/' . $billing_plan_id . '/deactivate'; $args = array( 'method' => 'POST', 'headers' => array( 'Authorization' => 'Bearer ' . $bearer->token(), 'Content-Type' => 'application/json', ), ); $response = $this->request( $url, $args ); if ( is_wp_error( $response ) || ! is_array( $response ) ) { throw new RuntimeException( 'Could not deactivate plan.' ); } $json = json_decode( $response['body'] ); $status_code = (int) wp_remote_retrieve_response_code( $response ); if ( 204 !== $status_code ) { throw new PayPalApiException( $json, $status_code ); } } }
Fatal error: Uncaught Error: Class "WooCommerce\PayPalCommerce\ApiClient\Endpoint\BillingPlans" not found in /htdocs/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-api-client/services.php:258 Stack trace: #0 /htdocs/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/DelegatingContainer.php(117): WooCommerce\PayPalCommerce\ApiClient\ApiModule::WooCommerce\PayPalCommerce\ApiClient\{closure}(Object(WooCommerce\PayPalCommerce\Vendor\Dhii\Container\DelegatingContainer)) #1 /htdocs/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/DelegatingContainer.php(56): WooCommerce\PayPalCommerce\Vendor\Dhii\Container\DelegatingContainer->invokeFactory(Object(Closure)) #2 /htdocs/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-paypal-subscriptions/services.php(18): WooCommerce\PayPalCommerce\Vendor\Dhii\Container\DelegatingContainer->get('api.endpoint.bi...') #3 /htdocs/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/DelegatingContainer.php(117): WooCommerce\PayPalCommerce\PayPalSubscriptions\PayPalSubscriptionsModule::WooCommerce\PayPalCommerce\PayPalSubscriptions\{closure}(Object(WooCommerce\PayPalCommerce\Vendor\Dhii\Container\DelegatingContainer)) #4 /htdocs/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/DelegatingContainer.php(56): WooCommerce\PayPalCommerce\Vendor\Dhii\Container\DelegatingContainer->invokeFactory(Object(Closure)) #5 /htdocs/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/CompositeContainer.php(53): WooCommerce\PayPalCommerce\Vendor\Dhii\Container\DelegatingContainer->get('paypal-subscrip...') #6 /htdocs/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/CachingContainer.php(61): WooCommerce\PayPalCommerce\Vendor\Dhii\Container\CompositeContainer->get('paypal-subscrip...') #7 /htdocs/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/CachingContainer.php(161): WooCommerce\PayPalCommerce\Vendor\Dhii\Container\CachingContainer->WooCommerce\PayPalCommerce\Vendor\Dhii\Container\{closure}() #8 /htdocs/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/CachingContainer.php(128): WooCommerce\PayPalCommerce\Vendor\Dhii\Container\CachingContainer->invokeGenerator(Object(Closure)) #9 /htdocs/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/CachingContainer.php(62): WooCommerce\PayPalCommerce\Vendor\Dhii\Container\CachingContainer->getCached('paypal-subscrip...', Object(Closure)) #10 /htdocs/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-paypal-subscriptions/src/PayPalSubscriptionsModule.php(557): WooCommerce\PayPalCommerce\Vendor\Dhii\Container\CachingContainer->get('paypal-subscrip...') #11 /htdocs/wp-content/plugins/woocommerce-paypal-payments/bootstrap.php(67): WooCommerce\PayPalCommerce\PayPalSubscriptions\PayPalSubscriptionsModule->run(Object(WooCommerce\PayPalCommerce\Vendor\Dhii\Container\CachingContainer)) #12 /htdocs/wp-content/plugins/woocommerce-paypal-payments/woocommerce-paypal-payments.php(76): {closure}('/htdocs/wp-cont...') #13 /htdocs/wp-content/plugins/woocommerce-paypal-payments/woocommerce-paypal-payments.php(91): WooCommerce\PayPalCommerce\init() #14 /htdocs/wp-includes/class-wp-hook.php(324): WooCommerce\PayPalCommerce\{closure}('') #15 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #16 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #17 /htdocs/wp-settings.php(506): do_action('plugins_loaded') #18 /htdocs/wp-config.php(178): require_once('/htdocs/wp-sett...') #19 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #20 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #21 /htdocs/index.php(17): require('/htdocs/wp-blog...') #22 {main} thrown in /htdocs/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-api-client/services.php on line 258