Add GooglePay module

This commit is contained in:
Pedro Silva 2023-08-22 08:44:32 +01:00
parent 0e97af9122
commit e87ab7362c
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
21 changed files with 3137 additions and 17 deletions

View file

@ -0,0 +1,50 @@
<?php
/**
* The Googlepay module services.
*
* @package WooCommerce\PayPalCommerce\Googlepay
*/
declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\Googlepay;
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
use WooCommerce\PayPalCommerce\Googlepay\Assets\ButtonInterface;
use WooCommerce\PayPalCommerce\Googlepay\Assets\GooglepayButton;
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
return array(
// TODO.
'googlepay.button' => static function ( ContainerInterface $container ): ButtonInterface {
// TODO : check other statuses.
return new GooglepayButton(
$container->get( 'googlepay.url' ),
$container->get( 'googlepay.sdk_script_url' ),
$container->get( 'ppcp.asset-version' ),
$container->get( 'session.handler' ),
$container->get( 'wcgateway.settings' ),
$container->get( 'onboarding.environment' ),
$container->get( 'api.shop.currency' ),
$container->get( 'woocommerce.logger.woocommerce' )
);
},
'googlepay.url' => static function ( ContainerInterface $container ): string {
$path = realpath( __FILE__ );
if ( false === $path ) {
return '';
}
return plugins_url(
'/modules/ppcp-googlepay/',
dirname( $path, 3 ) . '/woocommerce-paypal-payments.php'
);
},
'googlepay.sdk_script_url' => static function ( ContainerInterface $container ): string {
return 'https://pay.google.com/gp/p/js/pay.js';
},
);