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

//NOMINA 
$api_software_nom=$_POST["api_software_nom"]; 
$api_pin_nom=$_POST["api_pin_nom"]; 
$settestid_nom=$_POST["settestid_nom"]; 

$json_nom = array(
    "idpayroll" => $api_software_nom,
    "pinpayroll" => $api_pin_nom
);

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "{$configuration->base_url}ubl2.1/config/softwarepayroll",
  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_nom),

  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_nom='$api_software_nom', ele_settestid_nomina='$settestid_nom' 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>'; 
?>