private function verify()
 {
     if (!wskl_is_option_enabled('enable_sym_pg')) {
         return TRUE;
     }
     if (!is_null($this->verified) && is_bool($this->verified)) {
         return $this->verified;
     }
     $info = new WSKL_Auth_Info('payment');
     $key_type = $info->get_key_type();
     $key_value = $info->get_key_value();
     $site_url = site_url();
     // verification null 은 인증 실패. false 는 인증 서버 다운 등의 이유로 인증 시도가 이뤄지지 못함.
     $verification = ClientAPI::verify($key_type, $key_value, $site_url);
     if ($verification instanceof OrderItemRelation) {
         $info->set_oir($verification);
         $info->save();
         $this->verified = TRUE;
     } else {
         if ($verification === NULL) {
             // 인증 실패
             $this->verified = FALSE;
         } else {
             if ($verification === FALSE) {
                 // 인증 불가 (서버의 이상)
                 $this->verified = $info->is_verified();
             }
         }
     }
     return $this->verified;
 }
 private function send_sales_log($order_id)
 {
     $auth = new \WSKL_Auth_Info('marketing');
     if ($auth->is_verified()) {
         $key_type = $auth->get_key_type();
         $key_value = $auth->get_key_value();
         $user_id = $auth->get_oir()->get_user_id();
         $site_url = site_url();
         SalesAPI::send_data($key_type, $key_value, $site_url, $user_id, $order_id);
     }
 }
 public static function callback_woocommerce_before_single_product()
 {
     $auth = new \WSKL_Auth_Info('marketing');
     if ($auth->is_verified()) {
         $key_type = $auth->get_key_type();
         $key_value = $auth->get_key_value();
         $user_id = $auth->get_oir()->get_user_id();
         $site_url = site_url();
         $product_id = get_the_ID();
         TodaySeenAPI::send_data($key_type, $key_value, $site_url, $user_id, $product_id, 0, 0);
     }
 }
 public static function callback_save_post($post_id, \WP_Post $post, $update)
 {
     if (!$update || defined('DOING_AJAX') || defined('DOING_AUTOSAVE')) {
         return;
     }
     $is_export_allowed = filter_var($_POST['dabory-post-export'], FILTER_VALIDATE_BOOLEAN);
     if (!$is_export_allowed) {
         return;
     }
     $auth = new \WSKL_Auth_Info('marketing');
     if ($auth->is_verified()) {
         $key_type = $auth->get_key_type();
         $key_value = $auth->get_key_value();
         $user_id = $auth->get_oir()->get_user_id();
         $site_url = site_url();
         PostAPI::send_post($key_type, $key_value, $site_url, $user_id, $post_id);
         update_post_meta($post_id, LAST_POST_EXPORT, time());
     }
 }
 public static function callback_save_post($post_id, \WP_Post $post, $update)
 {
     if (!$update || defined('DOING_AJAX') || defined('DOING_AUTOSAVE')) {
         return;
     }
     $is_export_allowed = filter_var(wskl_POST('allow-export'), FILTER_VALIDATE_BOOLEAN);
     if (!$is_export_allowed) {
         return;
     }
     $auth = new WSKL_Auth_Info('marketing');
     if ($auth->is_verified()) {
         $key_type = $auth->get_key_type();
         $key_value = $auth->get_key_value();
         $user_id = $auth->get_oir()->get_user_id();
         $site_url = site_url();
         $remote_post_id = PostAPI::send_post($key_type, $key_value, $site_url, $user_id, $post_id);
         if ($remote_post_id) {
             $metadata = array('post_modified' => $post->post_modified, 'post_modified_gmt' => $post->post_modified_gmt, 'exported' => time(), 'remote_post_id' => $remote_post_id);
             update_post_meta($post_id, wskl_get_option_name('post_export_metadata'), $metadata);
         } else {
             error_log('callback_save_post() finished unsuccessfully!');
         }
     }
 }