<?php 
session_start(); 
require_once('../conexion.php');
require_once('../include/sesiones.php');
require_once('../php_api/api.php');

//POS
$api_software_pos=$_POST["api_software_pos"]; 
$api_pin_pos=$_POST["api_pin_pos"]; 
$settestid_pos=$_POST["settestid_pos"]; 

$json_pos = array(
    "ideqdocs" => $api_software_pos,
    "pineqdocs" => $api_pin_pos
);

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "{$configuration->base_url}ubl2.1/config/softwareeqdocs",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS =>json_encode($json_pos),

  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'cache-control: no-cache',
    'Connection: keep-alive',
    'Accept-Encoding: gzip, deflate',
    'accept: application/json',
    'X-CSRF-TOKEN: ',
    'Authorization: Bearer '.$token
  ),
));

$response = curl_exec($curl);
curl_close($curl);

$sql=mysqli_query($con,"UPDATE configuracion_electronica Set iden_soft_pos='$api_software_pos', ele_settestid_pos='$settestid_pos' Where empresa='$empresa'") or die(mysqli_error($con));

echo '<div class="alert alert-success alert-dismissable">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
        <strong> Software Registrado Correctamente</strong> 
   </div></br>'; 
?>