Add place order logic (WIP)

This commit is contained in:
Emili Castells Guasch 2024-05-20 16:37:11 +02:00
parent 4b3cd53f73
commit e93e9db3be
6 changed files with 115 additions and 20 deletions

View file

@ -10,6 +10,7 @@ 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;
@ -90,6 +91,16 @@ 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',