$dcc_configuration, string $wcgateway_module_url, SessionHandler $session_handler, OrderProcessor $order_processor, array $card_icons, OrderEndpoint $order_endpoint, PurchaseUnitFactory $purchase_unit_factory, ShippingPreferenceFactory $shipping_preference_factory, TransactionUrlProvider $transaction_url_provider, Environment $environment, LoggerInterface $logger ) { $this->id = self::ID; $this->settings_renderer = $settings_renderer; $this->ppcp_settings = $ppcp_settings; $this->dcc_configuration = $dcc_configuration; $this->wcgateway_module_url = $wcgateway_module_url; $this->session_handler = $session_handler; $this->order_processor = $order_processor; $this->card_icons = $card_icons; $this->method_title = __( 'Fastlane Debit & Credit Cards', 'woocommerce-paypal-payments' ); $this->method_description = __( 'Fastlane accelerates the checkout experience for guest shoppers and autofills their details so they can pay in seconds. When enabled, Fastlane is presented as the default payment method for guests.', 'woocommerce-paypal-payments' ); $is_axo_enabled = $this->dcc_configuration->use_fastlane(); $this->update_option( 'enabled', $is_axo_enabled ? 'yes' : 'no' ); $this->title = $this->dcc_configuration->gateway_title( $this->get_option( 'title', $this->method_title ) ); $this->description = __( 'Enter your email address above to continue.', 'woocommerce-paypal-payments' ); $this->init_form_fields(); $this->init_settings(); add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options', ) ); $this->order_endpoint = $order_endpoint; $this->purchase_unit_factory = $purchase_unit_factory; $this->shipping_preference_factory = $shipping_preference_factory; $this->logger = $logger; $this->transaction_url_provider = $transaction_url_provider; $this->environment = $environment; } /** * Initialize the form fields. */ public function init_form_fields() { $this->form_fields = array( 'enabled' => array( 'title' => __( 'Enable/Disable', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'label' => __( 'AXO', 'woocommerce-paypal-payments' ), 'default' => 'no', 'desc_tip' => true, 'description' => __( 'Enable/Disable AXO payment gateway.', 'woocommerce-paypal-payments' ), ), 'ppcp' => array( 'type' => 'ppcp', ), ); } /** * Processes the order. * * @param int $order_id The WC order ID. * * @return array */ public function process_payment( $order_id ) { $wc_order = wc_get_order( $order_id ); if ( ! is_a( $wc_order, WC_Order::class ) ) { return $this->handle_payment_failure( null, new GatewayGenericException( new Exception( 'WC order was not found.' ) ) ); } try { // phpcs:ignore WordPress.Security.NonceVerification.Missing $fastlane_member = wc_clean( wp_unslash( $_POST['fastlane_member'] ?? '' ) ); if ( $fastlane_member ) { $payment_method_title = __( 'Debit & Credit Cards (via Fastlane by PayPal)', 'woocommerce-paypal-payments' ); $wc_order->set_payment_method_title( $payment_method_title ); $wc_order->save(); } // The `axo_nonce` is not a WP nonce, but a card-token generated by the JS SDK. // phpcs:ignore WordPress.Security.NonceVerification.Missing $token = wc_clean( wp_unslash( $_POST['axo_nonce'] ?? '' ) ); $order = $this->create_paypal_order( $wc_order, $token ); $this->order_processor->process_captured_and_authorized( $wc_order, $order ); } catch ( Exception $exception ) { return $this->handle_payment_failure( $wc_order, $exception ); } WC()->cart->empty_cart(); return array( 'result' => 'success', 'redirect' => $this->get_return_url( $wc_order ), ); } /** * Create a new PayPal order from the existing WC_Order instance. * * @param WC_Order $wc_order The WooCommerce order to use as a base. * @param string $payment_token The payment token, generated by the JS SDK. * * @return Order The PayPal order. */ protected function create_paypal_order( WC_Order $wc_order, string $payment_token ) : Order { $purchase_unit = $this->purchase_unit_factory->from_wc_order( $wc_order ); $shipping_preference = $this->shipping_preference_factory->from_state( $purchase_unit, 'checkout' ); $payment_source_properties = (object) array( 'single_use_token' => $payment_token, ); $payment_source = new PaymentSource( 'card', $payment_source_properties ); return $this->order_endpoint->create( array( $purchase_unit ), $shipping_preference, null, null, '', ApplicationContext::USER_ACTION_CONTINUE, '', array(), $payment_source ); } /** * Returns the icons of the gateway. * * @return string */ public function get_icon() { $icon = parent::get_icon(); $icons = $this->card_icons; if ( ! $icons ) { return $icon; } $images = array(); foreach ( $icons as $card ) { $images[] = ' '; } return implode( '', $images ); } /** * 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 ); } /** * Return the gateway's title. * * @return string */ public function get_title() { if ( is_admin() ) { // $theorder and other things for retrieving the order or post info are not available // in the constructor, so must do it here. global $theorder; if ( $theorder instanceof WC_Order ) { if ( $theorder->get_payment_method() === self::ID ) { $payment_method_title = $theorder->get_payment_method_title(); if ( $payment_method_title ) { $this->title = $payment_method_title; } } } } return parent::get_title(); } /** * Returns the settings renderer. * * @return SettingsRenderer */ protected function settings_renderer() : SettingsRenderer { return $this->settings_renderer; } }
Fatal error: Uncaught Error: Class "WooCommerce\PayPalCommerce\Axo\Gateway\AxoGateway" not found in /htdocs/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-axo/services.php:75 Stack trace: #0 /htdocs/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Inpsyde/Modularity/Container/ReadOnlyContainer.php(71): WooCommerce\PayPalCommerce\Axo\AxoModule::WooCommerce\PayPalCommerce\Axo\{closure}(Object(WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Container\ReadOnlyContainer)) #1 /htdocs/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-axo-block/services.php(35): WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Container\ReadOnlyContainer->get('axo.gateway') #2 /htdocs/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Inpsyde/Modularity/Container/ReadOnlyContainer.php(71): WooCommerce\PayPalCommerce\AxoBlock\AxoBlockModule::WooCommerce\PayPalCommerce\AxoBlock\{closure}(Object(WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Container\ReadOnlyContainer)) #3 /htdocs/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-axo-block/src/AxoBlockModule.php(111): WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Container\ReadOnlyContainer->get('axoblock.method') #4 /htdocs/wp-includes/class-wp-hook.php(324): WooCommerce\PayPalCommerce\AxoBlock\AxoBlockModule->WooCommerce\PayPalCommerce\AxoBlock\{closure}(Object(Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry)) #5 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #6 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #7 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Integrations/IntegrationRegistry.php(50): do_action('woocommerce_blo...', Object(Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry)) #8 /htdocs/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Blocks\Integrations\IntegrationRegistry->initialize('') #9 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #10 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #11 /htdocs/wp-settings.php(700): do_action('init') #12 /htdocs/wp-config.php(93): require_once('/htdocs/wp-sett...') #13 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #14 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #15 /htdocs/index.php(17): require('/htdocs/wp-blog...') #16 {main} thrown in /htdocs/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-axo/services.php on line 75