Handle shipping address/methods update

This commit is contained in:
Alex P 2023-04-27 09:06:38 +03:00
parent f396870610
commit efb86acb1f
No known key found for this signature in database
GPG key ID: 54487A734A204D71
6 changed files with 204 additions and 5 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\UpdateShippingEndpoint;
use WooCommerce\PayPalCommerce\Button\Assets\SmartButton;
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
@ -77,6 +78,16 @@ class BlocksModule implements ModuleInterface {
},
)
);
add_action(
'wc_ajax_' . UpdateShippingEndpoint::ENDPOINT,
static function () use ( $c ) {
$endpoint = $c->get( 'blocks.endpoint.update-shipping' );
assert( $endpoint instanceof UpdateShippingEndpoint );
$endpoint->handle_request();
}
);
}
/**