mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add block support in GooglePay
This commit is contained in:
parent
eff390f564
commit
6a205d1413
8 changed files with 232 additions and 19 deletions
|
@ -9,17 +9,19 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\Googlepay;
|
||||
|
||||
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodTypeInterface;
|
||||
use WooCommerce\PayPalCommerce\Button\Assets\ButtonInterface;
|
||||
use WooCommerce\PayPalCommerce\Googlepay\Assets\GooglepayButton;
|
||||
use WooCommerce\PayPalCommerce\Googlepay\Assets\BlocksPaymentMethod;
|
||||
use WooCommerce\PayPalCommerce\Googlepay\Assets\Button;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
|
||||
return array(
|
||||
// TODO.
|
||||
|
||||
'googlepay.button' => static function ( ContainerInterface $container ): ButtonInterface {
|
||||
'googlepay.button' => static function ( ContainerInterface $container ): ButtonInterface {
|
||||
// TODO : check other statuses.
|
||||
|
||||
return new GooglepayButton(
|
||||
return new Button(
|
||||
$container->get( 'googlepay.url' ),
|
||||
$container->get( 'googlepay.sdk_url' ),
|
||||
$container->get( 'ppcp.asset-version' ),
|
||||
|
@ -32,7 +34,17 @@ return array(
|
|||
);
|
||||
},
|
||||
|
||||
'googlepay.url' => static function ( ContainerInterface $container ): string {
|
||||
'googlepay.blocks-payment-method' => static function ( ContainerInterface $container ): PaymentMethodTypeInterface {
|
||||
return new BlocksPaymentMethod(
|
||||
'ppcp-googlepay',
|
||||
$container->get( 'googlepay.url' ),
|
||||
$container->get( 'ppcp.asset-version' ),
|
||||
$container->get( 'googlepay.button' ),
|
||||
$container->get( 'blocks.method' )
|
||||
);
|
||||
},
|
||||
|
||||
'googlepay.url' => static function ( ContainerInterface $container ): string {
|
||||
$path = realpath( __FILE__ );
|
||||
if ( false === $path ) {
|
||||
return '';
|
||||
|
@ -43,7 +55,7 @@ return array(
|
|||
);
|
||||
},
|
||||
|
||||
'googlepay.sdk_url' => static function ( ContainerInterface $container ): string {
|
||||
'googlepay.sdk_url' => static function ( ContainerInterface $container ): string {
|
||||
return 'https://pay.google.com/gp/p/js/pay.js';
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue