Skip to content

Commit

Permalink
Merge pull request #2547 from woocommerce/PCP-3577-fatal-error-in-log…
Browse files Browse the repository at this point in the history
…s-when-we-try-to-pay-with-apple-pay-as-separate-gateway

Fatal error in logs when we try to pay with Apple Pay as separate gateway (3577)
  • Loading branch information
Dinamiko authored Aug 29, 2024
2 parents f751eb2 + 888d912 commit 796ded0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
3 changes: 2 additions & 1 deletion modules/ppcp-applepay/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ static function( ContainerInterface $container ): AppleProductStatus {
$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' )
);
},

Expand Down
13 changes: 12 additions & 1 deletion modules/ppcp-applepay/src/ApplePayGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace WooCommerce\PayPalCommerce\Applepay;

use Exception;
use Psr\Log\LoggerInterface;
use WC_Order;
use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\Session\SessionHandler;
Expand Down Expand Up @@ -72,6 +73,13 @@ class ApplePayGateway extends WC_Payment_Gateway {
*/
private $module_url;

/**
* The logger.
*
* @var LoggerInterface
*/
private $logger;

/**
* ApplePayGateway constructor.
*
Expand All @@ -84,14 +92,16 @@ 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,
callable $paypal_checkout_url_factory,
RefundProcessor $refund_processor,
TransactionUrlProvider $transaction_url_provider,
SessionHandler $session_handler,
string $module_url
string $module_url,
LoggerInterface $logger
) {
$this->id = self::ID;

Expand All @@ -111,6 +121,7 @@ public function __construct(
$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,
Expand Down
3 changes: 2 additions & 1 deletion modules/ppcp-googlepay/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ static function( ContainerInterface $container ): ApmProductStatus {
$container->get( 'wcgateway.processor.refunds' ),
$container->get( 'wcgateway.transaction-url-provider' ),
$container->get( 'session.handler' ),
$container->get( 'googlepay.url' )
$container->get( 'googlepay.url' ),
$container->get( 'woocommerce.logger.woocommerce' )
);
},
);
13 changes: 12 additions & 1 deletion modules/ppcp-googlepay/src/GooglePayGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace WooCommerce\PayPalCommerce\Googlepay;

use Exception;
use Psr\Log\LoggerInterface;
use WC_Order;
use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
Expand Down Expand Up @@ -72,6 +73,13 @@ class GooglePayGateway extends WC_Payment_Gateway {
*/
private $module_url;

/**
* The logger.
*
* @var LoggerInterface
*/
private $logger;

/**
* GooglePayGateway constructor.
*
Expand All @@ -81,14 +89,16 @@ class GooglePayGateway extends WC_Payment_Gateway {
* @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.
* @param LoggerInterface $logger The logger.
*/
public function __construct(
OrderProcessor $order_processor,
callable $paypal_checkout_url_factory,
RefundProcessor $refund_processor,
TransactionUrlProvider $transaction_url_provider,
SessionHandler $session_handler,
string $module_url
string $module_url,
LoggerInterface $logger
) {
$this->id = self::ID;

Expand All @@ -113,6 +123,7 @@ public function __construct(
$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,
Expand Down

0 comments on commit 796ded0

Please sign in to comment.