NAV Navbar
json curl
  • Introducción
  • Usuarios
  • Clientes, Marcas, Proyectos
  • Proveedores
  • Cotizaciones/Solicitudes
  • Comentarios
  • Calendario
  • Insumos
  • Reembolsos
  • Catálogos
  • Reportes
  • Notificaciones
  • Validaciones
  • Errors
  • Introducción

    Documentación API del sistema de gestión de egresos e ingresos de Element Studios.

    Usuarios

    Perfil

    GET /api/v1/users/profile

    Authorization: Bearer [Auth0]

    Response

    {
      "user": {
        "id": 4001,
        "user_id": "google-oauth2|103170969289978119959",
        "email": "[email protected]",
        "given_name": "Eduardo",
        "family_name": "Miranda",
        "name": "Eduardo Miranda",
        "picture": "https://lh4.googleusercontent.com/-RWO5TA9iUmM/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rfPeI0HanYku3Qj1CZKX6gBLDNG6Q/photo.jpg",
        "nickname": "eduardo.miranda",
        "job_title": "Desarrollador",
        "last_login": "2019-11-29T22:07:31.893Z",
        "logins_count": 17,
        "role": "admin"
      }
    }
    

    Una vez se haya iniciado sesión se debe verificar que el usuario pertenece a la organización, para hacer esta verificación se solicita el perfil con el siguiente método.

    Este método devuelve la información de perfil del usuario que hace la petición.

    Crear usuario

    POST /api/v1/users

    Authorization: Bearer [Auth0]

    Roles: admin, rh

    Request

    {
      "email": "[email protected]",
      "name": "Tara Bashirian",
      "job_title": "Future Division Specialist",
      "role": "employee"
    }
    

    Response HTTP 201

    Cada nuevo integrante de la organización deberá ser registrado en el sistema para que tenga acceso a las funcionalidades. Si no es registrado, aunque tenga correo @element.com.mx no podrá ingresar. Este servicio crea un usuario con los datos recibidos.

    Atributo Validaciones
    email required, typeOf:string, email, unique:user,email, regex:element
    name required, typeOf:string, min:1, max:120
    role required, typeOf:string
    job_title required, typeOf:string, min:1, max:200

    Editar usuario

    PUT /api/v1/users/:user_id

    Authorization: Bearer [Auth0]

    Roles: admin, rh

    Request

    {
      "email": "[email protected]",
      "name": "Tara Bashirian",
      "job_title": "Future Division Specialist",
      "role": "employee"
    }
    

    Response HTTP 204

    Actualiza la información de perfil de un usuario.

    Atributo Validaciones
    :user_id required, typeOf:numerid, exists:user,id
    email sometimes, typeOf:string, email, unique:user,email, regex:element
    name sometimes, typeOf:string, min:1, max:120
    role sometimes, typeOf:string
    job_title sometimes, typeOf:string, min:1, max:200

    Perfil de Usuario

    GET /api/v1/users/:user_id

    Authorization: Bearer [Auth0]

    Roles: admin, rh

    Request

    {
      "user": {
        "id": 4001,
        "user_id": "google-oauth2|103170969289978119959",
        "email": "[email protected]",
        "given_name": "Eduardo",
        "family_name": "Miranda",
        "name": "Eduardo Miranda",
        "picture": "https://lh4.googleusercontent.com/-RWO5TA9iUmM/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rfPeI0HanYku3Qj1CZKX6gBLDNG6Q/photo.jpg",
        "nickname": "eduardo.miranda",
        "job_title": "Desarrollador",
        "last_login": "2019-11-29T22:07:31.893Z",
        "logins_count": 17,
        "role": "admin"
      }
    }
    

    Response HTTP 200

    Devuelve el perfil de un usuario en particular.

    Eliminar Usuario

    DELETE /api/v1/users/:user_id

    Authorization: Bearer [Auth0]

    Roles: admin, rh

    Response HTTP 204

    Elimina al usuario identificado por :user_id.

    Todos los usuarios

    GET /api/v1/users

    Authorization: Bearer [Auth0]

    Roles: admin, rh

    Response HTTP 200

    {
      "users": [
        {
          "id": 4001,
          "user_id": "google-oauth2|103170969289978119959",
          "email": "[email protected]",
          "given_name": "Eduardo",
          "family_name": "Miranda",
          "name": "Eduardo Miranda",
          "picture": "https://lh4.googleusercontent.com/-RWO5TA9iUmM/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rfPeI0HanYku3Qj1CZKX6gBLDNG6Q/photo.jpg",
          "nickname": "eduardo.miranda",
          "job_title": "Desarrollador",
          "last_login": "2019-11-29T22:07:31.893Z",
          "logins_count": 17,
          "role": "admin"
        }
      ]
    }
    

    Devuelve una lista con todos los usuarios del sistema.

    Clientes, Marcas, Proyectos

    Clientes

    GET /api/v1/customers

    Authorization: Bearer [Auth0]

    Response

    {
      "customers" : [
        {
          "id": 2,
          "code": "GC",
          "name": "Grupo Modelo",
          "description": "Empresa de cervecería",
          "brands": "/api/v1/customers/2/brands",
          "payment_conditions": 60,
          "picture": "https://element-desarrollo.s3.amazonaws.com/customers/v1/2.png",
          "projects_count": 2
        }
      ]
    }
    

    Marcas de Cliente

    GET /api/v1/customers/:customer_id/brands

    Authorization: Bearer [Auth0]

    Response

    {
      "brands" : [
        {
          "id": 1,
          "code": "GCB",
          "name": "Cerveza Corona",
          "description": "Bebida",
          "projects": "/api/v1/brands/2/projects",
          "picture": "https://element-desarrollo.s3.amazonaws.com/customers/v1/2.png"
        }
      ]
    }
    

    Devuelve las marcas de un cliente.

      curl http://payment-docs.element.mx/examples/customers.json
    

    Crear Cliente con Marcas

    POST /api/v1/customers/brands

    Authorization: Bearer [Auth0]

    Request

    {
      "name": "Pepsico",
      "brands": [
        {
          "name": "Ruffles"
        },
        {
          "name": "Pepsi"
        }
      ]
    }
    

    Response HTTP 201

    Crea un nuevo cliente con marcas.

    Atributo Validaciones
    name typeOf:string, min:1, max:120, regex:alphanumeric, unique:brands,name
    brands[].name typeOf:string, min:3, max:20, regex:alphanumeric, unique:brands,name

    Crear Cliente

    POST /api/v1/customers

    Authorization: Bearer [Auth0]

    Request

    {
      "name": "Pepsico",
      "payment_conditions": 60,
      "picture": File
    }
    

    Response HTTP 201

    Crea un nuevo cliente.

    Atributo Validaciones
    name required, typeOf:string, min:1, max:120, regex:alphanumeric, unique:customer,name
    payment_conditions required, typeOf:number, max:365
    picture required, size:5Mb, extension:jpg,png

    Actualizar Cliente

    PUT /api/v1/customers/:customer_id

    Authorization: Bearer [Auth0]

    Request

    {
      "name": "Pepsico",
      "payment_conditions": 60,
      "picture": File
    }
    

    Response HTTP 204

    Actualiza un cliente.

    Atributo Validaciones
    name sometimes, typeOf:string, min:1, max:120, regex:alphanumeric, unique:customer,name
    payment_conditions sometimes, typeOf:number, max:365
    picture sometimes, size:5Mb, extension:jpg,png

    Eliminar Cliente

    DELETE /api/v1/customers/:customer_id

    Authorization: Bearer [Auth0]

    Roles: admin

    Response HTTP 204

    Elimina un cliente

    Marcas

    GET /api/v1/brands

    Authorization: Bearer [Auth0]

    Response

    {
      "brands" : [
        {
          "id": 1,
          "code": "GCB",
          "name": "Cerveza Corona",
          "description": "Bebida",
          "projects": "/api/v1/brands/2/projects",
          "picture": "https://element-desarrollo.s3.amazonaws.com/customers/v1/2.png"
        }
      ]
    }
    
      curl http://payment-docs.element.mx/examples/brands.json
    

    Devuelve la lista de marcas.

    Crear Marca

    POST /api/v1/customers/:customer_id/brands

    Authorization: Bearer [Auth0]

    Request

    {
      "name": "Cerveza Corona"
    }
    

    Response HTTP 201

    Crea una marca para el cliente con identificador :customer_id

    Atributo Validaciones
    name required, typeOf:string, min:3, max:30, regex:alphanumeric, unique:customer,name

    Actualizar Marca

    PUT /api/v1/brands/:brand_id

    Authorization: Bearer [Auth0]

    Request

    {
      "name": "Modelo Especial"
    }
    

    Response HTTP 201

    Actualiza la marca con identificador :brand_id

    Atributo Validaciones
    brand_id required, typeOf:numeric, exists:brand,id
    name sometimes, typeOf:string, min:3, max:30, regex:alphanumeric, unique:brand,name

    Eliminar Marca

    DELETE /api/v1/brands/:brand_id

    Authorization: Bearer [Auth0]

    Roles: admin

    Response HTTP 204

    Elimina una marca.

    Proyectos por Marca

    GET /api/v1/brands/:brand_id/projects

    Authorization: Bearer [Auth0]

    Response

    {
      "projects" : [
        {
          "id": 3,
          "folio": "601",
          "name": "Corona Capital 2019",
          "description": "Eventos"
        }
      ]
    }
    

    Devuelve los proyectos de una marca

    Proyectos

    GET /api/v1/projects

    Authorization: Bearer [Auth0]

    Response

    {
      "projects" : [
        {
          "id": 3,
          "folio": "601",
          "name": "Corona Capital 2019",
          "description": "Eventos"
        }
      ]
    }
    

    Response ?friendly=true

    {
      "projects" : [
        {
          "id": 3,
          "grouper": {
            "given_name": "Karina Peralta",
            "picture": "https://lh4.googleusercontent.com/-RWO5TA9iUmM/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rfPeI0HanYku3Qj1CZKX6gBLDNG6Q/photo.jpg",
            "job_title": "Project Manager",
            "role": "grouper"
          },
          "collaborators": [
            {
              "id": 1,
              "given_name": "Karina Peralta",
              "picture": "https://lh4.googleusercontent.com/-RWO5TA9iUmM/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rfPeI0HanYku3Qj1CZKX6gBLDNG6Q/photo.jpg",
              "job_title": "Project Manager",
              "role": "grouper"
            }
          ],
          "customer": "Cerveza Corona",
          "brand": "Grupo Modelo",
          "folio": "601",
          "name": "Corona Capital 2019",
          "description": "Eventos"
        }
      ]
    }
    
      curl http://payment-docs.element.mx/examples/projects.json
    

    Devuelve la lista de proyectos.

    Esta acción acepta la siguiente consulta:

    Atributo Validaciones
    friendly required, typeOf:boolean

    Crear Proyecto

    POST /api/v1/brands/:brand_id/projects

    Authorization: Bearer [Auth0]

    Request

    {
      "name": "Corona Capital 2019"
    }
    

    Response HTTP 201

    Crea un proyecto para la marca con identificador :brand_id

    Atributo Validaciones
    name required, typeOf:string, min:3, max:30, regex:alphanumeric, unique:brands,id

    Editar Proyecto

    PUT /api/v1/projects/:project_id

    Authorization: Bearer [Auth0]

    Request

    {
      "folio": "564",
      "name": "Corona Capital 2019",
      "description": "Campaña publicitaria 2019"
    }
    

    Response HTTP 201

    Actualiza el proyecto con identificador :project_id

    Atributo Validaciones
    folio sometimes, typeOf:string, min:3, max:10, regex:numeric
    name sometimes, typeOf:string, min:3, max:30, regex:alphanumeric
    description sometimes, typeOf:string, min:0, max:255, regex:alphanumeric, nullable

    Eliminar Proyecto

    DELETE /api/v1/projects/:project_id

    Authorization: Bearer [Auth0]

    Roles: admin

    Response HTTP 204

    Elimina un proyecto.

    Proveedores

    Los proveedores pueden ser creados individualmente o durante la creación de una cotización.

    Obtener Proveedores

    GET /api/v1/suppliers

    Authorization: Bearer [Auth0]

    Response HTTP 200

    {
      "suppliers": [
        {
          "id": 5,
          "payment_conditions": 60,
          "company_name": "Proveedor 01 S.A. de C.V.",
          "contact_name": "Juan Ramirez",
          "email": "[email protected]",
          "phone": "+525541878844",
          "business_activity": "Telecomunicaciones",
          "picture": File
        }
      ]
    }
    

    Devuelve todos los proveedores. Esta acción acepta las siguientes consultas:

    Atributo Validaciones
    contact_name required, typeOf:string, regex:name, min:2, max:100
    business_activity required, typeOf:string, min:2, max:255

    Obtener Proveedor

    GET /api/v1/suppliers/:supplier_id

    Authorization: Bearer [Auth0]

    Response HTTP 200

    {
      "supplier": {
        "id": 5,
        "company_name": "Proveedor 01 S.A. de C.V.",
        "payment_conditions": 60,
        "contact_name": "Juan Ramirez",
        "email": "[email protected]",
        "phone": "+525541878844",
        "business_activity": "Telecomunicaciones",
        "picture": File
      }
    }
    

    Devuelve la información de un proveedor

    Crear proveedor

    POST /api/v1/suppliers

    Authorization: Bearer [Auth0]

    Roles: admin, rh, manager

    Request

    {
      "id": 5,
      "company_name": "Proveedor 01 S.A. de C.V.",
      "payment_conditions": 60,
      "contact_name": "Juan Ramirez",
      "email": "[email protected]",
      "phone": "+525541878844",
      "business_activity": "Telecomunicaciones",
      "picture": File
    }
    

    Response HTTP 201

    Crea un nuevo proveedor con los datos recibidos.

    Atributo Validaciones
    company_name required, typeOf:string, regex:name, min:2, max:100, unique:supplier,company_name
    contact_name required, typeOf:string, regex:name, min:2, max:100
    payment_conditions sometimes,typeOf:number, min:1, max:365
    phone required, typeOf:string, regex:phone, min:10, max:15
    email required, typeOf:string, email, min:10, max:100
    business_activity required, typeOf:string, min:2, max:255
    picture sometimes, size:5Mb, extension:jpg,png,jpeg

    Editar proveedor

    PUT /api/v1/suppliers/:supplier_id

    Authorization: Bearer [Auth0]

    Roles: admin, rh, manager

    Request

    {
      "id": 5,
      "company_name": "Proveedor 01 S.A. de C.V.",
      "payment_conditions": 60,
      "contact_name": "Juan Ramirez",
      "email": "[email protected]",
      "phone": "+525541878844",
      "business_activity": "Telecomunicaciones",
      "picture": File
    }
    

    Response HTTP 204

    Actualiza la información del proveedor.

    Atributo Validaciones
    company_name required, typeOf:string, regex:name, min:2, max:100, unique:supplier,company_name
    contact_name required, typeOf:string, regex:name, min:2, max:100
    payment_conditions sometimes,typeOf:number, min:1, max:365
    phone required, typeOf:string, regex:phone, min:10, max:15
    email required, typeOf:string, email, min:10, max:100
    business_activity required, typeOf:string, min:2, max:255
    picture sometimes, size:5Mb, extension:jpg,png,jpeg

    Proveedor - Iniciar Sesión

    POST /api/v1/suppliers/session

    Authorization: NONE

    Request

    //Usuario de prueba
    {
      "email": "[email protected]",
      "password": "Password123"
    }
    

    Response HTTP 200

    {
      "id": 4001,
      "company_name": "Doofenshmirtz Evil INC",
      "contact_name": "Dr. Doofenshmirtz",
      "phone": "+525541878844",
      "email": "[email protected]",
      "business_activity": "Ciencia y Tecnología",
      "authorization": {
        "grant_type": "bearer",
        "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkb29mZW5zaG1pcnR6QGV2aWwuaW5jIiwidHlwZSI6InN1cHBsaWVyIiwiaWF0IjoxNTc2MTc2MDc5fQ.kJLXGAo4y-cXHhOu81ZgODbNQpjzloAVtKPtpwtMigA",
        "expires_at": 1576179679919
      }
    }
    

    Crea una sesión para el proveedor identificado por correo y contraseña.

    Atributo Validaciones
    email required, typeOf:string, email, min:10, max:100, exist:supplier,email
    password required, typeOf:string, min:8, max:16

    Proveedor - Establecer Contraseña

    PUT /api/v1/suppliers/password

    Authorization: NONE

    Request

    {
      "password": "Password123",
      "password_confirmation": "Password123",
      "token": "y3b3f8dh8cv6qdqbl7slvsq3bt0j4pjt"
    }
    

    Response HTTP 204

    Establece o actualiza la contraseña del proveedor por medio de un token que es enviado al correo electrónico con el que el proveedor fue registrado.

    Atributo Validaciones
    token required, typeOf:string, exact:32
    password required, typeOf:string, min:8, max:16, confirmation

    Proveedor - Reestablecer Contraseña

    POST /api/v1/suppliers/recovery

    Authorization: NONE

    Request

    {
      "email": "[email protected]"
    }
    

    Response HTTP 204

    Se envia al correo electrónico recibido un mensaje que contiene las instrucciones para reestablecer contraseña.

    Atributo Validaciones
    email required, typeOf:string, email, min:10, max:100, exist:supplier,email

    Proveedor - Información de Facturación

    GET /api/v1/suppliers/billing

    Authorization: Bearer [JWTSupplier]

    Response

    {
      "id": 1,
      "name": "Dr. Doofenshmirtz",
      "rfc": "DOOM010666VIL",
      "business_name": "Doofenshmirtz Evil INC",
      "banking_institution": "Bancomer",
      "bank_account": "1092762548167903091830184",
      "account_status_file": "/billings/v1/1.pdf",
      "concept": "Renta de equipo robótico",
    }
    

    Devuelve la información de facturación del proveedor.

    Proveedor - Crear o Actualizar Información de Facturación

    POST /api/v1/suppliers/billing

    Authorization: Bearer [JWTSupplier]

    Request

    {
      "name": "Dr. Doofenshmirtz",
      "rfc": "DOOM010666VIL",
      "contact_name": "Dr. Doofenshmirtz",
      "contact_phone": "+525541878844",
      "business_name": "Doofenshmirtz Evil INC",
      "banking_institution": "Bancomer",
      "bank_account": "1092762548167903091830184",
      "concept": "Renta de equipo robótico",
      "account_status_file": File,
    }
    

    Response HTTP 201

    Crea o actualiza la información de facturación de un proveedor.

    Validaciones NO EXISTE información almacenada

    Atributo Validaciones
    account_status_file sometimes, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx
    name required, typeOf:string,min:2, max:100, unique:billing,name
    contact_name required, typeOf:string,min:2, max:100
    contact_phone required, typeOf:string, regex:phone, min:10, max:15
    rfc required, typeOf:string,min:2, max:20, unique:billing,rfc
    business_name required, typeOf:string,min:2, max:100, unique:billing,business_name
    banking_institution required, typeOf:string,min:2, max:100
    bank_account required, typeOf:numeric,min:2, max:60
    concept required, typeOf:string,min:2, max:255

    Validaciones EXISTE información almacenada

    Atributo Validaciones
    account_status_file sometimes, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx
    name sometimes, typeOf:string,min:2, max:100
    contact_name sometimes, typeOf:string,min:2, max:100
    contact_phone sometimes, typeOf:string, regex:phone, min:10, max:15
    rfc sometimes, typeOf:string,min:2, max:20
    business_name sometimes, typeOf:string,min:2, max:100, business_name``
    banking_institution sometimes, typeOf:string,min:2, max:100
    bank_account sometimes, typeOf:numeric,min:2, max:60
    concept sometimes, typeOf:string,min:2, max:255

    Proveedor - Obtener Facturas

    GET /api/v1/suppliers/bills

    Authorization: Bearer [JWTSupplier]

    Response

    {
      "bills": [
        {
          "id": 1,
          "concept": "Renta de camaras",
          "cost_in_cents": 50000,
          "cost": "500.00",
          "project": "Mailing Corona Promo",
          "payment_method": "cash",
          "amount": 30000,
          "billing_date": null,
          "payment_date": "2019-10-31",
          "paid_at": null,
          "payment_schedule_id": 1,
          "paid": false,
          "billing_file": null
        },
        {
          "id": 2,
          "concept": "Renta de camaras",
          "cost_in_cents": 50000,
          "cost": "500.00",
          "project": "Mailing Corona Promo",
          "payment_method": "direct_bank_transfer",
          "amount": 20000,
          "billing_date": null,
          "payment_date": "2019-10-31",
          "paid_at": null,
          "payment_schedule_id": 2,
          "paid": false,
          "billing_file": null
        }
      ]
    }
    

    Proveedor - Subir Factura

    GET /api/v1/suppliers/payment_schedules/:payment_schedule_id

    Authorization: Bearer [JWTSupplier]

    Response

    {
      "id": 2,
      "payment_method": "direct_bank_transfer",
      "amount": 20000,
      "billing_date": null,
      "payment_date": "2019-10-31",
      "paid_at": null,
      "billing_uploaded_at": "2020-01-21T20:05:58.022Z",
      "payment_schedule_id": 2,
      "paid": false,
      "billing_file": "https://element-desarrollo.s3.amazonaws.com/paymentschedules/v1/2/billing_file.pdf"
    }
    

    Sube una factura a la fecha de pago de proveedor.

    Cotizaciones/Solicitudes

    Cotización - Paso 1

    POST /api/v1/projects/:project_id/quotations

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "location": "Ciudad de México",
      "payment_conditions": "60",
      "billing_date": "2020-06-01",
      "purchase_order": "ABC1234032",
      "project_start_date": "2019-11-01",
      "project_end_date": "2020-05-05",
      "cost_in_cents": 100000,
      "quotation_file": File,
      "confirmation_file": File
    }
    

    Response HTTP 200

    {
      "id": 1,
      "project": { 
        "folio": "601", 
        "name": "Corona Capital 2019", 
        "description": "Eventos" 
      },
      "location": "Ciudad de México",
      "cost_in_cents": 100000,
      "billing_date": "2020-06-01",
      "purchase_order": "ABC1234032",
      "project_start_date": "2019-11-01T00:00:00.000Z",
      "project_end_date": "2020-05-05T00:00:00.000Z",
      "payment_conditions": 60,
      "priority": "low",
      "cost": "1000.00",
      "quotation_file": "https://element-desarrollo.s3.amazonaws.com/quotations/v1/1.pdf",
      "confirmation_file": "https://element-desarrollo.s3.amazonaws.com/quotations/v1/1.pdf",
      "created_by": {
        "id": 4001,
        "email": "[email protected]",
        "given_name": "Eduardo",
        "role": "admin"
      }
    }
    

    Crea una cotización con los datos recibidos.

    Atributo Validaciones
    project_id required,typeOf:numeric, exists:project,id
    quotation_file required, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx
    confirmation_file sometimes, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx
    location sometimes,typeOf:string, min:1, max:512
    billing_date required,date:YYYY-MM-DD
    purchase_order sometimes,typeOf:string, min:0, max:200
    payment_conditions sometimes,typeOf:numeric, min:0
    project_start_date required,date:YYYY-MM-DD
    project_end_date required,date:YYYY-MM-DD
    cost_in_cents required,typeOf:number, min:1

    Editar Cotización

    PUT /api/v1/quotations/:quotation_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "location": "Ciudad de México",
      "billing_date": "2020-06-01",
      "purchase_order": "ABC1234032",
      "payment_conditions": "60",
      "project_start_date": "2019-11-01",
      "project_end_date": "2020-05-05",
      "cost_in_cents": 100000,
      "quotation_file": File,
      "confirmation_file": File
    }
    

    Response HTTP 200

    {
      "id": 1,
      "project": { 
        "folio": "601", 
        "name": "Corona Capital 2019", 
        "description": "Eventos" 
      },
      "location": "Ciudad de México",
      "cost_in_cents": 100000,
      "billing_date": "2020-06-01",
      "purchase_order": "ABC1234032",
      "project_start_date": "2019-11-01T00:00:00.000Z",
      "project_end_date": "2020-05-05T00:00:00.000Z",
      "payment_conditions": 60,
      "priority": "low",
      "cost": "1000.00",
      "quotation_file": "https://element-desarrollo.s3.amazonaws.com/quotations/v1/1.pdf",
      "confirmation_file": "https://element-desarrollo.s3.amazonaws.com/quotations/v1/1.pdf",
      "created_by": {
        "id": 4001,
        "email": "[email protected]",
        "given_name": "Eduardo",
        "role": "admin"
      }
    }
    

    Actualiza la cotización con identificador igual a :quotation_id.

    Aunque los datos recibidos se muestren en formato JSON del lado derecho. Esta petición debe ser enviada con Content-Type: multipart/form-data para que los archivos sean recibidos correctamente.

    Atributo Validaciones
    quotation_id required,typeOf:numeric, exists:quotation,id
    project_id required,typeOf:numeric, exists:project,id
    quotation_file sometimes, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx
    confirmation_file sometimes, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx
    location sometimes,typeOf:string, min:1, max:512
    billing_date sometimes,date:YYYY-MM-DD
    purchase_order sometimes,typeOf:string, min:0, max:200
    payment_conditions sometimes,typeOf:numeric, min:0
    project_start_date sometimes,date:YYYY-MM-DD
    project_end_date sometimes,date:YYYY-MM-DD
    cost_in_cents sometimes,typeOf:number, min:1
    priority sometimes,in:low,medium,urgent, typeOf:string, min:3, max:6

    Agregar Proveedores - Paso 2

    POST /api/v1/quotations/:quotation_id/suppliers

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "supplier_id": 1,
      "concept": "Renta de camaras",
      "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat ,incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
      "cost_in_cents": 50000,
      "payment_schedule":  "[{'payment_date':'2019-11-01','payment_method':'cash'},{'payment_date':'2019-11-01','payment_method':'direct_bank_transfer'}]"
      "quotation_file": File
    }
    

    Response HTTP 200

    {
      "id": 1,
      "concept": "Renta de camaras",
      "cost_in_cents": 50000,
      "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
      "quotation_file": "https://element-desarrollo.s3.amazonaws.com/supplierquotations/v1/1.pdf",
      "payment_schedule": [
        {
          "id": 1,
          "amount": 50000,
          "billing_date": "2019-10-01",
          "payment_date": "2019-11-01",
          "paid_at": "2019-11-02",
          "payment_method": "direct_bank_transfer"
        },
        {
          "id": 2, 
          "amount": 50000,
          "billing_date": "2019-10-01",
          "payment_date": "2019-11-01",
          "paid_at": "2019-11-02",
          "payment_method": "cash"
        }
      ]
    

    Crea una cotización de proveedor para la cotización en curso.

    Para obtener supplier_id ver: Crear Proveedores

    Atributo Validaciones
    quotation_id required,typeOf:numeric, exists:quotation,id
    supplier_id required,typeOf:numeric, exists:supplier,id
    concept required,typeOf:string, min:1, max:512
    cost_in_cents required,typeOf:number, min:0
    comments required,typeOf:string
    quotation_file sometimes, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx
    payment_schedule required,typeOf:JSONArray, min:1
    payment_schedule[].payment_date required,date:YYYY-MM-DD
    payment_schedule[].payment_method required,typeOf:string, in:cash,payment_method

    Editar Cotización de Proveedor

    PUT /api/v1/quotations/:quotation_id/suppliers/:supplier_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "concept": "Renta de camaras",
      "payment_conditions": 60,
      "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat ,incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
      "cost_in_cents": 50000,
      "payment_schedule":  "[{'payment_date':'2019-11-01','payment_method':'cash'},{'payment_date':'2019-11-01','payment_method':'direct_bank_transfer'}]"
      "quotation_file": File
    }
    

    Response HTTP 200

    {
      "id": 1,
      "concept": "Renta de camaras",
      "cost_in_cents": 50000,
      "payment_date": "Thu Oct 31 2019 18:00:00 GMT-0600 (Central Standard Time)",
      "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
      "quotation_file": "https://element-desarrollo.s3.amazonaws.com/supplierquotations/v1/1.pdf",
      "payment_schedule": [
        {
          "id": 1,
          "amount": 50000,
          "billing_date": "2019-10-01",
          "payment_date": "2019-11-01",
          "paid_at": "2019-11-02",
          "payment_method": "direct_bank_transfer"
        },
        {
          "id": 2, 
          "amount": 50000,
          "billing_date": "2019-10-01",
          "payment_date": "2019-11-01",
          "paid_at": "2019-11-02",
          "payment_method": "cash"
        }
      ]
    }
    

    Edita la cotización de proveedor con identificadores iguales a :supplier_id y :quotation_id.

    Atributo Validaciones
    quotation_id required,typeOf:numeric, exists:quotation,id
    supplier_id required,typeOf:numeric, exists:supplierquotation,id
    concept sometimes,typeOf:string, min:1, max:512
    cost_in_cents sometimes,typeOf:number, min:0
    comments sometimes,typeOf:string
    quotation_file sometimes, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx
    <!-- payment_date sometimes,date:YYYY-MM-DD -->
    payment_schedule required,typeOf:JSONArray, min:1
    payment_schedule[].payment_date required,date:YYYY-MM-DD
    payment_schedule[].payment_method required,typeOf:string, in:cash,payment_method

    Eliminar Cotización de Proveedor

    DELETE /api/v1/quotations/:quotation_id/suppliers/:supplier_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Response HTTP 204

    Resumen de Cotización - Paso 4

    GET /api/v1/quotations/:quotation_id/resume

    Authorization: Bearer [Auth0]

    Response

    {
      "id": 1,
      "project": {
        "folio": "601",
        "name": "Corona Capital 2019",
        "description": "Eventos",
        "brand": "Cerveza Corona",
        "brand_picture_url": "https://payment-docs.element.mx/images/logos/grupos/grupo_modelo/marcas/corona.jpg",
        "customer": "Grupo Modelo",
        "customer_picture_url": "https://payment-docs.element.mx/images/logos/grupos/grupo_modelo/grupo_modelo.png"
      },
      "location": "Ciuidad de México",
      "cost_in_cents": 100000,
      "project_start_date": "2019-01-24T22:54:18.729Z",
      "project_end_date": "2020-08-02T12:47:00.714Z",
      "payment_date": "2020-10-02T12:47:00.714Z",
      "payment_conditions": 60,
      "priority": "low",
      "quotation_file": "https://element-desarrollo.s3.amazonaws.com/quotations/v1/1.pdf",
      "confirmation_file": "https://element-desarrollo.s3.amazonaws.com/quotations/v1/1.pdf",
      "created_by": {
        "id": 4001,
        "email": "[email protected]",
        "given_name": "Eduardo",
        "role": "admin"
      },
      "comments": [
        {
          "id": 1,
          "message": "Duis minim commodo dolor id veniam exercitation duis ut laboris amet ea duis laborum. Eu sunt Lorem ea amet tempor sunt sit adipisicing duis eu. Irure consectetur adipisicing minim dolore officia esse reprehenderit reprehenderit exercitation cillum sit ullamco velit. Enim consectetur sunt occaecat consectetur sit ea id minim minim dolore."
        }
      ],
      "quotation_cost_number": 100000,
      "quotation_cost": "1000.00",
      "profitability_number": 0,
      "profitability": "0 %",
      "subtotal": "1000.00",
      "subtotal_number": 100000,
      "gain_total": "0.00",
      "gain_total_number": 0,
      "direct_bank_transfer": "500.00",
      "cash": "500.00",
      "direct_bank_transfer_number": 50000,
      "cash_number": 50000,
      "suppliers_total": "1000.00",
      "suppliers_total_number": 100000,
      "status_label": "danger",
      "expenses": [],
      "suppliers": [
        {
          "id": 1,
          "supplier": {
            "id": 5,
            "company_name": "Proveedor 01 S.A. de C.V.",
            "contact_name": "Juan Ramirez",
            "email": "[email protected]",
            "phone": "+525541878844",
            "business_activity": "Telecomunicaciones"
          },
          "payment_schedule": [
            {
              "amount": 50000,
              "billing_date": "2019-10-01",
              "payment_date": "2019-11-01",
              "paid_at": "2019-11-02",
              "payment_method": "direct_bank_transfer"
            }
          ],
          "concept": "Renta de camaras",
          "cost_in_cents": 50000,
          "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
          "cost": "500.00",
          "quotation_file": "https://element-desarrollo.s3.amazonaws.com/supplierquotations/v1/1.pdf",
          "comments" : [
            {
              "id":  3,
              "status": "info",
              "message":  "Nostrud mollit irure enim minim ad cupidatat ipsum ipsum sit exercitation irure enim ex adipisicing."
            }
          ]
        }
      ]
    }
    

    Devuelve toda la información de una cotización.

    Incluye:

    Confirmar Cotización - Paso 4.1

    POST /api/v1/quotations/:quotation_id/confirm

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "message": "Non culpa non aute id nostrud nulla sunt fugiat consequat elit. Cillum adipisicing voluptate eu adipisicing in aliqua reprehenderit cillum mollit adipisicing ut. Anim sit adipisicing ex pariatur labore consequat magna. Culpa ad cupidatat esse dolore laboris ut nostrud ea id et velit et enim enim."
    }
    

    Response HTTP 204

    Atributo Validaciones
    quotation_id required,typeOf:numeric, exists:quotation,id
    message required,typeOf:string, min:0

    Al confirmar una cotización se envía a revisión a la persona a cargo del proyecto.

    Si la cotización es creada por el encargado del proyecto, la cotización se envía a revisión de los directivos.

    Obtener Cotización

    GET /api/v1/quotations/:quotation_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Response HTTP 200

    {
      "id": 1,
      "project": 2,
      "location": "Morelos",
      "cost_in_cents": 500000,
      "project_start_date": "2019-04-26T19:17:32.299Z",
      "project_end_date": "2020-06-25T01:24:21.925Z",
      "payment_conditions": 90,
      "priority": "low",
      "completed_at": null,
      "rejected_at": null,
      "accepted_at": null,
      "cost": "5000.00"
    }
    

    Devuelve la cotización identificada por :quotation_id.

    Rechazar Cotización

    POST /api/v1/quotations/:quotation_id/reject

    Authorization: Bearer [Auth0]

    Roles: admin, grouper

    Request

    {
      "message": "Non culpa non aute id nostrud nulla sunt fugiat consequat elit. Cillum adipisicing voluptate eu adipisicing in aliqua reprehenderit cillum mollit adipisicing ut. Anim sit adipisicing ex pariatur labore consequat magna. Culpa ad cupidatat esse dolore laboris ut nostrud ea id et velit et enim enim."
    }
    

    Response HTTP 204

    Atributo Validaciones
    quotation_id required,typeOf:numeric, exists:quotation,id
    message required,typeOf:string, min:0

    Al rechazar una cotización se envía notificación a los solicitantes.

    Si la cotización es rechazada por directivos se envía notificación a el encargado de projecto y al solicitante.

    Obtener Cotizaciones

    GET /api/v1/quotations

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Response HTTP 200

    {
      "quotations": [
        {
          "id": 1,
          "project": 2,
          "location": "Morelos",
          "cost_in_cents": 500000,
          "project_start_date": "2019-04-26T19:17:32.299Z",
          "project_end_date": "2020-06-25T01:24:21.925Z",
          "payment_conditions": 90,
          "priority": "low",
          "completed_at": null,
          "rejected_at": null,
          "accepted_at": null,
          "cost": "5000.00",
          "created_by": {
            "id": 4001,
            "email": "[email protected]",
            "given_name": "Eduardo",
            "role": "admin"
          },
          "status": 0,
          "rejected": false,
          "approved": false
        }
      ]
    }
    

    Cotizaciones por proyecto

    GET /api/v1/projects/:project_id/quotations

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Response HTTP 200

    {
      "quotations": [
        {
          "id": 1,
          "project": 2,
          "location": "Morelos",
          "cost_in_cents": 500000,
          "project_start_date": "2019-04-26T19:17:32.299Z",
          "project_end_date": "2020-06-25T01:24:21.925Z",
          "payment_conditions": 90,
          "priority": "low",
          "completed_at": null,
          "rejected_at": null,
          "accepted_at": null,
          "cost": "5000.00",
          "created_by": {
            "id": 4001,
            "email": "[email protected]",
            "given_name": "Eduardo",
            "role": "admin"
          },
          "status": 0,
          "rejected": false,
          "approved": false
        }
      ]
    }
    

    Comentarios

    Comentario a Cotización de Proveedor

    POST /api/v1/supplierquotations/:supplier_id/comments

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "status" : "good",
      "message": "Occaecat ad pariatur amet fugiat sunt. Fugiat reprehenderit sunt voluptate consectetur officia non fugiat Lorem proident amet. Sit laborum velit nulla excepteur. Nisi culpa Lorem sint aliqua amet."
    }
    

    Response HTTP 204

    Crea una cotización con los datos recibidos.

    Atributo Validaciones
    supplier_id required,typeOf:numeric, exists:supplierquotation,id
    message sometimes,typeOf:string, min:0
    status sometimes,typeOf:string, in:good,bad,info

    Calendario

    Obtener fechas de Cotizaciones

    GET /api/v1/schedules

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Response HTTP 200

    {
      "schedules": [
        {
          "type": "quotation",
          "quotation": 1,
          "supplier_quotation": 1,
          "project": {
            "id": 1,
            "folio": "602",
            "name": "Mailing Corona Promo",
            "description": "mailing promocional",
            "brand": "Modelo Especial",
            "customer": "Grupo Modelo",
            "customer_picture_url": null,
            "brand_picture_url": null
          },
          "date": "2020-09-30"
        },
        {
          "type": "quotation",
          "quotation": 1,
          "supplier_quotation": 1,
          "project": {
            "id": 1,
            "folio": "602",
            "name": "Mailing Corona Promo",
            "description": "mailing promocional",
            "brand": "Modelo Especial",
            "customer": "Grupo Modelo",
            "customer_picture_url": null,
            "brand_picture_url": null
          },
          "date": "2020-10-31"
        }
      ] 
    }
    

    Devuelve las cotizaciones ordenadas por fecha.

    Insumos

    Crear Gasto en Insumo

    POST /api/v1/supplies/expenses

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "supplier_id": "1",
      "concept": "Comida y Alimentos",
      "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
      "cost_in_cents": 50000,
      "payment_method": "cash",
      "voucher_file": File
    }
    

    Response HTTP 200

    {
      "id": 1,
      "customer": {
        "name": "Cerveza Corona",
        "brand": "Grupo Modelo",
        "project": "Campaña Modelo",
      },
      "created_by": {
        "id": 4004,
        "given_name": null,
        "name": "Fiacro Ruiz",
        "picture": "http://payment-docs.element.mx/images/default_profile.jpg",,
        "custom_picture": null,
        "role": "employee"
      },
      "leader_accepted_by": null,
      "leader_rejected_by": null,
      "director_accepted_by": null,
      "director_rejected_by": null,
      "expenses": [
        {
          "id": 1,
          "concept": "Comida y Alimentos",
          "payment_method": "cash",
          "cost_in_cents": 50000,
          "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
          "payment_method": "cash",
          "accepted_at": null,
          "rejected_at": null,
          "cost": "500.00",
          "voucher_file": "https://element-desarrollo.s3.amazonaws.com/expenses/v1/1/voucher_file.pdf"
        }
      ]  
    }
    

    Crea una cotización gastos para el insumo en curso.

    Para obtener supplier_id ver: Crear Proveedores

    Atributo Validaciones
    supply_id sometimes, typeOf:numeric, exists:supply,id
    customer sometimes, typeOf:numeric, exists:customer,id
    brand sometimes, typeOf:numeric, exists:brand,id
    project sometimes, typeOf:numeric, exists:project,id
    payment_method sometimes, typeOf:string, in:cash,direct_bank_transfer
    supplier_id required,typeOf:numeric, exists:supplier,id
    concept required,typeOf:string, min:1, max:512
    cost_in_cents required,typeOf:number, min:0
    comments required,typeOf:string
    voucher_file sometimes, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx

    Editar Gasto de Insumo

    PUT /api/v1/supplies/:supply_id/expenses/:expense_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "concept": "Comida y Alimentos",
      "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
      "payment_method": "cash",
      "cost_in_cents": 50000,
      "voucher_file": File
    }
    

    Response HTTP 200

    {
      "id": 1,
      "customer": {
        "name": "Cerveza Corona",
        "brand": "Grupo Modelo",
        "project": "Campaña Modelo",
      },
      "created_by": {
        "id": 4004,
        "given_name": null,
        "name": "Fiacro Ruiz",
        "picture": "http://payment-docs.element.mx/images/default_profile.jpg",,
        "custom_picture": null,
        "role": "employee"
      },
      "leader_accepted_by": null,
      "leader_rejected_by": null,
      "director_accepted_by": null,
      "director_rejected_by": null,
      "expenses": [
        {
          "id": 1,
          "concept": "Comida y Alimentos",
          "payment_method": "cash",
          "cost_in_cents": 50000,
          "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
          "payment_method": "cash",
          "accepted_at": null,
          "rejected_at": null,
          "cost": "500.00",
          "voucher_file": "https://element-desarrollo.s3.amazonaws.com/expenses/v1/1/voucher_file.pdf"
        }
      ]  
    }
    

    Edita el insumo con identificadores iguales a :expense_id y :supply_id.

    Atributo Validaciones
    supply_id sometimes, typeOf:numeric, exists:supply,id
    customer sometimes, typeOf:numeric, exists:customer,id
    brand sometimes, typeOf:numeric, exists:brand,id
    project sometimes, typeOf:numeric, exists:project,id
    payment_method sometimes, typeOf:string, in:cash,direct_bank_transfer
    expense_id required,typeOf:numeric, exists:expense,id
    concept sometimes,typeOf:string, min:1, max:512
    cost_in_cents sometimes,typeOf:number, min:0
    comments sometimes,typeOf:string
    voucher_file sometimes, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx

    Eliminar Gasto en Insumo

    DELETE /api/v1/supplies/:supply_id/expenses/:expense_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Response HTTP 204

    Obtener Insumo

    POST /api/v1/supplies/:supply_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    Response HTTP 200

    {
      "id": 1,
      "customer": {
        "name": "Cerveza Corona",
        "brand": "Grupo Modelo",
        "project": "Campaña Modelo",
      },
      "created_by": {
        "id": 4004,
        "given_name": null,
        "name": "Fiacro Ruiz",
        "picture": "http://payment-docs.element.mx/images/default_profile.jpg",,
        "custom_picture": null,
        "role": "employee"
      },
      "leader_accepted_by": null,
      "leader_rejected_by": null,
      "director_accepted_by": null,
      "director_rejected_by": null,
      "expenses": [
        {
          "id": 1,
          "concept": "Comida y Alimentos",
          "payment_method": "cash",
          "cost_in_cents": 50000,
          "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
          "payment_method": "cash",
          "accepted_at": null,
          "rejected_at": null,
          "cost": "500.00",
          "voucher_file": "https://element-desarrollo.s3.amazonaws.com/expenses/v1/1/voucher_file.pdf"
        }
      ]  
    }
    

    Obtiene el detalle de un reembolso.

    Obtener Insumos

    POST /api/v1/supplies

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    Response HTTP 200

    {
      "supplies": [
        {
          "id": 1,
          "customer": {
            "name": "Cerveza Corona",
            "brand": "Grupo Modelo",
            "project": "Campaña Modelo",
          },
          "created_by": {
            "id": 4004,
            "given_name": null,
            "name": "Fiacro Ruiz",
            "picture": "http://payment-docs.element.mx/images/default_profile.jpg",,
            "custom_picture": null,
            "role": "employee"
          },
          "leader_accepted_by": null,
          "leader_rejected_by": null,
          "director_accepted_by": null,
          "director_rejected_by": null,
          "expenses": [
            {
              "id": 1,
              "concept": "Comida y Alimentos",
              "payment_method": "cash",
              "cost_in_cents": 50000,
              "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
              "payment_method": "cash",
              "accepted_at": null,
              "rejected_at": null,
              "cost": "500.00",
              "voucher_file": "https://element-desarrollo.s3.amazonaws.com/expenses/v1/1/voucher_file.pdf"
            }
          ]  
        }
      ]
    }
    

    Devuelve todas las solicitudes de reembolso.

    Eliminar Insumo

    DELETE /api/v1/supplies/:supply_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Response HTTP 204

    Elimina una solicitud reembolso.

    Aceptar Insumo

    POST /api/v1/supplies/:supply_id/confirm

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "message": "Non culpa non aute id nostrud nulla sunt fugiat consequat elit. Cillum adipisicing voluptate eu adipisicing in aliqua reprehenderit cillum mollit adipisicing ut. Anim sit adipisicing ex pariatur labore consequat magna. Culpa ad cupidatat esse dolore laboris ut nostrud ea id et velit et enim enim."
    }
    

    Response HTTP 204

    Atributo Validaciones
    supply_id required,typeOf:numeric, exists:supply,id
    message required,typeOf:string, min:0

    Acepta la solicitud de gastos. Al confirmar un insumo se envía a revisión a la el head de área o el administrador.

    Rechazar Insumo

    POST /api/v1/supplies/:supply_id/reject

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "message": "Non culpa non aute id nostrud nulla sunt fugiat consequat elit. Cillum adipisicing voluptate eu adipisicing in aliqua reprehenderit cillum mollit adipisicing ut. Anim sit adipisicing ex pariatur labore consequat magna. Culpa ad cupidatat esse dolore laboris ut nostrud ea id et velit et enim enim."
    }
    

    Response HTTP 204

    Atributo Validaciones
    supply_id required,typeOf:numeric, exists:supply,id
    message sometimes,typeOf:string, min:0

    Acepta la solicitud de gastos. Al confirmar un insumo se envía a revisión a la el head de área o el administrador.

    Reembolsos

    Crear Gasto en Reembolso

    POST /api/v1/refunds/expenses

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "supplier_id": "1",
      "project": 3,
      "concept": "Comida y Alimentos",
      "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
      "cost_in_cents": 50000,
      "voucher_file": File
    }
    

    Response HTTP 200

    {
      "id": 1,
      "customer": {
        "name": "Cerveza Corona",
        "brand": "Grupo Modelo",
        "project": "Campaña Modelo",
      },
      "created_by": {
        "id": 4004,
        "given_name": null,
        "name": "Fiacro Ruiz",
        "picture": "http://payment-docs.element.mx/images/default_profile.jpg",,
        "custom_picture": null,
        "role": "employee"
      },
      "leader_accepted_by": null,
      "leader_rejected_by": null,
      "director_accepted_by": null,
      "director_rejected_by": null,
      "expenses": [
        {
          "id": 1,
          "concept": "Comida y Alimentos",
          "cost_in_cents": 50000,
          "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
          "payment_method": "cash",
          "accepted_at": null,
          "rejected_at": null,
          "cost": "500.00",
          "voucher_file": "https://element-desarrollo.s3.amazonaws.com/expenses/v1/1/voucher_file.pdf"
        }
      ]  
    }
    

    Crea una cotización gastos para el insumo en curso.

    Para obtener supplier_id ver: Crear Proveedores

    Atributo Validaciones
    refund_id sometimes, typeOf:numeric, exists:refund,id
    customer sometimes, typeOf:numeric, exists:customer,id
    brand sometimes, typeOf:numeric, exists:brand,id
    project sometimes, typeOf:numeric, exists:project,id
    supplier_id required,typeOf:numeric, exists:supplier,id
    concept required,typeOf:string, min:1, max:512
    cost_in_cents required,typeOf:number, min:0
    comments required,typeOf:string
    voucher_file sometimes, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx

    Editar Gasto de Reembolso

    PUT /api/v1/refunds/:refund_id/expenses/:expense_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "quotation": 5,
      "concept": "Comida y Alimentos",
      "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
      "cost_in_cents": 50000,
      "voucher_file": File
    }
    

    Response HTTP 200

    {
      "id": 1,
      "customer": {
        "name": "Cerveza Corona",
        "brand": "Grupo Modelo",
        "project": "Campaña Modelo",
      },
      "created_by": {
        "id": 4004,
        "given_name": null,
        "name": "Fiacro Ruiz",
        "picture": "http://payment-docs.element.mx/images/default_profile.jpg",,
        "custom_picture": null,
        "role": "employee"
      },
      "leader_accepted_by": null,
      "leader_rejected_by": null,
      "director_accepted_by": null,
      "director_rejected_by": null,
      "expenses": [
        {
          "id": 1,
          "concept": "Comida y Alimentos",
          "cost_in_cents": 50000,
          "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
          "payment_method": "cash",
          "accepted_at": null,
          "rejected_at": null,
          "cost": "500.00",
          "voucher_file": "https://element-desarrollo.s3.amazonaws.com/expenses/v1/1/voucher_file.pdf"
        }
      ]  
    }
    

    Edita el insumo con identificadores iguales a :expense_id y :refund_id.

    Atributo Validaciones
    refund_id sometimes, typeOf:numeric, exists:refund,id
    customer sometimes, typeOf:numeric, exists:customer,id
    brand sometimes, typeOf:numeric, exists:brand,id
    project sometimes, typeOf:numeric, exists:project,id
    expense_id required,typeOf:numeric, exists:expense,id
    concept sometimes,typeOf:string, min:1, max:512
    cost_in_cents sometimes,typeOf:number, min:0
    comments sometimes,typeOf:string
    voucher_file sometimes, size:5Mb, extension:pdf,jpg,png,doc,docx,xlsx

    Eliminar Gasto de Reembolso

    DELETE /api/v1/refunds/:refund_id/expenses/:expense_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Response HTTP 204

    Obtener Reembolso

    POST /api/v1/refunds/:refund_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    Response HTTP 200

    {
      "id": 1,
      "customer": {
        "name": "Cerveza Corona",
        "brand": "Grupo Modelo",
        "project": "Campaña Modelo",
      },
      "created_by": {
        "id": 4004,
        "given_name": null,
        "name": "Fiacro Ruiz",
        "picture": "http://payment-docs.element.mx/images/default_profile.jpg",,
        "custom_picture": null,
        "role": "employee"
      },
      "leader_accepted_by": null,
      "leader_rejected_by": null,
      "director_accepted_by": null,
      "director_rejected_by": null,
      "expenses": [
        {
          "id": 1,
          "concept": "Comida y Alimentos",
          "cost_in_cents": 50000,
          "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
          "payment_method": "cash",
          "accepted_at": null,
          "rejected_at": null,
          "cost": "500.00",
          "voucher_file": "https://element-desarrollo.s3.amazonaws.com/expenses/v1/1/voucher_file.pdf"
        }
      ]  
    }
    

    Obtiene el detalle de un reembolso.

    Obtener Reembolsos

    POST /api/v1/refunds

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    Response HTTP 200

    {
      "refunds": [
        {
          "id": 1,
          "customer": {
            "name": "Cerveza Corona",
            "brand": "Grupo Modelo",
            "project": "Campaña Modelo",
          },
          "created_by": {
            "id": 4004,
            "given_name": null,
            "name": "Fiacro Ruiz",
            "picture": "http://payment-docs.element.mx/images/default_profile.jpg",,
            "custom_picture": null,
            "role": "employee"
          },
          "leader_accepted_by": null,
          "leader_rejected_by": null,
          "director_accepted_by": null,
          "director_rejected_by": null,
          "expenses": [
            {
              "id": 1,
              "concept": "Comida y Alimentos",
              "cost_in_cents": 50000,
              "comments": "Voluptate officia mollit officia pariatur enim in occaecat in. Esse nisi voluptate irure do est anim fugiat incididunt. Occaecat fugiat quis cupidatat eiusmod dolore sit. Laboris nulla amet sunt sit ullamco cillum ex excepteur magna magna in eiusmod dolore.",
              "payment_method": "cash",
              "accepted_at": null,
              "rejected_at": null,
              "cost": "500.00",
              "voucher_file": "https://element-desarrollo.s3.amazonaws.com/expenses/v1/1/voucher_file.pdf"
            }
          ]  
        }
      ]
    }
    

    Devuelve todas las solicitudes de reembolso.

    Eliminar Reembolso

    DELETE /api/v1/refunds/:refund_id

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Response HTTP 204

    Elimina una solicitud reembolso.

    Aceptar Reembolso

    POST /api/v1/refunds/:refund_id/confirm

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "message": "Non culpa non aute id nostrud nulla sunt fugiat consequat elit. Cillum adipisicing voluptate eu adipisicing in aliqua reprehenderit cillum mollit adipisicing ut. Anim sit adipisicing ex pariatur labore consequat magna. Culpa ad cupidatat esse dolore laboris ut nostrud ea id et velit et enim enim."
    }
    

    Response HTTP 204

    Atributo Validaciones
    refund_id required,typeOf:numeric, exists:refund,id
    message required,typeOf:string, min:0

    Acepta la solicitud de reembolso. Al confirmar una reembolso se envía a revisión a la el head de área o el administrador.

    Rechazar Reembolso

    POST /api/v1/refunds/:refund_id/reject

    Authorization: Bearer [Auth0]

    Roles: admin, grouper, account_manager

    Request

    {
      "message": "Non culpa non aute id nostrud nulla sunt fugiat consequat elit. Cillum adipisicing voluptate eu adipisicing in aliqua reprehenderit cillum mollit adipisicing ut. Anim sit adipisicing ex pariatur labore consequat magna. Culpa ad cupidatat esse dolore laboris ut nostrud ea id et velit et enim enim."
    }
    

    Response HTTP 204

    Atributo Validaciones
    refund_id required,typeOf:numeric, exists:refund,id
    message sometimes,typeOf:string, min:0

    Acepta la solicitud de reembolso. Al confirmar una reembolso se envía a revisión a la el head de área o el administrador.

    Catálogos

    Conceptos o Servicios

    GET /api/v1/catalogs/concepts

    Authorization: Bearer [Auth0]

    Response HTTP 200

    { 
      "concepts": [ 
        "Renta de camaras", 
        "Comida y alimentos" 
      ] 
    }
    

    Devuelve una lista con los conceptos o servicios que ya fueron almacenados a través de cotización a proveedor y gastos.

    Actividades Comerciales

    GET /api/v1/catalogs/business_activities

    Authorization: Bearer [Auth0]

    Response HTTP 200

    {
      "business_activities": [
        { 
          "id": 153, 
          "name": "Bolsas de plástico"
        },
        { 
          "id": 154, 
          "name": "Calzado"
        },
        { 
          "id": 155, 
          "name": "Cemento"
        },
        { 
          "id": 156, 
          "name": "Cigarrillos"
        },
        { 
          "id": 157, 
          "name": "Electrodomésticos"
        },
        { 
          "id": 158, 
          "name": "Fábricas de autos"
        },
        { 
          "id": 159, 
          "name": "Fábricas de ropa"
        },
        { 
          "id": 160, 
          "name": "Fertilizantes"
        },
      ]
    }
    

    Devuelve una lista con las actividades comerciales.

    Reportes

    Rentabilidad

    GET /api/v1/reports/profitability

    Authorization: Bearer [Auth0]

    Response HTTP 200

    {
      "customers": [
        {
          "id": 1,
          "code": "GC",
          "name": "Grupo Modelo",
          "payment_conditions": 0,
          "description": "Empresa de cervecería",
          "picture": null,
          "picture_url": null,
          "brands": "/api/v1/customers/1/brands",
          "projects_count": 1,
          "projects": [
            {
              "id": 1,
              "folio": "602",
              "name": "Mailing Corona Promo",
              "description": "mailing promocional",
              "grouper": "grouper": {
                "id": 4002,
                "given_name": null,
                "name": "Omar Cruz",
                "picture": "http://payment-docs.element.mx/images/default_profile.jpg",
                "custom_picture": null,
                "role": "grouper"
              },
              "collaborators": [Array],
              "brand": "Modelo Especial",
              "customer": "Grupo Modelo",
              "status": 1,
              "profitability": { 
                "profits_number": 100000,
                "outgoings_number": 100000,
                "profits": "0.00",
                "outgoings": "0.00",
                "total_number": 0,
                "total": "0 %",
                "status_label": "danger"
              },
              "quotations_total": 1,
              "quotations": [
                {
                  "id": 1,
                  "location": "Ciuidad de México",
                  "cost_in_cents": 100000,
                  "project_start_date": "2019-12-24T23:24:42.101Z",
                  "project_end_date": "2020-09-18T01:10:56.835Z",
                  "payment_conditions": 60,
                  "priority": "low",
                  "completed_at": "2020-01-10T22:29:00.866Z",
                  "created_by": [Object],
                  "cost": "1000.00",
                  "quotation_file": null,
                  "confirmation_file": null,
                  "status": 3,
                  "rejected": false,
                  "approved": true,
                  "grouper_accepted_by": [Object],
                  "stats": {
                    "quotation_cost_number": 100000,
                    "quotation_cost": "1000.00",
                    "profitability_number": 0,
                    "profitability": "0 %",
                    "subtotal": "1000.00",
                    "subtotal_number": 100000,
                    "gain_total": "0.00",
                    "gain_total_number": 0,
                    "direct_bank_transfer": "500.00",
                    "cash": "500.00",
                    "direct_bank_transfer_number": 50000,
                    "cash_number": 50000,
                    "suppliers_total": "1000.00",
                    "suppliers_total_number": 100000,
                    "status_label": "danger"
                  }
                }
              ]
            }
          ],
          "profitability": {
            "refunds_total": 50000,
            "supplies_total": 50000,
            "suppliers_payment_total": 100000,
            "profits_total": 100000,
            "money_outflow": 200000,
            "profitability_number": -100,
            "profitability": "-100 %",
            "status_label": "danger"
          }
        }
      ]
    }
    

    Devuelve la rentabilidad por cliente.

    Notificaciones

    Todas las notificaciones

    GET /api/v1/notifications

    Authorization: Bearer [Auth0]

    Response HTTP 200

    {
      "notifications": [
        {
          "id": 1,
          "status": "submited",
          "type_of": "quotation",
          "read_at": null,
          "deleted_at": null,
          "mail_sended_at": null,
          "to": 4002,
          "from": 4003,
          "quotation": null,
          "supply": null,
          "refund": null,
          "message": "Alfonso Jimenez ha creado una solicitud. Tu eres el responsable de su revisión."
        }
      ]
    }
    

    Devuelve una lista con todas las notificaciones.

    Marcar como leida

    PUT /api/v1/notifications/:notification_id/read

    Authorization: Bearer [Auth0]

    Response HTTP 204

    Marca una notificación como leída.

    Validaciones

    {
      "email": "sometimes|typeOf:string|email|unique:user,email",
      "name": "sometimes|typeOf:string|min:1|max:120|regex:alphabetic",
      "father_surname": "sometimes|typeOf:string|min:1|max:120|regex:alphabetic",
      "mother_surname": "sometimes|typeOf:string|min:1|max:120|regex:alphabetic",
      "card_digits": "sometimes|typeOf:string|exact:8|typeOf:numeric|unique:customer,card_digits",
      "cell_phone": "sometimes|typeOf:string|exact:10|typeOf:numeric|unique:customer,cell_phone",
    }
    
    Tipo Descripción Código de Error
    string Cadena ("Hola", "Mundo", "007") 42217
    numeric Cadena de números ("0001", "0431.99") 42222
    number Valor númerico (1, 431.99) 42218
    object Objeto JSON ({ "name" : "Omar"}) 42219
    array Arreglo ([1, "pez", 0.3]) 42220
    boolean Tipo booleano (0, 1, true, false, True, False) 42221
    HTTP Código de Error
    400 4001
    HTTP Código de Error
    422 42216
    HTTP Código de Error
    415 4154
    HTTP Código de Error
    415 4151
    Tipo HTTP Código de Error
    string, number 422 4226
    image, file 415 4153
    Dato HTTP Código de Error
    {{thing}}, {{value}} 409 4093
    Dato HTTP Código de Error
    {{model}} 404 4042
    HTTP Código de Error
    422 4225
    HTTP Código de Error
    422 4225
    Dato HTTP Código de Error
    {{format}} 422 4229
    Dato HTTP Código de Error
    {{len}} 422 4222
    Dato HTTP Código de Error
    {{len}} 422 4223
    Dato HTTP Código de Error
    {{len}} 422 4226
    Dato HTTP Código de Error
    {{list}} 422 42210
    Regex Código de Error
    alphanumeric 4228
    letters 4227
    name 42224
    url 42213
    digits 42222
    device_uuid 42225
    phone 42226

    Errors

    Formato

    
        {
         code :  422,
         message :  "Hay errores semánticos y no se puede procesar el contenido de la solicitud.",
         errors : [
          {
           code : 4222,
           fields : "email",
           message : "El formato del correo electrónico es incorrecto"
          },
          {
           code : 4221,
           fields : "name",
           message : "El nombre no puede contener caracteres especiales"
          }
         ]
        }
    

    Todos los errores del API deben proveer una respuesta JSON que informe sobre el error. El formato de los errores se dividen en 2 dependiendo su código de estado HTTP:

    1. Los errores de validación de campos que corresponden en mayor parte a códigos 400 y 422. Por ejemplo, La contraseña no debe tener más de 16 caracteres, El campo email no puede ser vacío, etc.

        {
         code : "4033",
         message :  "No fue posible verificar la autenticidad de la firma."
        }
    

    2. Los errores que no correspondan a errores de campos. Por ejemplo, No cuentas con los permisos necesarios para realizar esta acción, Token inválido, etc.

    Para este tipo de errores se envía un JSON con el siguiente formato:

    El lenguaje del mensaje de error depende del código de lenguaje que se envíe en la cabecera Accept-Language de la petición que provoque el error. Si la cabecera no se encuentra o el código es diferente de es o en el lenguaje por defecto es Español.

     HTTP Errors y Códigos de Error

    Error Code Meaning
    400
    Bad Request - No se puede procesar la solicitud debido a algo que se percibe como un error del cliente.
    401
    Unauthorized - Hay un error con la autorización.
    403
    Forbidden - No es posible otorgar acceso.
    404
    Not Found - No se encontró el recurso de destino.
    409
    Conflict - La solicitud no pudo completarse debido a un conflicto con el estado actual.
    410
    Gone - El recurso objetivo ya no está disponible.
    415
    Unsupported Media Type - Hay un problema con el archivo.
    422
    Unprocessable Entry - Hay errores semánticos y no se puede procesar el contenido de la solicitud
    423
    Locked - No puedes realizar esta acción ya que esta bloqueada
    424
    Failed Dependency - La acción solicitada dependía de otra acción y esa acción falló
    500
    Server Error - El servidor encontró una condición inesperada que le impidió cumplir con la solicitud.
    1081
    El pago fue realizado con éxito, pero no se ha recibido la confimación.
    4001
    El campo no ha sido enviado.
    4002
    Tiene valores duplicados.
    4011
    Token inválido.
    4012
    Credenciales incorrectas.
    4013
    La sesión no es válida.
    4014
    Se requiere el encabezado Authorization.
    4015
    Falta subject en payload.
    4016
    La sesión expiró.
    4031
    No cuentas con los permisos para realizar esta acción.
    4032
    No existe una solicitud para establecer contraseña.
    4033
    No fue posible verificar la autenticidad de la firma.
    4041
    El recurso que buscas no existe.
    4042 {{model}}
    La instancia del modelo {{model}} no se encontró.
    4091
    El administrador debe tener los permisos básicos.
    4092
    Este correo electrónico ya ha sido tomado.
    4093 {{thing}} {{value}}
    {{thing}} {{value}} ya ha sido tomado.
    4101
    El recurso solicitado ya no está disponible
    4151
    El formato debe ser uno de los siguientes: jpg, jpeg, png, pdf.
    4152 {{h}} {{w}}
    El tamaño de la imagen debe ser mayor a {{h}} x {{w}} px.
    4153 {{size}}
    El archivo debe pesar a lo más {{size}} Kb.
    4154
    Debe ser un archivo (Hint: Content-Type: multipart/form-data)
    4221
    No puede ser vacío onull.
    4222 {{len}}
    Debe tener {{len}} o más caracteres.
    4223 {{len}}
    Debe tener a lo más {{len}} caracteres.
    4224
    El formato no es válido.
    4225
    Las contraseñas no coinciden.
    4226 {{len}}
    La longitud del debe ser {{len}}.
    4227
    Debe tener sólo letras.
    4228
    Debe tener sólo letras y números.
    4229 {{format}}
    Debe tener el formato {{format}}
    42210 {{list}}
    Debe ser uno de los siguientes valores: {{list}}
    42211
    Debe ser true o false
    42212 {{min}} {{max}}
    Debe ser mayor que {{min}} y menor o igual que {{max}}
    42213
    No es una URL válida.
    42214 {{type}}
    Debe ser del tipo: {{type}}
    42215
    El rango de fechas es incorrecto.
    42216
    Correo electrónico inválido.
    42217
    Debe ser una cadena.
    42218
    Debe ser un número.
    42219
    Debe ser un Objeto JSON.
    42220
    Debe ser un arreglo.
    42221
    Debe ser un valor booleano.
    42222
    Debe ser una cadena de números.
    42223
    Debe ser una fecha.
    42224
    Debe tener sólo letras y .
    42225
    Identificador Único inválido.
    42226
    Número de teléfono inválido.
    4231
    No puedes cambiar tu rol.
    4232
    No puedes desactivarte.
    4241
    No fue posible enviar el correo electrónico debido a problemas con el servidor SMTP.