Skip to content

Commit

Permalink
chore: remove unused code chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Aug 10, 2023
1 parent 88e7cc9 commit da0cd6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
18 changes: 1 addition & 17 deletions plugins/otter-pro/inc/plugins/class-form-emails-storing.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public function init() {
add_action( 'transition_post_status', array( $this, 'apply_hooks_on_draft_transition' ), 10, 3 );
add_action( 'otter_form_update_record_meta_dump', array( $this, 'update_submission_dump_data' ), 10, 2 );
add_action( 'otter_form_automatic_confirmation', array( $this, 'move_old_stripe_draft_sessions_to_unread' ) );
add_filter( 'cron_schedules', array( $this, 'form_confirmation_schedule' ) );
add_action( 'wp', array( $this, 'schedule_automatic_confirmation' ) );
}

Expand Down Expand Up @@ -1313,29 +1312,14 @@ public function move_old_stripe_draft_sessions_to_unread() {
}
}

/**
* Add a new cron schedule for automatic submission confirmation.
*
* @param array $schedules The schedules.
* @return array
*/
public function form_confirmation_schedule( $schedules ) {
$schedules['otter_every_hour'] = array(
'interval' => HOUR_IN_SECONDS,
'display' => esc_html__( 'Every hour', 'otter-blocks' ),
);

return $schedules;
}

/**
* Schedule the automatic confirmation.
*
* @return void
*/
public function schedule_automatic_confirmation() {
if ( ! wp_next_scheduled( 'otter_form_confirmation' ) ) {
wp_schedule_event( time(), 'otter_every_hour', 'otter_form_automatic_confirmation' );
wp_schedule_event( time(), 'hourly', 'otter_form_automatic_confirmation' );
}
}

Expand Down
7 changes: 2 additions & 5 deletions plugins/otter-pro/inc/plugins/class-form-pro-features.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
use ThemeIsle\GutenbergBlocks\Integration\Form_Data_Request;
use ThemeIsle\GutenbergBlocks\Integration\Form_Data_Response;
use ThemeIsle\GutenbergBlocks\Plugins\Stripe_API;
use ThemeIsle\GutenbergBlocks\Server\Form_Server;
use WP_Error;
use WP_HTTP_Response;
use WP_REST_Response;

/**
* Class Form_Pro_Features
Expand Down Expand Up @@ -619,6 +615,8 @@ public function create_stripe_session( $form_data ) {
$payload['success_url'] = $permalink;
$payload['cancel_url'] = $permalink;

// For @HardeepAsrani: by pre-filling the customer email, it will appear in the Stripe Checkout page without the possibility to change it. You can try it first then we can remove it if you want.
// TODO: remove the above message after Code Review.
$customer_email = $form_data->get_first_email_from_input_fields();
if ( ! empty( $customer_email ) ) {
$payload['customer_email'] = $customer_email;
Expand All @@ -636,7 +634,6 @@ public function create_stripe_session( $form_data ) {


// Create the metadata array for the Stripe session request.
// TODO: Save also the record ID.
$raw_metadata = $this->prepare_webhook_payload( array(), $form_data, null );
$metadata = array();
foreach ( $raw_metadata as $key => $value ) {
Expand Down

0 comments on commit da0cd6d

Please sign in to comment.