Пример #1
0
 public function init_dashboard()
 {
     try {
         $balance = Omise::get_balance($this->private_key);
         if ($balance->object == 'balance') {
             $balance->formatted_total = wc_price($balance->total / 100);
             $balance->formatted_available = wc_price($balance->available / 100);
             $viewData['balance'] = $balance;
             $this->extract_result_message($viewData);
             $viewData["current_account_mode"] = $this->test_mode ? "TEST" : "LIVE";
             Omise_Util::render_view('includes/templates/omise-wp-admin-page.php', $viewData);
             $this->register_dashboard_script();
         } else {
             echo "<div class='wrap'><div class='error'>Unable to get the balance information. Please verify that your private key is valid. [" . esc_html($balance->message) . "]</div></div>";
         }
     } catch (Exception $e) {
         echo "<div class='wrap'><div class='error'>" . esc_html($e->getMessage()) . "</div></div>";
     }
 }