<!doctype html>
<html lang="en">
<?php 
use App\Libraries\WalletCoreAPI;
$validation =  \Config\Services::validation();
use App\Libraries\MyEncrypt;

$this->db = db_connect();
 $session= \Config\Services::session();
echo view('user/common_style1');?>
</head>
<body>
<?php echo view('user/common_header');?>
 
<link rel="stylesheet" href="<?php echo base_url();?>styles/fonts/Socialico/stylesheet.css">
<link rel="stylesheet" href="<?php echo base_url();?>styles/css/set1.css">
<script src="<?php echo base_url();?>/styles/js/modernizr.js"></script>
 <style>
  .contact_one .contact_left_content form input[type="text"]{border:0px;}
  .prfledit label, .prfledit label {
  padding-top: 10px;
}

.help-block {
    color: #eb5055;
    margin: 0em 0em 0em !important;
}
p.frgtpwd {

text-transform: none;
  }
  .profilesub ul li label{
  display: inline;
  color: #eb5055;
}
.h6
{
  font-size: 17px;
}
.preca-bg {
    padding: 20px 10px 10px 20px;
}
.mont
{

    font-size: 15px;
}
  </style>
        

</head>
  <body>
      <?php
        
        $currency_info = defaultcurrency();
      ?>

<?php 
 
    $first_dat=$this->db->query("SELECT * FROM coin_info"); 
    $coin_det=$first_dat->getResult();    


 $site_lang_data = $this->common_model->GetSiteSettings('site');
 $token_symbol =$site_lang_data[19]->site_value;

?> 
 
         
           
<section class="trading-bg">
  <div class="container-fluid">
    <div class="row">
      <div class="col-lg-12">
        <div class="pairlist-bg bg-primary mt-3">
          <div class="d-mg-flex justify-content-between">
            <div class="pairlist-con">
              <h4 class="text-white mont"><span>Total assets converted(USDT):</span> 32.728114</h4>
            </div>
            <div class="pairlist-btn"><a href="" class="btn btn-outline-primary">Batch setting</a></div>
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-lg-12">
        <div class="trading_pairbg bg-white inner-box mt-3 px-3 py-4">
          <div class="inner-title pb-3">
            <h6 class="color-2"><i class="fab fa-bitcoin"></i>Strategy Payment</h6>
          </div>

          <br>
      <center>
        <div class="col-lg-8 ">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist">
                <li class="nav-item col-lg-4" role="presentation">
                  <h6 class="mont"><b><?php echo "Strategy Name";?></b></h6>                
                </li>
                <li class="col-lg-6">
                  <span><?php echo $up_id->stratgy?></span>
                </li>


          <?php 

          if($form_deposit['payment_id']==9)
          {
          $ch = curl_init();

          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
          curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
          curl_setopt($ch, CURLOPT_URL,"https://currency.paykassa.pro/?api_currency_rate&currency_in=USDT&currency_out=BTC");
          curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
          $result=curl_exec ($ch);
          $getresponse = json_decode($result);
          curl_close ($ch);
          $currency_rate = $getresponse->data->value;
          if($currency_rate)
          {
          $amount = $form_deposit['amount']*$currency_rate;
          }
        

      ?>
      <li class="nav-item col-lg-4" role="presentation">
      <h6 class="mont"><b><?php echo "Amount : ";?></b></h6>                
      </li>
      <li class="col-lg-6">
      <span><?php echo $amount." BTC ( ".$form_deposit['amount']." USDT )";?></span>
      </li>   
      </ul>
      </div>
      </div>
      </div>
      <br>
      <br>

      <?

          $private_key = $form_payment['public_key'];
          $public_key = $form_payment['private_key'];
          $walletcore = new WalletCoreAPI();
          $walletcore->Setup($private_key,$public_key);
          $ipn_url = "<?php echo base_url('ipn_process');?>";
          $result = $walletcore->GetCallbackAddress("BTC",$ipn_url);

          if($result['status'] == '200') 
          {
          $address=$result['address'];
          }
          else
          {
          $error=$result['msg'];
          }

          if($address!='')
          {
          $this->db->query("insert into pay_address set address='".$address."', amount='".$form_deposit['amount']."',convert_amount='".$amount."',userid='".$form_deposit['uusersid']."',pay_mode='2',historyid='".$deposit_id."', payment_id='9', date='".date("Y-m-d H:i:s")."'");
          $qr_url="https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=".$address;
          ?>

          <div class="row">
          <div class="form-group col-sm-12">
          <center>
          <h4>Payment Address: <?php echo $address;?></h4>
          <div style="clear:both;"><br></div>
          <img src="<?php echo $qr_url;?>">
          <div style="clear:both;"><br></div>
          </center>
          </div>
          </div>        
          <?php
          }

          }

          ?>


        <br>


        <br>

        <br>
        <h6 class="mont"> After Successful payment,Your strategy will be activated.</h6>
      </center>       
       <?php
         echo view('user/trade_chk');
      ?>

      </div>
        </div>
      </div>
    </div>
  </div>
</section>


</body>

<script src="<?php echo base_url();?>styles/js/jquery-1.12.2.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/formValidation.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/bootstrap.js"></script>
<script src="<?php echo base_url();?>/assets/boots/js/select_min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>/assets/boots/css/select2.css">
<script type="text/javascript">
(function( $ ) {
  $(function() {
     $(document).ready(function() {
            $('.activation').formValidation({
                framework: 'bootstrap',
                excluded: [':disabled'],
                field{
                    country: {
                                validators: {
                                    notEmpty: {
                                        message: 'select country'
                                    }

                                }
                            }
                }
            });
        });
 });
});

</script>
<?php
 echo view('user/footer1');
  echo view('user/common_script');
?> 
</html>