2023-08-22 08:44:32 +01:00
|
|
|
<?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.
|
|
|
|
|
2023-08-22 11:34:52 +01:00
|
|
|
'googlepay.button' => static function ( ContainerInterface $container ): ButtonInterface {
|
2023-08-22 08:44:32 +01:00
|
|
|
// TODO : check other statuses.
|
|
|
|
|
|
|
|
return new GooglepayButton(
|
|
|
|
$container->get( 'googlepay.url' ),
|
2023-08-22 11:34:52 +01:00
|
|
|
$container->get( 'googlepay.sdk_url' ),
|
2023-08-22 08:44:32 +01:00
|
|
|
$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' )
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2023-08-22 11:34:52 +01:00
|
|
|
'googlepay.url' => static function ( ContainerInterface $container ): string {
|
2023-08-22 08:44:32 +01:00
|
|
|
$path = realpath( __FILE__ );
|
|
|
|
if ( false === $path ) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
return plugins_url(
|
|
|
|
'/modules/ppcp-googlepay/',
|
|
|
|
dirname( $path, 3 ) . '/woocommerce-paypal-payments.php'
|
|
|
|
);
|
|
|
|
},
|
2023-08-22 11:34:52 +01:00
|
|
|
|
|
|
|
'googlepay.sdk_url' => static function ( ContainerInterface $container ): string {
|
2023-08-22 08:44:32 +01:00
|
|
|
return 'https://pay.google.com/gp/p/js/pay.js';
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|