/**
  * WC_Square_Sync_To_Square_WordPress_Hooks constructor.
  *
  * @param WC_Integration           $integration
  * @param WC_Square_Sync_To_Square $square
  */
 public function __construct(WC_Integration $integration, WC_Square_Sync_To_Square $square)
 {
     $this->integration = $integration;
     $this->square = $square;
     $this->sync_products = 'yes' === $integration->get_option('sync_products');
     $this->sync_categories = 'yes' === $integration->get_option('sync_categories');
     $this->sync_images = 'yes' === $integration->get_option('sync_images');
     $this->sync_inventory = 'yes' === $integration->get_option('sync_inventory');
     add_action('wc_square_loaded', array($this, 'attach_hooks'));
     add_action('wc_square_save_post_event', array($this, 'process_save_post_event'), 10, 2);
 }
 public function init()
 {
     $this->integration = new WC_Square_Integration();
     $square_client = new WC_Square_Client();
     $access_token = get_option('woocommerce_square_merchant_access_token');
     $square_client->set_access_token($access_token);
     $square_client->set_merchant_id($this->integration->get_option('location'));
     $this->square_client = $square_client;
     $this->square_connect = new WC_Square_Connect($square_client);
     $wc_to_square_sync = new WC_Square_Sync_To_Square($this->square_connect);
     $square_to_wc_sync = new WC_Square_Sync_From_Square($this->square_connect);
     $inventory_poll = new WC_Square_Inventory_Poll($this->integration, $square_to_wc_sync);
     if (is_admin()) {
         $bulk_handler = new WC_Square_Bulk_Sync_Handler($this->square_connect, $wc_to_square_sync, $square_to_wc_sync);
     }
     $this->wc_to_square_wp_hooks = new WC_Square_Sync_To_Square_WordPress_Hooks($this->integration, $wc_to_square_sync);
 }