mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
Log order data on order does not contain intent error
This commit is contained in:
parent
5a0b0b41a9
commit
08a2b15fcb
2 changed files with 16 additions and 2 deletions
|
@ -361,12 +361,14 @@ return array(
|
|||
$application_context_repository = $container->get( 'api.repository.application-context' );
|
||||
$application_context_factory = $container->get( 'api.factory.application-context' );
|
||||
$payment_source_factory = $container->get( 'api.factory.payment-source' );
|
||||
$logger = $container->get( 'woocommerce.logger.woocommerce' );
|
||||
return new OrderFactory(
|
||||
$purchase_unit_factory,
|
||||
$payer_factory,
|
||||
$application_context_repository,
|
||||
$application_context_factory,
|
||||
$payment_source_factory
|
||||
$payment_source_factory,
|
||||
$logger
|
||||
);
|
||||
},
|
||||
'api.factory.payments' => static function ( ContainerInterface $container ): PaymentsFactory {
|
||||
|
|
|
@ -9,6 +9,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
|
||||
|
@ -55,6 +56,13 @@ class OrderFactory {
|
|||
*/
|
||||
private $payment_source_factory;
|
||||
|
||||
/**
|
||||
* The logger.
|
||||
*
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
private LoggerInterface $logger;
|
||||
|
||||
/**
|
||||
* OrderFactory constructor.
|
||||
*
|
||||
|
@ -63,13 +71,15 @@ class OrderFactory {
|
|||
* @param ApplicationContextRepository $application_context_repository The Application Context repository.
|
||||
* @param ApplicationContextFactory $application_context_factory The Application Context factory.
|
||||
* @param PaymentSourceFactory $payment_source_factory The Payment Source factory.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
*/
|
||||
public function __construct(
|
||||
PurchaseUnitFactory $purchase_unit_factory,
|
||||
PayerFactory $payer_factory,
|
||||
ApplicationContextRepository $application_context_repository,
|
||||
ApplicationContextFactory $application_context_factory,
|
||||
PaymentSourceFactory $payment_source_factory
|
||||
PaymentSourceFactory $payment_source_factory,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
|
||||
$this->purchase_unit_factory = $purchase_unit_factory;
|
||||
|
@ -77,6 +87,7 @@ class OrderFactory {
|
|||
$this->application_context_repository = $application_context_repository;
|
||||
$this->application_context_factory = $application_context_factory;
|
||||
$this->payment_source_factory = $payment_source_factory;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,6 +139,7 @@ class OrderFactory {
|
|||
);
|
||||
}
|
||||
if ( ! isset( $order_data->intent ) ) {
|
||||
$this->logger->info(wc_print_r($order_data, true));
|
||||
throw new RuntimeException(
|
||||
__( 'Order does not contain intent.', 'woocommerce-paypal-payments' )
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue