public function test_verifyDeactivation()
 {
     // deactivation && verify --> get null
     ClientAPI::activate('payment', $this->paymentApiKey, site_url(), '', FALSE);
     $oir = ClientAPI::verify('payment', $this->paymentApiKey, site_url());
     $this->assertNull($oir);
 }
 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;
 }
 /**
  * @action wp_ajax_activate_action
  */
 public function callback_activation()
 {
     wp_verify_nonce($_POST['activation_nonce'], static::$nonce_action) or die('nonce verification failed.');
     $key_type = sanitize_text_field($_POST['key_type']);
     $key_value = sanitize_text_field($_POST['key_value']);
     $site_url = sanitize_text_field($_POST['site_url']);
     $company_name = get_bloginfo('name');
     $activation = ClientAPI::activate($key_type, $key_value, $site_url, $company_name, TRUE);
     $info_model = new WSKL_Auth_Info($key_type);
     if ($activation instanceof OrderItemRelation) {
         $info_model->set_oir($activation);
         $info_model->save();
         wp_send_json_success();
     } else {
         $info_model->reset();
         wp_send_json_error();
     }
     die;
 }
 public function setUp()
 {
     update_test_cassandra_url();
     $this->oir = ClientAPI::activate('payment', $this->paymentApiKey, site_url(), '', TRUE);
     $this->assertTrue($this->oir instanceof OrderItemRelation);
 }
 public function test_verifyWrongAddress()
 {
     $oir = ClientAPI::verify('payment', $this->paymentApiKey, site_url());
     $this->assertFalse($oir);
 }
 public function setUp()
 {
     update_test_cassandra_url();
     ClientAPI::activate('marketing', $this->marketingApiKey, site_url(), '', TRUE);
     $this->testPost = $this->factory->post->create(array('post_title' => 'POST TITLE', 'post_content' => 'TEST POST', 'post_author' => '1'));
 }