payment_method_service->get_scheduled_action_hook(), [ $this, 'run_process_scheduled_save_payment_method' ], 10, 2 ); } /** * Deactivate card on token deletion. * * @param int $token_id * @param WC_Payment_Token $token * @return void */ public function payment_token_deleted( $token_id, $token ): void { // phpcs:ignore Squiz.Commenting.FunctionComment.TypeHintMissing $this->payment_method_service->deactivate_card( $token ); } /** * Add fail notice. * * @return void */ public function add_notice(): void { if ( ! is_add_payment_method_page() ) { return; } $notice_data = ! empty( $_GET[ $this->payment_method_service->get_status_key() ] ) ? $this->payment_method_service->get_notice_data( sanitize_text_field( wp_unslash( $_GET[ $this->payment_method_service->get_status_key() ] ) ) ) : null; // phpcs:ignore WordPress.Security.NonceVerification if ( $notice_data ) { wc_add_notice( $notice_data['message'], $notice_data['type'] ); } } /** * Process scheduled save payment method. * * @param string $webhook_data * @param string $hash * @return void */ public function run_process_scheduled_save_payment_method( string $webhook_data, string $hash ): void { try { $data = $this->incoming_data_handler->get_webhook_data( $webhook_data, $hash ); $this->payment_method_service->process_scheduled_save_payment_method( $data ); } catch ( Exception $exception ) { $this->logger_service->log( 'Scheduled saving payment method failed.', 'error' ); } } }