# Cambio Salarial Administrativo(Actualizar Salario (1)) - [updateSalarialbyEmployee]

## 🧾 Descripción

Este servicio registra una **solicitud de actualización salarial** para un empleado.  
Envía al ERP los nuevos valores de:

- Sueldo
- Movilidad
- Bono nocturno
- Fecha de actualización

*El servicio **solo valida la estructura y los datos requeridos**, mientras que el proceso interno de aprobación o registro es manejado por el ERP a través del recurso **Cambio Salarial Administrativo**.*

---

## 🚀 Endpoint

**POST** **<span style="color: rgb(224, 62, 45);">`/update-salarial-by-employee`</span>**

---

## 📥 Request Body (JSON)

Todos los campos son **obligatorios**.

<div class="_tableContainer_1rjym_1" id="bkmrk-campo-tipo-descripci"><div class="group _tableWrapper_1rjym_13 flex w-fit flex-col-reverse" tabindex="-1"><table class="w-fit min-w-(--thread-content-width)" data-end="1174" data-start="852"><thead data-end="882" data-start="852"><tr data-end="882" data-start="852"><th data-col-size="sm" data-end="860" data-start="852">Campo</th><th data-col-size="sm" data-end="867" data-start="860">Tipo</th><th data-col-size="sm" data-end="882" data-start="867">Descripción</th></tr></thead><tbody data-end="1174" data-start="914"><tr data-end="953" data-start="914"><td data-col-size="sm" data-end="925" data-start="914">empleado</td><td data-col-size="sm" data-end="934" data-start="925">string</td><td data-col-size="sm" data-end="953" data-start="934">ID del empleado</td></tr><tr data-end="998" data-start="954"><td data-col-size="sm" data-end="963" data-start="954">sueldo</td><td data-col-size="sm" data-end="972" data-start="963">number</td><td data-col-size="sm" data-end="998" data-start="972">Nuevo sueldo propuesto</td></tr><tr data-end="1048" data-start="999"><td data-col-size="sm" data-end="1011" data-start="999">movilidad</td><td data-col-size="sm" data-end="1020" data-start="1011">number</td><td data-col-size="sm" data-end="1048" data-start="1020">Nuevo monto de movilidad</td></tr><tr data-end="1100" data-start="1049"><td data-col-size="sm" data-end="1065" data-start="1049">bono\_nocturno</td><td data-col-size="sm" data-end="1074" data-start="1065">number</td><td data-col-size="sm" data-end="1100" data-start="1074">Monto de bono nocturno</td></tr><tr data-end="1174" data-start="1101"><td data-col-size="sm" data-end="1109" data-start="1101">fecha</td><td data-col-size="sm" data-end="1131" data-start="1109">string (YYYY-MM-DD)</td><td data-col-size="sm" data-end="1174" data-start="1131">Fecha de aplicación del cambio salarial</td></tr></tbody></table>

</div></div>### Ejemplo de entrada

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22empleado%22%3A-%22emp-0"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"empleado"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"EMP-00123"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"sueldo"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"1500"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"movilidad"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"200"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"bono_nocturno"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"150"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"fecha"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"2025-01-15"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>---

## 🔐 Seguridad

Requiere token válido del ERP (interno), administrado desde:

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%24this-%3Egeneral-%3Eserv"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-variable language_">$this</span>->general-><span class="hljs-title function_ invoke__">ServiceErp</span>()`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>---

## 🧠 Flujo del Servicio (resumen real)

1. **Valida que se hayan enviado todos los campos requeridos.**  
    Si falta alguno, retorna error.
2. **Valida formato de fecha** usando `validateDate()`.
3. **Construye el body** que será enviado al ERP:

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22empleado%22%3A-%22%3Cid%3E%22"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"empleado"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"<id>"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"nuevo_sueldo"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"<sueldo>"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"nueva_movilidad"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"<movilidad>"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"nuevo_bono_nocturno"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"<bono nocturno>"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"fecha_de_actualizacion_date"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"<fecha>"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>4. **Envía la solicitud al ERP**: `<span class="hljs-attribute">POST</span> resource/Cambio Salarial Administrativo`

5. **Devuelve al cliente el resultado**, incluyendo la respuesta del ERP.

---

## 📤 Response 200 – Ejemplo exitoso

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-true%2C-%22ms"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">true</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"¡Excelente! Se ha registrado exitosamente tu solicitud."</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"data"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>    <span class="hljs-attr">"name"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"CSA-00045"</span><span class="hljs-punctuation">,</span>    <span class="hljs-attr">"empleado"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"EMP-00123"</span><span class="hljs-punctuation">,</span>    <span class="hljs-attr">"nuevo_sueldo"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"1500"</span><span class="hljs-punctuation">,</span>    <span class="hljs-attr">"nueva_movilidad"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"200"</span><span class="hljs-punctuation">,</span>    <span class="hljs-attr">"nuevo_bono_nocturno"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"150"</span><span class="hljs-punctuation">,</span>    <span class="hljs-attr">"fecha_de_actualizacion_date"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"2025-01-15"</span>  <span class="hljs-punctuation">}</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>---

## ❗ Posibles Errores

### 1. Campos faltantes

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-false%2C-%22m"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Ingrese los campos requeridos"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>### 2. Empleado vacío

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-false%2C-%22m-1"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Ingrese el empleado"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>### 3. Sueldo vacío

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-false%2C-%22m-2"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Ingrese el sueldo"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>### 4. Movilidad vacío

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-false%2C-%22m-3"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Ingrese la movilidad"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>### 5. Bono nocturno vacío

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-false%2C-%22m-4"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Ingrese el Bono Nocturno"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>### 6. Fecha inválida

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-false%2C-%22m-5"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Ingrese la fecha de actualizacion"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>---

## 📚 Schemas

### Cambio Salarial Administrativo (ERP)

Body enviado:

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22empleado%22%3A-%22strin"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"empleado"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"string"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"nuevo_sueldo"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"number"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"nueva_movilidad"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"number"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"nuevo_bono_nocturno"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"number"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"fecha_de_actualizacion_date"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"YYYY-MM-DD"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>---

## 🗃 Lógica en Pseudocódigo

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-required-%3D-%5Bempleado"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`required = [empleado, sueldo, movilidad, bono_nocturno, fecha]<span class="hljs-keyword">if</span> falta alguno:    <span class="hljs-keyword">return</span> error<span class="hljs-keyword">if</span> fecha no válida:    <span class="hljs-keyword">return</span> errorbody = {    empleado,    nuevo_sueldo: sueldo,    nueva_movilidad: movilidad,    nuevo_bono_nocturno: bono_nocturno,    fecha_de_actualizacion_date: fecha}response = POST ERP Cambio Salarial Administrativo<span class="hljs-keyword">return</span> success with response`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr">  
</div></div>