mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Stop searching for prefix in custom IDs
we are not creating such IDs for 2 years already
This commit is contained in:
parent
eb4418931a
commit
8979c9e605
14 changed files with 26 additions and 104 deletions
|
@ -184,8 +184,7 @@ return array(
|
|||
$state = $container->get( 'onboarding.state' );
|
||||
$order_processor = $container->get( 'wcgateway.order-processor' );
|
||||
$session_handler = $container->get( 'session.handler' );
|
||||
$prefix = $container->get( 'api.prefix' );
|
||||
return new EarlyOrderHandler( $state, $order_processor, $session_handler, $prefix );
|
||||
return new EarlyOrderHandler( $state, $order_processor, $session_handler );
|
||||
},
|
||||
'button.endpoint.approve-order' => static function ( ContainerInterface $container ): ApproveOrderEndpoint {
|
||||
$request_data = $container->get( 'button.request-data' );
|
||||
|
|
|
@ -15,15 +15,12 @@ use WooCommerce\PayPalCommerce\Onboarding\State;
|
|||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Processor\OrderProcessor;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Handler\PrefixTrait;
|
||||
|
||||
/**
|
||||
* Class EarlyOrderHandler
|
||||
*/
|
||||
class EarlyOrderHandler {
|
||||
|
||||
use PrefixTrait;
|
||||
|
||||
/**
|
||||
* The State.
|
||||
*
|
||||
|
@ -51,19 +48,16 @@ class EarlyOrderHandler {
|
|||
* @param State $state The State.
|
||||
* @param OrderProcessor $order_processor The Order Processor.
|
||||
* @param SessionHandler $session_handler The Session Handler.
|
||||
* @param string $prefix The Prefix.
|
||||
*/
|
||||
public function __construct(
|
||||
State $state,
|
||||
OrderProcessor $order_processor,
|
||||
SessionHandler $session_handler,
|
||||
string $prefix
|
||||
SessionHandler $session_handler
|
||||
) {
|
||||
|
||||
$this->state = $state;
|
||||
$this->order_processor = $order_processor;
|
||||
$this->session_handler = $session_handler;
|
||||
$this->prefix = $prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,7 +95,7 @@ class EarlyOrderHandler {
|
|||
$order_id = false;
|
||||
foreach ( $order->purchase_units() as $purchase_unit ) {
|
||||
if ( $purchase_unit->custom_id() === sanitize_text_field( wp_unslash( $_REQUEST['ppcp-resume-order'] ) ) ) {
|
||||
$order_id = (int) $this->sanitize_custom_id( $purchase_unit->custom_id() );
|
||||
$order_id = (int) $purchase_unit->custom_id();
|
||||
}
|
||||
}
|
||||
if ( $order_id === $resume_order_id ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue