n8n-nodes-aivencerealtycrm 1.9.2 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,6 +60,10 @@ class AivenceRealty {
60
60
  name: 'Appointment',
61
61
  value: 'appointment',
62
62
  },
63
+ {
64
+ name: 'Calculator',
65
+ value: 'calculator',
66
+ },
63
67
  ],
64
68
  default: 'lead',
65
69
  description: 'Recurso del CRM a operar',
@@ -1645,6 +1649,234 @@ class AivenceRealty {
1645
1649
  default: 'pending',
1646
1650
  description: 'Nuevo estado de la cita',
1647
1651
  },
1652
+ // ============================================
1653
+ // CALCULATOR OPERATIONS
1654
+ // ============================================
1655
+ {
1656
+ displayName: 'Operación',
1657
+ name: 'operation',
1658
+ type: 'options',
1659
+ noDataExpression: true,
1660
+ displayOptions: {
1661
+ show: {
1662
+ resource: ['calculator'],
1663
+ },
1664
+ },
1665
+ options: [
1666
+ {
1667
+ name: 'Hipoteca Tradicional',
1668
+ value: 'hipoteca_tradicional',
1669
+ description: 'Calcular cuota de crédito hipotecario en pesos',
1670
+ action: 'Calcular hipoteca tradicional',
1671
+ },
1672
+ {
1673
+ name: 'Hipoteca UVA',
1674
+ value: 'hipoteca_uva',
1675
+ description: 'Calcular crédito UVA con ajuste por inflación',
1676
+ action: 'Calcular hipoteca uva',
1677
+ },
1678
+ {
1679
+ name: 'Costos Escrituración',
1680
+ value: 'costos_escrituracion',
1681
+ description: 'Calcular gastos de escrituración y transferencia',
1682
+ action: 'Calcular costos escrituracion',
1683
+ },
1684
+ {
1685
+ name: 'Alquiler vs Compra',
1686
+ value: 'alquiler_vs_compra',
1687
+ description: 'Comparar conveniencia financiera de alquilar o comprar',
1688
+ action: 'Comparar alquiler vs compra',
1689
+ },
1690
+ ],
1691
+ default: 'hipoteca_tradicional',
1692
+ },
1693
+ // Precio Propiedad (todos)
1694
+ {
1695
+ displayName: 'Precio Propiedad (ARS)',
1696
+ name: 'property_price',
1697
+ type: 'number',
1698
+ displayOptions: {
1699
+ show: {
1700
+ resource: ['calculator'],
1701
+ operation: ['hipoteca_tradicional', 'hipoteca_uva', 'costos_escrituracion', 'alquiler_vs_compra'],
1702
+ },
1703
+ },
1704
+ default: 80000000,
1705
+ required: true,
1706
+ description: 'Precio de la propiedad en pesos argentinos',
1707
+ },
1708
+ // Anticipo % (hipotecas + alquiler vs compra)
1709
+ {
1710
+ displayName: 'Anticipo (%)',
1711
+ name: 'down_payment_pct',
1712
+ type: 'number',
1713
+ displayOptions: {
1714
+ show: {
1715
+ resource: ['calculator'],
1716
+ operation: ['hipoteca_tradicional', 'hipoteca_uva', 'alquiler_vs_compra'],
1717
+ },
1718
+ },
1719
+ default: 20,
1720
+ description: 'Porcentaje de anticipo (0-100)',
1721
+ },
1722
+ // Tasa Interés (hipotecas + alquiler vs compra)
1723
+ {
1724
+ displayName: 'Tasa Interés Anual (%)',
1725
+ name: 'interest_rate',
1726
+ type: 'number',
1727
+ displayOptions: {
1728
+ show: {
1729
+ resource: ['calculator'],
1730
+ operation: ['hipoteca_tradicional', 'hipoteca_uva', 'alquiler_vs_compra'],
1731
+ },
1732
+ },
1733
+ default: 45,
1734
+ required: true,
1735
+ description: 'Tasa de interés anual (TNA) en porcentaje',
1736
+ },
1737
+ // Plazo años (hipotecas)
1738
+ {
1739
+ displayName: 'Plazo (años)',
1740
+ name: 'loan_term_years',
1741
+ type: 'number',
1742
+ displayOptions: {
1743
+ show: {
1744
+ resource: ['calculator'],
1745
+ operation: ['hipoteca_tradicional', 'hipoteca_uva'],
1746
+ },
1747
+ },
1748
+ default: 20,
1749
+ required: true,
1750
+ description: 'Plazo del préstamo en años',
1751
+ },
1752
+ // Valor UVA (hipoteca UVA)
1753
+ {
1754
+ displayName: 'Valor UVA Actual',
1755
+ name: 'uva_value',
1756
+ type: 'number',
1757
+ displayOptions: {
1758
+ show: {
1759
+ resource: ['calculator'],
1760
+ operation: ['hipoteca_uva'],
1761
+ },
1762
+ },
1763
+ default: 1250,
1764
+ required: true,
1765
+ description: 'Valor actual de la UVA (consultar BCRA)',
1766
+ },
1767
+ // Ajuste CPI (hipoteca UVA)
1768
+ {
1769
+ displayName: 'Ajuste CPI Esperado (%/año)',
1770
+ name: 'cpi_adjustment_pct',
1771
+ type: 'number',
1772
+ displayOptions: {
1773
+ show: {
1774
+ resource: ['calculator'],
1775
+ operation: ['hipoteca_uva'],
1776
+ },
1777
+ },
1778
+ default: 25,
1779
+ description: 'Inflación esperada anual para proyección',
1780
+ },
1781
+ // Tipo de Propiedad (costos escrituración)
1782
+ {
1783
+ displayName: 'Tipo de Propiedad',
1784
+ name: 'property_type',
1785
+ type: 'options',
1786
+ displayOptions: {
1787
+ show: {
1788
+ resource: ['calculator'],
1789
+ operation: ['costos_escrituracion'],
1790
+ },
1791
+ },
1792
+ options: [
1793
+ {
1794
+ name: 'Departamento',
1795
+ value: 'departamento',
1796
+ },
1797
+ {
1798
+ name: 'Casa',
1799
+ value: 'casa',
1800
+ },
1801
+ {
1802
+ name: 'Terreno',
1803
+ value: 'terreno',
1804
+ },
1805
+ ],
1806
+ default: 'departamento',
1807
+ },
1808
+ // Es Nueva (costos escrituración)
1809
+ {
1810
+ displayName: '¿Es Propiedad Nueva?',
1811
+ name: 'is_new',
1812
+ type: 'boolean',
1813
+ displayOptions: {
1814
+ show: {
1815
+ resource: ['calculator'],
1816
+ operation: ['costos_escrituracion'],
1817
+ },
1818
+ },
1819
+ default: false,
1820
+ description: 'Si es propiedad nueva, algunos impuestos no aplican',
1821
+ },
1822
+ // Alquiler Mensual (alquiler vs compra)
1823
+ {
1824
+ displayName: 'Alquiler Mensual (ARS)',
1825
+ name: 'monthly_rent',
1826
+ type: 'number',
1827
+ displayOptions: {
1828
+ show: {
1829
+ resource: ['calculator'],
1830
+ operation: ['alquiler_vs_compra'],
1831
+ },
1832
+ },
1833
+ default: 500000,
1834
+ required: true,
1835
+ description: 'Alquiler mensual actual',
1836
+ },
1837
+ // Años a Comparar (alquiler vs compra)
1838
+ {
1839
+ displayName: 'Años a Comparar',
1840
+ name: 'years',
1841
+ type: 'number',
1842
+ displayOptions: {
1843
+ show: {
1844
+ resource: ['calculator'],
1845
+ operation: ['alquiler_vs_compra'],
1846
+ },
1847
+ },
1848
+ default: 5,
1849
+ required: true,
1850
+ description: 'Período de análisis en años',
1851
+ },
1852
+ // Apreciación Anual (alquiler vs compra)
1853
+ {
1854
+ displayName: 'Apreciación Anual (%)',
1855
+ name: 'property_appreciation',
1856
+ type: 'number',
1857
+ displayOptions: {
1858
+ show: {
1859
+ resource: ['calculator'],
1860
+ operation: ['alquiler_vs_compra'],
1861
+ },
1862
+ },
1863
+ default: 5,
1864
+ description: 'Valorización esperada de la propiedad por año',
1865
+ },
1866
+ // Aumento Alquiler (alquiler vs compra)
1867
+ {
1868
+ displayName: 'Aumento Alquiler Anual (%)',
1869
+ name: 'rent_increase',
1870
+ type: 'number',
1871
+ displayOptions: {
1872
+ show: {
1873
+ resource: ['calculator'],
1874
+ operation: ['alquiler_vs_compra'],
1875
+ },
1876
+ },
1877
+ default: 40,
1878
+ description: 'Incremento esperado del alquiler por año',
1879
+ },
1648
1880
  ],
1649
1881
  };
1650
1882
  }
@@ -1653,6 +1885,7 @@ class AivenceRealty {
1653
1885
  const returnData = [];
1654
1886
  const credentials = await this.getCredentials('aivenceRealtyApi');
1655
1887
  const baseUrl = credentials.baseUrl;
1888
+ const apiKey = credentials.apiKey;
1656
1889
  for (let i = 0; i < items.length; i++) {
1657
1890
  try {
1658
1891
  const resource = this.getNodeParameter('resource', i);
@@ -1840,7 +2073,7 @@ class AivenceRealty {
1840
2073
  // Operación -> Estado (Laravel espera "estado": "for_rent" o "for_sale")
1841
2074
  const operacion = this.getNodeParameter('searchOperacion', i, '');
1842
2075
  if (operacion && operacion !== 'NULL' && operacion !== '') {
1843
- qs.estado = operacion; // ✅ FIXED: Laravel acepta "estado"
2076
+ qs.estado = operacion;
1844
2077
  }
1845
2078
  // Tipo de Propiedad
1846
2079
  const tipoPropiedad = this.getNodeParameter('searchTipoPropiedad', i, '');
@@ -1850,7 +2083,7 @@ class AivenceRealty {
1850
2083
  // Zonas (barrios) - Smart Zone Logic aplicado desde workflow
1851
2084
  const zonas = this.getNodeParameter('searchZonas', i, '');
1852
2085
  if (zonas && zonas !== '' && zonas !== 'NULL' && zonas !== 'null') {
1853
- qs.barrio = zonas; // ✅ FIXED: Laravel acepta "barrio" (formato: "Núñez, Saavedra, Belgrano")
2086
+ qs.barrio = zonas; // Formato: "Núñez, Saavedra, Belgrano"
1854
2087
  }
1855
2088
  // Dormitorios
1856
2089
  const dormitoriosMin = this.getNodeParameter('searchDormitoriosMin', i, 0);
@@ -1925,7 +2158,7 @@ class AivenceRealty {
1925
2158
  // Operación -> Estado (Laravel espera "estado": "for_rent" o "for_sale")
1926
2159
  const operacion = this.getNodeParameter('searchOperacion', i, '');
1927
2160
  if (operacion && operacion !== 'NULL' && operacion !== '') {
1928
- qs.estado = operacion; // ✅ FIXED: Laravel acepta "estado"
2161
+ qs.estado = operacion;
1929
2162
  }
1930
2163
  // Tipo de Propiedad
1931
2164
  const tipoPropiedad = this.getNodeParameter('searchTipoPropiedad', i, '');
@@ -1935,7 +2168,7 @@ class AivenceRealty {
1935
2168
  // Zonas (barrios) - Smart Zone Logic aplicado desde workflow
1936
2169
  const zonas = this.getNodeParameter('searchZonas', i, '');
1937
2170
  if (zonas && zonas !== '' && zonas !== 'NULL' && zonas !== 'null') {
1938
- qs.barrio = zonas; // ✅ FIXED: Laravel acepta "barrio" (formato: "Núñez, Saavedra, Belgrano")
2171
+ qs.barrio = zonas; // Formato: "Núñez, Saavedra, Belgrano"
1939
2172
  }
1940
2173
  // Dormitorios
1941
2174
  const dormitoriosMin = this.getNodeParameter('searchDormitoriosMin', i, 0);
@@ -2054,6 +2287,7 @@ class AivenceRealty {
2054
2287
  responseData = await this.helpers.httpRequest({
2055
2288
  method: 'POST',
2056
2289
  url: `${baseUrl}/api/v1/emails/ingest`,
2290
+ headers: { 'Authorization': `Bearer ${apiKey}`, 'Accept': 'application/json', 'Content-Type': 'application/json' },
2057
2291
  body,
2058
2292
  json: true,
2059
2293
  });
@@ -2359,6 +2593,60 @@ class AivenceRealty {
2359
2593
  });
2360
2594
  }
2361
2595
  }
2596
+ // ============================================
2597
+ // CALCULATOR RESOURCE
2598
+ // ============================================
2599
+ else if (resource === 'calculator') {
2600
+ const operation = this.getNodeParameter('operation', i);
2601
+ let body = {};
2602
+ let endpoint = '';
2603
+ if (operation === 'hipoteca_tradicional') {
2604
+ endpoint = '/api/v1/calculadoras/hipoteca-tradicional';
2605
+ body = {
2606
+ property_price: this.getNodeParameter('property_price', i),
2607
+ down_payment_pct: this.getNodeParameter('down_payment_pct', i),
2608
+ interest_rate: this.getNodeParameter('interest_rate', i),
2609
+ loan_term_years: this.getNodeParameter('loan_term_years', i),
2610
+ };
2611
+ }
2612
+ else if (operation === 'hipoteca_uva') {
2613
+ endpoint = '/api/v1/calculadoras/hipoteca-uva';
2614
+ body = {
2615
+ property_price: this.getNodeParameter('property_price', i),
2616
+ down_payment_pct: this.getNodeParameter('down_payment_pct', i),
2617
+ interest_rate: this.getNodeParameter('interest_rate', i),
2618
+ loan_term_years: this.getNodeParameter('loan_term_years', i),
2619
+ uva_value: this.getNodeParameter('uva_value', i),
2620
+ cpi_adjustment_pct: this.getNodeParameter('cpi_adjustment_pct', i),
2621
+ };
2622
+ }
2623
+ else if (operation === 'costos_escrituracion') {
2624
+ endpoint = '/api/v1/calculadoras/costos-escrituracion';
2625
+ body = {
2626
+ property_price: this.getNodeParameter('property_price', i),
2627
+ property_type: this.getNodeParameter('property_type', i),
2628
+ is_new: this.getNodeParameter('is_new', i),
2629
+ };
2630
+ }
2631
+ else if (operation === 'alquiler_vs_compra') {
2632
+ endpoint = '/api/v1/calculadoras/alquiler-vs-compra';
2633
+ body = {
2634
+ property_price: this.getNodeParameter('property_price', i),
2635
+ monthly_rent: this.getNodeParameter('monthly_rent', i),
2636
+ years: this.getNodeParameter('years', i),
2637
+ down_payment_pct: this.getNodeParameter('down_payment_pct', i),
2638
+ mortgage_rate: this.getNodeParameter('interest_rate', i),
2639
+ property_appreciation: this.getNodeParameter('property_appreciation', i),
2640
+ rent_increase: this.getNodeParameter('rent_increase', i),
2641
+ };
2642
+ }
2643
+ responseData = await this.helpers.httpRequest({
2644
+ method: 'POST',
2645
+ url: `${baseUrl}${endpoint}`,
2646
+ body,
2647
+ json: true,
2648
+ });
2649
+ }
2362
2650
  // Formatear respuesta
2363
2651
  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
2364
2652
  returnData.push(...executionData);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-aivencerealtycrm",
3
- "version": "1.9.2",
3
+ "version": "2.0.1",
4
4
  "description": "Nodo n8n para integrar el CRM inmobiliario AivenceRealty",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -10,7 +10,10 @@
10
10
  "Real Estate",
11
11
  "Inmobiliario",
12
12
  "Property Management",
13
- "API Integration"
13
+ "API Integration",
14
+ "Calculator",
15
+ "Mortgage",
16
+ "Argentina"
14
17
  ],
15
18
  "license": "MIT",
16
19
  "homepage": "https://realty.aivence.com",
@@ -28,8 +31,7 @@
28
31
  "dev": "tsc --watch",
29
32
  "format": "prettier nodes credentials --write",
30
33
  "lint": "eslint nodes credentials package.json",
31
- "lintfix": "eslint nodes credentials package.json --fix",
32
- "prepublishOnly": "npm run build"
34
+ "lintfix": "eslint nodes credentials package.json --fix"
33
35
  },
34
36
  "files": [
35
37
  "dist"