id ) { $wc_order = wc_get_order( $order_id ); // phpcs:disable WordPress.Security.NonceVerification.Missing $birth_date = wc_clean( wp_unslash( $_POST['billing_birth_date'] ?? '' ) ); // phpcs:disable WordPress.Security.NonceVerification.Recommended $pay_for_order = wc_clean( wp_unslash( $_GET['pay_for_order'] ?? '' ) ); if ( 'true' === $pay_for_order ) { if ( ! $this->checkout_helper->validate_birth_date( $birth_date ) ) { wc_add_notice( 'Invalid birth date.', 'error' ); return array( 'result' => 'failure', ); } } $phone_number = wc_clean( wp_unslash( $_POST['billing_phone'] ?? '' ) ); // phpcs:enable WordPress.Security.NonceVerification.Missing if ( $phone_number ) { $wc_order->set_billing_phone( $phone_number ); $wc_order->save(); } $purchase_unit = $this->purchase_unit_factory->from_wc_order( $wc_order ); $payment_source = $this->payment_source_factory->from_wc_order( $wc_order, $birth_date ); try { $order = $this->order_endpoint->create( array( $purchase_unit ), $payment_source, $wc_order ); $this->add_paypal_meta( $wc_order, $order, $this->environment ); $wc_order->update_status( 'on-hold', __( 'Awaiting Pay upon Invoice payment.', 'woocommerce-paypal-payments' ) ); as_schedule_single_action( time() + ( 5 * MINUTE_IN_SECONDS ), 'woocommerce_paypal_payments_check_pui_payment_captured', array( 'wc_order_id' => $order_id, 'order_id' => $order->id(), ) ); WC()->cart->empty_cart(); return array( 'result' => 'success', 'redirect' => $this->get_return_url( $wc_order ), ); } catch ( RuntimeException $exception ) { $error = $exception->getMessage(); if ( is_a( $exception, PayPalApiException::class ) ) { $error = $exception->get_details( $error ); } $this->logger->error( $error ); wc_add_notice( $error, 'error' ); $wc_order->update_status( 'failed', $error ); return array( 'result' => 'failure', 'redirect' => wc_get_checkout_url(), ); } } /** * Process refund. * * @param int $order_id Order ID. * @param float $amount Refund amount. * @param string $reason Refund reason. * @return boolean True or false based on success, or a WP_Error object. */ public function process_refund( $order_id, $amount = null, $reason = '' ) { $order = wc_get_order( $order_id ); if ( ! is_a( $order, \WC_Order::class ) ) { return false; } return $this->refund_processor->process( $order, (float) $amount, (string) $reason ); } /** * Return transaction url for this gateway and given order. * * @param WC_Order $order WC order to get transaction url by. * * @return string */ public function get_transaction_url( $order ): string { $this->view_transaction_url = $this->transaction_url_provider->get_transaction_url_base( $order ); return parent::get_transaction_url( $order ); } }
Fatal error: Uncaught Error: Class 'WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice\PayUponInvoiceGateway' not found in /home1/tetban11/public_html/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-uninstall/services.php:30 Stack trace: #0 /home1/tetban11/public_html/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/DelegatingContainer.php(117): WooCommerce\PayPalCommerce\Uninstall\UninstallModule->WooCommerce\PayPalCommerce\Uninstall\{closure}(Object(WooCommerce\PayPalCommerce\Vendor\Dhii\Container\DelegatingContainer)) #1 /home1/tetban11/public_html/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/DelegatingContainer.php(56): WooCommerce\PayPalCommerce\Vendor\Dhii\Container\DelegatingContainer->invokeFactory(Object(Closure)) #2 /home1/tetban11/public_html/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Dhii/Container/CompositeContainer.php(53): WooCommerce\PayPalCommerce\Vendor\Dhii\Container\DelegatingContainer->get('uninstall.ppcp-... in /home1/tetban11/public_html/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-uninstall/services.php on line 30