Add gateway icon, title and description

This commit is contained in:
Emili Castells Guasch 2024-07-22 12:53:41 +02:00
parent e592bbb47b
commit 86e0007ae6
2 changed files with 20 additions and 7 deletions

View file

@ -938,13 +938,14 @@ return array(
esc_html( $button_text )
);
},
'googlepay.wc-gateway' => static function ( ContainerInterface $container ): GooglePayGateway {
'googlepay.wc-gateway' => static function ( ContainerInterface $container ): GooglePayGateway {
return new GooglePayGateway(
$container->get( 'wcgateway.order-processor' ),
$container->get( 'api.factory.paypal-checkout-url' ),
$container->get( 'wcgateway.processor.refunds' ),
$container->get( 'wcgateway.transaction-url-provider' ),
$container->get( 'session.handler' )
$container->get( 'session.handler' ),
$container->get( 'googlepay.url' )
);
},
);

View file

@ -65,6 +65,13 @@ class GooglePayGateway extends WC_Payment_Gateway {
*/
protected $session_handler;
/**
* The URL to the module.
*
* @var string
*/
private $module_url;
/**
* GooglePayGateway constructor.
*
@ -73,21 +80,26 @@ class GooglePayGateway extends WC_Payment_Gateway {
* @param RefundProcessor $refund_processor The Refund Processor.
* @param TransactionUrlProvider $transaction_url_provider Service providing transaction view URL based on order.
* @param SessionHandler $session_handler The Session Handler.
* @param string $module_url The URL to the module.
*/
public function __construct(
OrderProcessor $order_processor,
callable $paypal_checkout_url_factory,
RefundProcessor $refund_processor,
TransactionUrlProvider $transaction_url_provider,
SessionHandler $session_handler
SessionHandler $session_handler,
string $module_url
) {
$this->id = self::ID;
$this->method_title = __( 'Google Pay', 'woocommerce-paypal-payments' );
$this->method_description = __( 'Google Pay', 'woocommerce-paypal-payments' );
$this->method_title = __( 'Google Pay (via PayPal) ', 'woocommerce-paypal-payments' );
$this->method_description = __( 'The separate payment gateway with the Google Pay button. If disabled, the button is included in the PayPal gateway.', 'woocommerce-paypal-payments' );
$this->title = $this->get_option( 'title', $this->method_title );
$this->description = $this->get_option( 'description', $this->method_description );
$this->title = $this->get_option( 'title', __( 'Google Pay', 'woocommerce-paypal-payments' ) );
$this->description = $this->get_option( 'description', '' );
$this->module_url = $module_url;
$this->icon = esc_url( $this->module_url ) . 'assets/images/googlepay.png';
$this->init_form_fields();
$this->init_settings();