remove redundant parameter

This commit is contained in:
Kirill Braslavsky 2021-03-15 17:57:55 +02:00
parent 824e3a97c8
commit da23be6d4c
2 changed files with 3 additions and 5 deletions

View file

@ -24,7 +24,6 @@ trait ProcessPaymentTrait {
* @return array
*/
public function process_payment( $order_id ) {
global $woocommerce;
$failure_data = array(
'result' => 'failure',
@ -55,7 +54,7 @@ trait ProcessPaymentTrait {
//phpcs:enable WordPress.Security.NonceVerification.Recommended
try {
if ( $this->order_processor->process( $wc_order, $woocommerce ) ) {
if ( $this->order_processor->process( $wc_order ) ) {
$this->session_handler->destroy_session_data();
return array(
'result' => 'success',

View file

@ -146,11 +146,10 @@ class OrderProcessor {
* Processes a given WooCommerce order and captured/authorizes the connected PayPal orders.
*
* @param \WC_Order $wc_order The WooCommerce order.
* @param \WooCommerce $woocommerce The WooCommerce object.
*
* @return bool
*/
public function process( \WC_Order $wc_order, \WooCommerce $woocommerce ): bool {
public function process( \WC_Order $wc_order): bool {
$order = $this->session_handler->order();
if ( ! $order ) {
return false;
@ -212,7 +211,7 @@ class OrderProcessor {
$wc_order->update_meta_data( PayPalGateway::CAPTURED_META_KEY, 'true' );
$wc_order->update_status( 'processing' );
}
$woocommerce->cart->empty_cart();
wc()->cart->empty_cart();
$this->session_handler->destroy_session_data();
$this->last_error = '';
return true;