diff --git a/modules/ppcp-blocks/resources/js/Components/CardFields.js b/modules/ppcp-blocks/resources/js/Components/CardFields.js index ad724eb42..85c8ce139 100644 --- a/modules/ppcp-blocks/resources/js/Components/CardFields.js +++ b/modules/ppcp-blocks/resources/js/Components/CardFields.js @@ -78,17 +78,9 @@ export function CardFields({config, eventRegistration, emitResponse}) { // TODO temporary workaround to wait for PayPal order in the session await wait(3000) - const response = await fetch(config.scriptData.ajax.get_paypal_order_from_session.endpoint) - const result = await response.json() - return { type: responseTypes.SUCCESS, - meta: { - paymentMethodData: { - 'paypal_order_id': result.data, - }, - }, - }; + } } return handlePaymentProcessing(); diff --git a/modules/ppcp-blocks/src/BlocksModule.php b/modules/ppcp-blocks/src/BlocksModule.php index 765af5698..1dd1560dd 100644 --- a/modules/ppcp-blocks/src/BlocksModule.php +++ b/modules/ppcp-blocks/src/BlocksModule.php @@ -10,7 +10,6 @@ declare(strict_types=1); namespace WooCommerce\PayPalCommerce\Blocks; use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry; -use WooCommerce\PayPalCommerce\Blocks\Endpoint\GetPayPalOrderFromSession; use WooCommerce\PayPalCommerce\Blocks\Endpoint\UpdateShippingEndpoint; use WooCommerce\PayPalCommerce\Button\Assets\SmartButtonInterface; use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider; @@ -91,16 +90,6 @@ class BlocksModule implements ModuleInterface { } ); - add_action( - 'wc_ajax_' . GetPayPalOrderFromSession::ENDPOINT, - static function () use ( $c ) { - $endpoint = $c->get( 'blocks.endpoint.get-paypal-order-from-session' ); - assert( $endpoint instanceof GetPayPalOrderFromSession ); - - $endpoint->handle_request(); - } - ); - // Enqueue frontend scripts. add_action( 'wp_enqueue_scripts', diff --git a/modules/ppcp-blocks/src/Endpoint/GetPayPalOrderFromSession.php b/modules/ppcp-blocks/src/Endpoint/GetPayPalOrderFromSession.php deleted file mode 100644 index d343a846d..000000000 --- a/modules/ppcp-blocks/src/Endpoint/GetPayPalOrderFromSession.php +++ /dev/null @@ -1,43 +0,0 @@ -session_handler = $session_handler; - } - - public static function nonce(): string - { - return self::ENDPOINT; - } - - public function handle_request(): bool - { - $order = $this->session_handler->order(); - - wp_send_json_success($order->id()); - return true; - } -} diff --git a/modules/ppcp-button/src/Assets/SmartButton.php b/modules/ppcp-button/src/Assets/SmartButton.php index 39b6f61cb..e3fa8c4ba 100644 --- a/modules/ppcp-button/src/Assets/SmartButton.php +++ b/modules/ppcp-button/src/Assets/SmartButton.php @@ -19,7 +19,6 @@ use WooCommerce\PayPalCommerce\ApiClient\Entity\Money; use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentToken; use WooCommerce\PayPalCommerce\ApiClient\Factory\PayerFactory; use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies; -use WooCommerce\PayPalCommerce\Blocks\Endpoint\GetPayPalOrderFromSession; use WooCommerce\PayPalCommerce\Blocks\Endpoint\UpdateShippingEndpoint; use WooCommerce\PayPalCommerce\Button\Endpoint\ApproveOrderEndpoint; use WooCommerce\PayPalCommerce\Button\Endpoint\ApproveSubscriptionEndpoint; @@ -1160,10 +1159,6 @@ document.querySelector("#payment").before(document.querySelector(".ppcp-messages 'wp_rest_nonce' => wp_create_nonce( 'wc_store_api' ), 'update_shipping_method' => \WC_AJAX::get_endpoint( 'update_shipping_method' ), ), - 'get_paypal_order_from_session' => array( - 'endpoint' => \WC_AJAX::get_endpoint( GetPayPalOrderFromSession::ENDPOINT ), - 'nonce' => wp_create_nonce( GetPayPalOrderFromSession::nonce() ), - ), ), 'cart_contains_subscription' => $this->subscription_helper->cart_contains_subscription(), 'subscription_plan_id' => $this->subscription_helper->paypal_subscription_id(),