Merge branch 'trunk'

# Conflicts:
#	modules/ppcp-admin-notices/src/AdminNotices.php
#	modules/ppcp-local-alternative-payment-methods/src/LocalAlternativePaymentMethodsModule.php
#	modules/ppcp-paylater-configurator/src/PayLaterConfiguratorModule.php
#	modules/ppcp-wc-gateway/src/WCGatewayModule.php
This commit is contained in:
Philipp Stracker 2024-08-30 15:16:20 +02:00
commit 7509f914ab
No known key found for this signature in database
67 changed files with 3811 additions and 126 deletions

View file

@ -339,6 +339,12 @@ class ApplePayButton {
this.#isInitialized = true;
this.applePayConfig = config;
if ( this.isSeparateGateway ) {
document
.querySelectorAll( '#ppc-button-applepay-container' )
.forEach( ( el ) => el.remove() );
}
if ( ! this.isEligible ) {
this.hide();
} else {

View file

@ -299,14 +299,15 @@ return array(
esc_html( $button_text )
);
},
'applepay.wc-gateway' => static function ( ContainerInterface $container ): ApplePayGateway {
'applepay.wc-gateway' => static function ( ContainerInterface $container ): ApplePayGateway {
return new ApplePayGateway(
$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( 'applepay.url' )
$container->get( 'applepay.url' ),
$container->get( 'woocommerce.logger.woocommerce' )
);
},

View file

@ -10,6 +10,7 @@ declare( strict_types = 1 );
namespace WooCommerce\PayPalCommerce\Applepay;
use Exception;
use Psr\Log\LoggerInterface;
use WC_Order;
use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\Session\SessionHandler;
@ -72,6 +73,13 @@ class ApplePayGateway extends WC_Payment_Gateway {
*/
private $module_url;
/**
* The logger.
*
* @var LoggerInterface
*/
private $logger;
/**
* ApplePayGateway constructor.
*
@ -84,6 +92,7 @@ class ApplePayGateway extends WC_Payment_Gateway {
* view URL based on order.
* @param SessionHandler $session_handler The Session Handler.
* @param string $module_url The URL to the module.
* @param LoggerInterface $logger The logger.
*/
public function __construct(
OrderProcessor $order_processor,
@ -91,7 +100,8 @@ class ApplePayGateway extends WC_Payment_Gateway {
RefundProcessor $refund_processor,
TransactionUrlProvider $transaction_url_provider,
SessionHandler $session_handler,
string $module_url
string $module_url,
LoggerInterface $logger
) {
$this->id = self::ID;
@ -111,6 +121,7 @@ class ApplePayGateway extends WC_Payment_Gateway {
$this->refund_processor = $refund_processor;
$this->transaction_url_provider = $transaction_url_provider;
$this->session_handler = $session_handler;
$this->logger = $logger;
add_action(
'woocommerce_update_options_payment_gateways_' . $this->id,